Quickstart
From a new account to your first answer: create a key in the API Console, send one request, read the response, then try the stream.
01Create an account
Sign up at researchanything.ai/signup with your email and a password (we email you a six-digit code to confirm the address), or continue with your Essarion ID. If you already use ResearchAnything, sign in with that account.
New accounts start on the Free plan, which includes three research runs a month. Each API call uses one, so this quickstart uses two of them. See Limits.
02Create a key
Open researchanything.ai/console/keys and choose New key. Give it a name that says where it will be used, such as local-dev or prod-backend, and choose Create key. The key starts with ra- and is shown only once. Copy it now.
03Save it as ESSARION_KEY
Keep the key in your environment, not in your code. The examples read it from $ESSARION_KEY.
export ESSARION_KEY="ra-your-key-here"
For deployed code, use your platform's secrets manager. Don't commit keys, and don't send them to a browser.
04Run your first query
The simplest call is a POST to /api/query. It returns only when the run has finished, so give your client a timeout of several minutes.
curl https://researchanything.ai/api/query \
-H "Authorization: Bearer $ESSARION_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "What is the half-life of caffeine in adults?"}'
const res = await fetch("https://researchanything.ai/api/query", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.ESSARION_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ query: "What is the half-life of caffeine in adults?" }),
});
const data = await res.json();
console.log(data.status, data.request_id);
console.log(data.answer);
import os
import requests
resp = requests.post(
"https://researchanything.ai/api/query",
headers={"Authorization": f"Bearer {os.environ['ESSARION_KEY']}"},
json={"query": "What is the half-life of caffeine in adults?"},
timeout=600,
)
data = resp.json()
print(data["status"], data["request_id"])
print(data["answer"])
05Read the response
The response is a JSON envelope. answer is Markdown that cites sources with markers like [S1]; sources lists the sources it was written from; request_id identifies the run.
{
"request_id": "3f1c9a2e-7b4d-4e8a-9c61-2d5f0b8e4a17",
"status": "ok",
"answer": "In healthy adults, caffeine's half-life is usually reported at around five hours, with wide variation between people [S1][S2]. …",
"sources": [
{
"id": "6a0d2c4e-…",
"title": "…",
"url": "https://…",
"domain": "…",
"citations": { "apa": "…", "mla": "…", "chicago": "…", "ieee": "…", "harvard": "…", "bibtex": "…" }
}
],
"usage": { "latency_ms": 94210, "tokens_in": 11, "tokens_out": 612 },
"errors": []
}
Read status first. On ok, use answer and sources. On error, answer is null and errors says what went wrong; this can happen with HTTP 200. See Queries for every field and Errors for the codes.
06Try streaming
The streaming endpoint takes the same request and answers with Server-Sent Events while the run works. -N tells curl to print events as they arrive.
curl -N https://researchanything.ai/api/query/stream \
-H "Authorization: Bearer $ESSARION_KEY" \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{"query": "Compare lithium-ion and sodium-ion batteries for grid storage."}'
The stream opens with a start event carrying the request_id, reports step, source and reasoning events as the run works, and ends with a final event holding the same envelope as /api/query. See Streaming for every event.
07See the run in the Console
Open researchanything.ai/console/usage. Your recent calls are listed with their status and latency. Open one to see the run's steps, reasoning and sources. The timeline is available once the call has finished. See Run timelines.
08Where to go next
- Queries: the request, the response and the source fields.
- Streaming: every event and its payload.
- Errors: codes and when to retry.
- Your first query: the same path with more explanation, and a script that prints the answer with its sources.