Browse documentation
Full text of one passage — GET /doc/{id}
Fetch the full cleaned text of a passage by its id (from a web_search hit), with its metadata.
get
/doc/{id} Request
curl \
-H "x-api-key: $UNLOB_API_KEY" \
"https://api.unlob.com/doc/<id>" Behaviour
Snippets in search results are the passage text, so most questions need no call here. Reach for it when you need the whole document rather than the matching passage.
Costs 1 credit.
Parameters
| Name | Type | Description |
|---|---|---|
idrequired | string | Passage id from a search hit. |
risk | boolean | Also return `risk_flags` for the text: instruction_like, hidden_text, role_markers, low_trust_source. |
strip | boolean | Remove instruction-like sentences from the text; each becomes `[removed: instruction-like text]`. Implies `risk`. |
Responses
| Status | Meaning |
|---|---|
200 | The document, with its full cleaned text. |
401 | Missing, unknown or revoked key. A key minted moments ago can answer 401 until it propagates to the serving fleet. |
404 | No such passage id. |
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. |
Response body
Document
| Name | Type | Description |
|---|---|---|
hostrequired | string | — |
host_rankrequired | number | — |
idrequired | string | — |
langrequired | string | — |
qualityrequired | integer | — |
risk_flags | "instruction_like" | "hidden_text" | "role_markers" | "low_trust_source"[] | Present when risk or strip was set. Computed on the original text. |
sentences_removed | integer | Present when strip was set: how many sentences were removed |
textrequired | string | The full cleaned body |
titlerequired | string | — |
urlrequired | string | — |
verticalrequired | string | — |
The same call over MCP
This capability is get_document 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": "get_document",
"arguments": {
"id": "<id>"
}
}
} 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 /doc/{id}?
- The document, with its full cleaned text.
- What does 401 mean on GET /doc/{id}?
- Missing, unknown or revoked key. A key minted moments ago can answer 401 until it propagates to the serving fleet.
- What does 404 mean on GET /doc/{id}?
- No such passage id.
- What does 429 mean on GET /doc/{id}?
- 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.