unlob Docs
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

NameTypeDescription
idrequiredstringPassage id from a search hit.
riskbooleanAlso return `risk_flags` for the text: instruction_like, hidden_text, role_markers, low_trust_source.
stripbooleanRemove instruction-like sentences from the text; each becomes `[removed: instruction-like text]`. Implies `risk`.

Responses

StatusMeaning
200The document, with its full cleaned text.
401Missing, unknown or revoked key. A key minted moments ago can answer 401 until it propagates to the serving fleet.
404No such passage id.
429Over 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

NameTypeDescription
hostrequiredstring—
host_rankrequirednumber—
idrequiredstring—
langrequiredstring—
qualityrequiredinteger—
risk_flags"instruction_like" | "hidden_text" | "role_markers" | "low_trust_source"[]Present when risk or strip was set. Computed on the original text.
sentences_removedintegerPresent when strip was set: how many sentences were removed
textrequiredstringThe full cleaned body
titlerequiredstring—
urlrequiredstring—
verticalrequiredstring—

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.