Skip to navigation

Read a document

Read a PDF or an image and return every page as Markdown: text in reading order, headings, lists, tables, math, headers and footers, and the position of every image region on the page.

Send the document as document_url (a PDF) or image_url (an image), each a public URL or a base64 data URI, up to 50 MB. pages chooses zero-based pages; a request reads at most 1,000 pages. Billed per page read, with the per-request minimum shown on the model page.

A request answers when its pages are read. One still running after about four and a half minutes answers 202 with a job_id; poll GET /v1/jobs/{job_id} for the result. Send Prefer: respond-async to get the job id at once.

Authentication

AuthorizationBearer

Pass your EmpirioLabs API key as a bearer token. The Anthropic-style x-api-key header is also accepted on every endpoint.

Headers

PreferstringOptional

respond-async answers 202 with a job_id at once instead of waiting for the pages.

Request

This endpoint expects an object.
modelstringRequired
Document OCR model id.
documentobjectRequired

The PDF (document_url) or image (image_url) to read.

pageslist of integers or stringOptional

Zero-based pages to read, as a list or a string such as "0,2-4". Every page when omitted. At most 1,000 pages per request.

include_image_base64booleanOptionalDefaults to false

Return each image region as a JPEG data URI in images[].image_base64.

image_limitintegerOptional>=0
Return at most this many images for the whole document, the first ones first.
image_min_sizeintegerOptional>=0
Leave out image regions narrower or shorter than this many pixels.
table_formatenumOptional

Move each table into tables[] in this format and leave a link such as [tbl-0.html](tbl-0.html) in markdown. Tables stay in markdown as HTML when omitted.

Allowed values:
extract_headerbooleanOptionalDefaults to false

Move the header text out of markdown into header.

include_blocksbooleanOptionalDefaults to true

Include blocks, every region of each page in reading order.

Response headers

X-Request-IDstringOptional
Request identifier. Include it when requesting support.

Response

Every page read, in page order.
pageslist of objects
modelstring
usage_infoobject
document_annotationstring or nullOptional
Always null.
usageobjectOptional

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
429
Too Many Requests Error
502
Bad Gateway Error
503
Service Unavailable Error