Send the file as base64 in document. An image counts as one page. The OCR guide covers the two output shapes, the block types, and the page and size limits.
Headers#
authorizationBearer pxa_...RequiredAuthorization: Bearer pxa_... (recommended).
x-api-keypxa_...Alternative to the Authorization header. Ignored when Authorization is present.
idempotency-keystringMakes a retry safe. Two requests carrying the same key charge once and synthesize the same content. One request per key runs at a time. A concurrent duplicate answers 409 idempotency_in_flight. Reuse a key only to retry an identical request. A changed payload is rejected with 422. Accepts up to 200 printable ASCII characters.
Body#
documentstringRequiredThe document to read, as the base64 encoding of a PDF, PNG, JPEG, or WebP file. An image counts as one page. Cost is 6.5 credits per page, charged before reading and refunded automatically when reading fails. A PDF may carry up to 50 pages, and more answers 400 too_many_pages. The decoded file may be up to 10,485,760 bytes, and larger answers 413 document_too_large. A file that cannot be read as one of the four formats answers 400 document_invalid, and a PDF that needs a password to open answers 400 document_password_required. GET /v1/models reports the ceilings as max_pages and max_bytes.
modelstringRequiredOCR model id, for example paxa-ocr-lite-v1. GET /v1/models lists the served catalog.
output"markdown" or "structured"Shape of the result. "markdown", the default, returns each page as GitHub-flavored Markdown. "structured" returns each page as typed layout blocks, for callers that feed the reading into a pipeline.
Response#
The recognized document.
pagesarray of objectsRequiredOne entry per page of the document, in page order.
Show propertiesHide properties
pages[].pageintegerRequiredPage number, starting at 1. An image request has exactly one page.
pages[].markdownstringThe page's content as GitHub-flavored Markdown, in reading order. Present when output is "markdown". Join pages with a blank line to rebuild the document.
pages[].blocksarray of objectsThe page's content as typed blocks in reading order. Present when output is "structured".
Show propertiesHide properties
pages[].blocks[].typestringRequiredWhat the block is: "heading", "paragraph", "list", "table", or "figure". Blocks arrive in reading order.
pages[].blocks[].textstringThe block's text. Present on "heading", "paragraph", and "figure" blocks. A figure's text is its caption or nearby label, and is empty when it has none.
pages[].blocks[].levelintegerHeading depth, starting at 1 for the most prominent. Present on "heading" blocks.
pages[].blocks[].itemsarray of stringsThe list entries in order. Present on "list" blocks.
pages[].blocks[].rowsarray of array of stringssThe table cells as rows of column values, first row first. Present on "table" blocks.
usageobjectRequiredWhat the request was billed for.
Show propertiesHide properties
usage.pagesintegerRequiredPages this request was billed for.
usage.creditsnumberRequiredWhat this delivery cost, in credits, exact to a hundredth. An idempotent replay reports the ORIGINAL request's charge, since that one charge is what paid for this delivery too; your balance moves only once.