Answer
A short answer to a question, with cited sources.
`POST https://api.keirolabs.cloud/api/v2/answer`
Cost: 1 credits paid · 2 free · Latency: ~4 s
Provides an authoritative, LLM-synthesized direct answer to your question with cited sources. Powered by a multi-provider reasoning stack with Keiro retrieval and citation synthesis layered on top. Supports both Server-Sent Events (SSE) streaming and standard JSON responses.
**When to use it.** Use Answer when you need a direct, synthesized response to a question — like asking an expert. Returns a text answer with cited sources. Ideal for chatbots, Q&A systems, and grounding LLM outputs.
**When not to.** Don't use Answer if you need raw search results (use Search), page content (use Search+Content), or multi-step autonomous research with charts (use Web Agent).
## Request
**cURL**
```bash
curl -N -X POST https://api.keirolabs.cloud/api/v2/answer \
-H "Authorization: Bearer $KEIRO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "what is the context window of claude opus?"}'
```
**Python**
```python
import os, requests
res = requests.post(
"https://api.keirolabs.cloud/api/v2/answer",
headers={"Authorization": f"Bearer {os.environ['KEIRO_API_KEY']}"},
json={
"query": "what is the context window of claude opus?"
},
stream=True,
)
for line in res.iter_lines():
print(line.decode())
```
**Node.js**
```js
const res = await fetch("https://api.keirolabs.cloud/api/v2/answer", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KEIRO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"query": "what is the context window of claude opus?"
}),
});
for await (const chunk of res.body) process.stdout.write(chunk);
```
## Parameters
| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | string | yes | The question to answer. No hard length limit, but keep under 1,000 chars for best synthesis quality. |
| `stream` | boolean | no | Stream the response via Server-Sent Events (SSE). Default: true. When true, the response uses text/event-stream and emits chunk events with the running answer text, followed by a final done event. |
| `noCache` | boolean | no | Bypass the search cache and force a fresh web search. Default: false. |
## Response
```json title="200 OK"
{
"answer": "The 2024 US Presidential Election was won by Donald Trump (R), defeating incumbent Kamala Harris (D). Trump secured 312 electoral votes to Harris's 226, with a decisive popular-vote margin of ~2.3%.",
"sources": [
{
"title": "2024 United States presidential election - Wikipedia",
"url": "",
"domain": "wikipedia",
"snippet": "..."
},
{
"title": "Federal Election Commission official results",
"url": "",
"domain": "fec.gov",
"snippet": "..."
}
],
"stats": {
"sources_count": 2,
"latency_ms": 3820,
"credits_used": 5,
"attempt": "ai-search"
},
"creditsRemaining": 1095
}
```
| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `answer` | string | no | LLM-synthesized answer text with inline citations. |
| `sources` | array | no | List of sources cited in the answer. |
| `sources[].title` | string | no | Title of the source page. |
| `sources[].url` | string | no | URL of the source. |
| `sources[].domain` | string | no | Domain name of the source. |
| `sources[].snippet` | string | no | Relevant excerpt from the source. |
| `stats.sources_count` | integer | no | Number of sources used. |
| `stats.latency_ms` | integer | no | Total processing time. |
| `stats.credits_used` | number | no | Credits charged (2 on Free, 1 on paid plans). |
| `creditsRemaining` | number | no | Your remaining credit balance. |
## Errors
| Status | Code | Cause | Fix |
| --- | --- | --- | --- |
| `400` | `VALIDATION_ERROR` | Missing query | Provide a non-empty query string. |
| `401` | `UNAUTHORIZED` | Missing or invalid API key | Check your Authorization: Bearer header. |
| `402` | `INSUFFICIENT_CREDITS` | Not enough credits (need 2, or 1 on paid plans) | Top up or upgrade at /dashboard/billing. |
| `429` | `RATE_LIMIT_EXCEEDED` | Too many requests | Answer is rate-limited at 10/min (free) to 200/min (enterprise). |
| `502` | `SEARCH_UNAVAILABLE` | LLM provider failure | Credits auto-refunded. Retry with backoff. |
## Rate limits
| Tier | Limit |
| --- | --- |
| Free | 10/min |
| Starter | 30/min |
| Pro | 60/min |
| Startup | 120/min |
| Enterprise | 200/min |
Over the limit you get a `429`. See [Rate limits](/rate-limits) for headers and backoff.https://api.keirolabs.cloud/api/v2/answerProvides an authoritative, LLM-synthesized direct answer to your question with cited sources. Powered by a multi-provider reasoning stack with Keiro retrieval and citation synthesis layered on top. Supports both Server-Sent Events (SSE) streaming and standard JSON responses.
When to use it. Use Answer when you need a direct, synthesized response to a question — like asking an expert. Returns a text answer with cited sources. Ideal for chatbots, Q&A systems, and grounding LLM outputs.
When not to. Don't use Answer if you need raw search results (use Search), page content (use Search+Content), or multi-step autonomous research with charts (use Web Agent).
Request
curl -N -X POST https://api.keirolabs.cloud/api/v2/answer \
-H "Authorization: Bearer $KEIRO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "what is the context window of claude opus?"}'Parameters
Prop
Type
Response
{
"answer": "The 2024 US Presidential Election was won by Donald Trump (R), defeating incumbent Kamala Harris (D). Trump secured 312 electoral votes to Harris's 226, with a decisive popular-vote margin of ~2.3%.",
"sources": [
{
"title": "2024 United States presidential election - Wikipedia",
"url": "",
"domain": "wikipedia",
"snippet": "..."
},
{
"title": "Federal Election Commission official results",
"url": "",
"domain": "fec.gov",
"snippet": "..."
}
],
"stats": {
"sources_count": 2,
"latency_ms": 3820,
"credits_used": 5,
"attempt": "ai-search"
},
"creditsRemaining": 1095
}Prop
Type
Errors
| Status | Code | Cause | Fix |
|---|---|---|---|
400 | VALIDATION_ERROR | Missing query | Provide a non-empty query string. |
401 | UNAUTHORIZED | Missing or invalid API key | Check your Authorization: Bearer header. |
402 | INSUFFICIENT_CREDITS | Not enough credits (need 2, or 1 on paid plans) | Top up or upgrade at /dashboard/billing. |
429 | RATE_LIMIT_EXCEEDED | Too many requests | Answer is rate-limited at 10/min (free) to 200/min (enterprise). |
502 | SEARCH_UNAVAILABLE | LLM provider failure | Credits auto-refunded. Retry with backoff. |
Rate limits
| Tier | Limit |
|---|---|
| Free | 10/min |
| Starter | 30/min |
| Pro | 60/min |
| Startup | 120/min |
| Enterprise | 200/min |
Over the limit you get a 429. See Rate limits for headers and backoff.
Paste one prompt into Claude Code, Cursor, Codex or Windsurf. It installs Keiro MCP, reads these docs and writes the integration against the real API.