Browse documentation
A ready-to-read context pack — GET /assemble_context
Get a ready-to-read context pack for a question, instead of a link list.
/assemble_context Request
curl \
-H "x-api-key: $UNLOB_API_KEY" \
"https://api.unlob.com/assemble_context?q=<q>" Behaviour
Returns the corroborated, story-deduped, trust-ranked passages for a question, packed to a token budget, each carrying the reason it was included.
The engine runs the whole retrieval loop — search, dedup, corroborate, rank, pack — so you just read. Use this when the question is 'what should I know about X' rather than 'find me the page that says Y'.
`budget` is in tokens and is honoured as a ceiling; `estimated_tokens` reports what was actually packed.
Costs 3 credits; a call that runs and fails costs 1.
Parameters
| Name | Type | Description |
|---|---|---|
qrequired | string | The question. |
budget | integer | Token budget for the pack, default 4000. |
mode | string | keyword | semantic | hybrid (default). |
Responses
| Status | Meaning |
|---|---|
200 | Deduped, trust-ranked passages packed to the budget, each with the reason it was included. |
401 | Missing, unknown or revoked key. A key minted moments ago can answer 401 until it propagates to the serving fleet. |
429 | Over the per-minute rate (spent in credits), or a hard-capped key without the credits this call costs. `retry-after` is present on the rate-limit case only. |
The same call over MCP
This capability is assemble_context on the
MCP server, taking the same parameters and returning the same body. A parity test
in the API fails the build if the two ever diverge, so you can read either
reference and use the other.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "assemble_context",
"arguments": {
"query": "<q>"
}
}
} Most clients build that frame for you — see Connect a client.
See Errors for what to do with each status, and Retries and backoff for which are worth repeating.
FAQ
- What does 200 mean on GET /assemble_context?
- Deduped, trust-ranked passages packed to the budget, each with the reason it was included.
- What does 401 mean on GET /assemble_context?
- Missing, unknown or revoked key. A key minted moments ago can answer 401 until it propagates to the serving fleet.
- What does 429 mean on GET /assemble_context?
- Over the per-minute rate (spent in credits), or a hard-capped key without the credits this call costs. `retry-after` is present on the rate-limit case only.