---
title: "Run OCR"
method: POST
path: "/ocr"
tags: ["OCR"]
---

# Run OCR

`POST /ocr`

## Request

- Base URL: `https://api.munito.ai/inference/v1`
- URL: `https://api.munito.ai/inference/v1/ocr`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Document-AI workload: send a handwritten, scanned, or printed document (PDF or image) by URL or as base64, and get clean, structured Markdown back. Billed per page.

## Headers

- `munito-service-tier` 'priority' | 'standard' | 'flex'
- `prefer` 'respond-async'

## Request body

- object
  - `document` object, required: The document to read, by `url` or as `base64` data.
    - `type` 'url' | 'base64', required
    - `url` string: The document URL, when `type` is `url`. Use a public https URL on port 443. The API follows up to 3 redirects to such URLs.
    - `data` string: The document as base64, when `type` is `base64`.
    - `filename` string: The file name. Optional. Munito AI reads the format from the bytes of the document.
  - `model` string: An OCR model id from GET /models. Omit it, or send `munito/ocr-auto`, to let Munito pick.
  - `pages` 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` object: How to return each table.
    - `mode` 'inline' | 'extracted': `inline` keeps each table in the page text. `extracted` moves it to `tables`.
    - `format` 'markdown' | 'html'
  - `images` object: How to return each image on a page.
    - `annotate` boolean: Read the text of each image into `alt_text`.
    - `include_base64` boolean: Include each image as base64.
    - `limit` integer: The maximum number of images on each page.
    - `min_size` integer: Ignore an image smaller than this number of pixels on either side.
  - `confidence_scores` boolean: Return a confidence per page.
  - `extract` string[]: Page parts to move from the page text into their own fields.
  - `preferred_region` 'global' | 'eu' | 'us': Where the request can run. Omit it to use the default region of the organization.

## Response `200`

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

## Other responses

- `202`: Accepted. Poll the `location` until the request finishes.

---

[API](https://skmtc.dev/munito/apis/munito-ai-api.md) - [All operations](https://skmtc.dev/munito/apis/munito-ai-api/llms.txt) - [OpenAPI document](https://skmtc.dev/munito/apis/munito-ai-api/revisions/d4ccbe8844df?raw)
