Jump to content

Read a scanned document

The text of a scanned PDF or a photo, page by page.

Send a scanned PDF or a photo of a document. You can also send a link to it. Your agent gets the text of each page, as plain text and as Markdown. Headings and tables keep their shape, and a page with two columns is read in the right order. It reads up to 50 pages at once.

Paste this into your AI agent

Set up Chab for me: fetch https://www.chab.ai/agent-setup.md?v=497c0f and follow it. Then use Chab to read the scanned letter at https://upload.wikimedia.org/wikipedia/commons/b/bf/Einstein-Roosevelt-letter.png and tell me what Einstein asks the President to do.

Your agent connects Chab and then runs it. Price: From 1 credit, about 1 credit for one or two pages. The free credits cover a first try. How it works in each app

Full reference for developers
Returns
JSON result
REST endpoint
POST /v1/documents/ocr
Over MCP
Call chab_operation_start with "documents.ocr"

What you get

Example request

{  "source": {    "type": "url",    "url": "https://upload.wikimedia.org/wikipedia/commons/b/bf/Einstein-Roosevelt-letter.png"  }}

Example result

{  "data": {    "result": {      "source": {        "type": "url",        "url": "https://upload.wikimedia.org/wikipedia/commons/b/bf/Einstein-Roosevelt-letter.png",        "filename": "Einstein-Roosevelt-letter.png",        "format": "png",        "byte_size": 292641      },      "page_count": 1,      "first_page": 1,      "pages_read": 1,      "pages": [        {          "page": 1,          "text": "Albert Einstein\nOld Grove Rd.\nNassau Point\nPeconic, Long Island\nAugust 2nd, 1939\n\nF.D. Roosevelt,\nPresident of the United States,\nWhite House\nWashington, D.C.\n\nSir:\n\nSome recent work by E.Fermi and L. Szilard, which has been com-\nmunicated to me in manuscript, leads me to expect that the element uran-\nium may be turned into a new and important source of energy...",          "markdown": "Albert Einstein\nOld Grove Rd.\nNassau Point\nPeconic, Long Island\nAugust 2nd, 1939\n\nF.D. Roosevelt,\nPresident of the United States,\nWhite House\nWashington, D.C.\n\nSir:\n\nSome recent work by E.Fermi and L. Szilard, which has been com-\nmunicated to me in manuscript, leads me to expect that the element uran-\nium may be turned into a new and important source of energy...",          "error": null        }      ],      "usage": { "input_tokens": 407, "output_tokens": 697 }    },    "artifacts": [],    "warnings": [],    "result_expires_at": "2026-11-19T12:26:50+00:00"  },  "meta": {    "request_id": "req_123"  }}

Inputs

FieldTypeDetails
sourcerequiredobjectThe document: an uploaded file (file_id), a reusable artifact such as a screenshot (artifact_id), or a public https URL (url). PDF, PNG, JPEG, WebP, TIFF or HEIC.
source.typerequiredstringOne of file_id, artifact_id, url
source.idstringThe fil_ or art_ id, with type file_id or artifact_id.Up to 64 characters
source.urlstringA public https URL of the document, with type url. Chab downloads it (up to your plan's upload size) and checks it for viruses like an upload.Up to 2048 characters
first_pageintegerThe first page to read.Default 1. Min 1
max_pagesintegerMost pages to read from first_page on. Credits are reserved for these pages and the unused part is released. An image is one page.Default 10. Min 1 max 50

How to call it

AI apps use it through hosted MCP. Coding agents can also use the CLI, and your own code can call the API. Each call starts a job, and your agent picks up the result when it is ready.

curl -X POST https://www.chab.ai/v1/documents/ocr \  -H "Authorization: Bearer CHAB_API_KEY" \  -H "Content-Type: application/json" \  -H "Idempotency-Key: documents-ocr-001" \  -d '{"source":{"type":"url","url":"https://upload.wikimedia.org/wikipedia/commons/b/bf/Einstein-Roosevelt-letter.png"}}'

Read a scanned document result

{  "data": {    "result": {      "source": {        "type": "url",        "url": "https://upload.wikimedia.org/wikipedia/commons/b/bf/Einstein-Roosevelt-letter.png",        "filename": "Einstein-Roosevelt-letter.png",        "format": "png",        "byte_size": 292641      },      "page_count": 1,      "first_page": 1,      "pages_read": 1,      "pages": [        {          "page": 1,          "text": "Albert Einstein\nOld Grove Rd.\nNassau Point\nPeconic, Long Island\nAugust 2nd, 1939\n\nF.D. Roosevelt,\nPresident of the United States,\nWhite House\nWashington, D.C.\n\nSir:\n\nSome recent work by E.Fermi and L. Szilard, which has been com-\nmunicated to me in manuscript, leads me to expect that the element uran-\nium may be turned into a new and important source of energy...",          "markdown": "Albert Einstein\nOld Grove Rd.\nNassau Point\nPeconic, Long Island\nAugust 2nd, 1939\n\nF.D. Roosevelt,\nPresident of the United States,\nWhite House\nWashington, D.C.\n\nSir:\n\nSome recent work by E.Fermi and L. Szilard, which has been com-\nmunicated to me in manuscript, leads me to expect that the element uran-\nium may be turned into a new and important source of energy...",          "error": null        }      ],      "usage": { "input_tokens": 407, "output_tokens": 697 }    },    "artifacts": [],    "warnings": [],    "result_expires_at": "2026-11-19T12:26:50+00:00"  },  "meta": {    "request_id": "req_123"  }}

Price: From 1 credit, about 1 credit for one or two pages. See all prices

Want to try Chab with your agent?

Copy the prompt and paste it into your AI. Your agent starts with free credits and doesn't need an account.

See plans