Skip to Content

Run OCR

Document-AI workload: send a handwritten, scanned, or printed document (PDF or image) by URL or as base64, and get page Markdown back. Optional document annotations return validated JSON. The flat OCR page price includes annotations.

POST
/ocr

Authorization

headerAuthorizationBearer <token>

Your Munito API key.

Header Parameters

munito-service-tier?string

priority, standard or flex. The response names the tier that is billed; see x-ratelimit-over-limit. See Service tiers.

Default"standard"
Value in"priority""standard""flex"
prefer?"respond-async"

respond-async: answer 202 at once. Then poll the location until the request finishes.

Value in"respond-async"

Request Body

application/json
  1. body
document*

The document to read, by url or as base64 data.

model?string

An OCR model id from GET /models. Omit it, or send munito/ocr-auto, to let Munito pick.

pages?array<integer>

Zero-based page numbers to read, each one time, at most 1000. A negative or repeated number, or a number past the last page, answers 422. Omit it to read every page.

tables?

How to return each table.

images?

How to return each image on a page.

confidence_scores?boolean

Return a confidence per page.

Defaultfalse
extract?array<>

Page parts to move from the page text into their own fields.

document_annotation_format?

Extract one annotation from all selected pages. Use json_schema for schema-validated JSON, or json_object for a JSON object. The response contains document_annotation as a JSON string. Requires an available fast model in the permitted region.

document_annotation_prompt?string

Instructions for document annotation. Requires document_annotation_format.

Lengthlength <= 8000
preferred_region?string

Where the request can run. Omit it to use the default region of the organization.

Value in"global""eu""us"

Response Body

The OCR result, when the request finishes within the synchronous wait.

application/json
  1. response
pages?array<>
document_annotation?string

A JSON string that matches the requested annotation format. Present only when requested.

usage?
curl -X POST 'https://api.munito.ai/inference/v1/ocr' \
  -H 'Content-Type: application/json' \
  -d '{
  "document": {
    "type": "url",
    "url": "https://example.com/invoice.pdf"
  },
  "model": "lightonai/lightonocr-3-4b"
}'
Example Response
{
  "pages": [
    {}
  ],
  "document_annotation": "string",
  "usage": {
    "cost_usd": 0
  }
}