Overview
The Aubrai API gives you access to an AI-powered longevity research agent. Ask any question about aging, longevity, or biomedical science and get detailed, citation-rich answers backed by scientific literature.
Available now
Chat — Ask questions and get research-backed answers with citations. Responses take 30–50 seconds as the agent searches literature and synthesizes findings.
Coming soon
Deep Research — Multi-iteration research mode that explores topics in depth over several minutes, building a comprehensive analysis. Available to $Aubrai token holders.
Two ways to use the API
| Mode | How it works | Best for |
|---|---|---|
| Async | Submit a message, get a requestId, poll for status |
Background processing, queues, webhooks |
| Sync (SSE) | Submit a message, receive streamed progress + result | Real-time UIs, chat interfaces |
Base URL
https://api.aubr.ai
429 Too Many Requests with a retryAfterSeconds field.POST /api/chat
Submit a message to the Aubrai agent. Returns immediately with a job ID for polling.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
message |
string | Required | The question or message to send |
conversationId |
string | Optional | UUID from a previous response to continue a conversation |
Response 202 Accepted
{
"requestId": "95cd201f-7d81-4293-8015-1fe9fe390ef2",
"conversationId": "43b29b65-d1cf-4021-bf04-f7702d4a5325",
"status": "queued"
}
Example
curl -X POST https://api.aubr.ai/api/chat \
-H "Content-Type: application/json" \
-d '{"message": "What are the main causes of aging?"}'
GET /api/chat/status/:requestId
Check the status of a submitted job. Poll this endpoint until status is "completed" or "failed".
Path Parameters
| Parameter | Description |
|---|---|
requestId | The job ID returned from POST /api/chat |
Response — In Progress
{
"status": "active",
"progress": {
"stage": "literature",
"percent": 30
}
}
Response — Completed
{
"status": "completed",
"result": {
"text": "The agent's detailed response with citations...",
"responseTime": 46641
}
}
Example
curl https://api.aubr.ai/api/chat/status/95cd201f-7d81-4293-8015-1fe9fe390ef2
POST /api/chat/sync
Submit a message and receive real-time progress updates via Server-Sent Events (SSE). The connection stays open until the response is complete.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
message |
string | Required | The question or message to send |
conversationId |
string | Optional | UUID from a previous response to continue a conversation |
Response — SSE Stream
The response is a stream of Server-Sent Events with Content-Type: text/event-stream. See SSE Event Format below for details on each event type.
Example
curl -N -X POST https://api.aubr.ai/api/chat/sync \
-H "Content-Type: application/json" \
-d '{"message": "What are the main causes of aging?"}'
JavaScript Client Example
async function askAubrai(message) {
const res = await fetch('https://api.aubr.ai/api/chat/sync', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ message }),
});
const reader = res.body.getReader();
const decoder = new TextDecoder();
let buffer = '';
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const lines = buffer.split('\n');
buffer = lines.pop();
let eventType = '';
for (const line of lines) {
if (line.startsWith('event: ')) eventType = line.slice(7);
if (line.startsWith('data: ')) {
const data = JSON.parse(line.slice(6));
console.log(eventType, data);
if (eventType === 'completed') return data;
}
}
}
}
SSE Event Format
The sync endpoint streams these named events:
event: queued
Sent immediately after the job is submitted.
event: queued
data: {"requestId": "uuid", "conversationId": "uuid"}
event: progress
Sent each time the job advances to a new stage.
event: progress
data: {"stage": "literature", "percent": 30}
event: completed
Sent when the agent finishes processing. Contains the full response.
event: completed
data: {"text": "The agent's response...", "conversationId": "uuid", "responseTime": 46641}
event: error
Sent if the job fails or times out.
event: error
data: {"error": "Timeout waiting for completion"}
Conversations
To have a multi-turn conversation, pass the conversationId from a previous response into your next request:
# First message (new conversation)
curl -X POST https://api.aubr.ai/api/chat \
-H "Content-Type: application/json" \
-d '{"message": "What are the main causes of aging?"}'
# Response includes: "conversationId": "43b29b65-..."
# Follow-up message (same conversation)
curl -X POST https://api.aubr.ai/api/chat \
-H "Content-Type: application/json" \
-d '{"message": "Tell me more about telomere attrition", "conversationId": "43b29b65-..."}'
conversationId between requests.Error Handling
All errors return a JSON object with an error field describing what went wrong.
| Status | Meaning | Example |
|---|---|---|
400 |
Missing or invalid message field |
{"error": "message is required and must be a string"} |
429 |
Too many requests — wait and retry | {"error": "Rate limit exceeded...", "retryAfterSeconds": 120} |
502 |
Something went wrong on our end | {"error": "Service error"} |
For the sync SSE endpoint, errors arrive as an event: error event in the stream instead of an HTTP status code.
Premium Access via $Aubrai
Premium API access is unlocked by holding the $Aubrai token. Connect your wallet, hold tokens, and get an API key that unlocks everything.
| Free | Premium ($Aubrai holders) | |
|---|---|---|
| Chat | Limited | Higher limits |
| Deep Research | — | Full access |
Deep Research is a multi-iteration research mode where the agent spends several minutes exploring a topic in depth — reading papers, forming hypotheses, and building a comprehensive analysis with full citations.