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

# OCR

`POST /ocr`

## Request body

- OCRRequest
  - `pages` integer[], nullable — Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0
  - `image_min_size` integer, nullable — Minimum height and width of image to extract
  - `document` union, required — Document to run OCR on
    - DocumentURLChunk
      - `document_name` string, nullable — The filename of the document
      - `type` string
      - `document_url` string, required
    - ImageURLChunk — {"type":"image_url","image_url":{"url":"data:image/png;base64,iVBORw0
      - `image_url` union, required
        - object
          - `detail` string, nullable
          - `url` string, required
        - string
      - `type` 'image_url'
  - `include_image_base64` boolean, nullable — Include image URLs in response
  - `image_limit` integer, nullable — Max images to extract
  - `model` string, nullable, required
  - `id` string

## Response `200`

Successful Response

- OCRResponse
  - `pages` OCRPageObject[], required — List of OCR info for pages.
    - `images` OCRImageObject[], required — List of all extracted images in the page
      - `bottom_right_x` integer, nullable, required — X coordinate of bottom-right corner of the extracted image
      - `bottom_right_y` integer, nullable, required — Y coordinate of bottom-right corner of the extracted image
      - `image_base64` string, nullable — Base64 string of the extracted image
      - `top_left_y` integer, nullable, required — Y coordinate of top-left corner of the extracted image
      - `id` string, required — Image ID for extracted image in a page
      - `top_left_x` integer, nullable, required — X coordinate of top-left corner of the extracted image
    - `markdown` string, required — The markdown string response of the page
    - `index` integer, required — The page index in a pdf document starting from 0
    - `dimensions` OCRPageDimensions, required
      - `width` integer, required — Width of the image in pixels
      - `dpi` integer, required — Dots per inch of the page-image
      - `height` integer, required — Height of the image in pixels
  - `model` string, required — The model used to generate the OCR.
  - `usage_info` OCRUsageInfo, required
    - `pages_processed` integer, required — Number of pages processed
    - `doc_size_bytes` integer, nullable — Document size in bytes

## Other responses

- `422` — Validation Error

## Changes

- **2026-07-17** `062746a4d99e` — 1 info
  - endpoint added
- **2025-03-09** `a88399f645b2` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/ballerina-platform/apis/mistral-ai-api/changes/ocr/post.md)

---

[API](https://skmtc.dev/ballerina-platform/apis/mistral-ai-api.md) · [All operations](https://skmtc.dev/ballerina-platform/apis/mistral-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ballerina-platform/mistral-ai-api/revisions/062746a4d99e/schema)
