---
title: "POST /v2/router/ocr"
method: POST
path: "/v2/router/ocr"
tags: ["Router"]
---

# POST /v2/router/ocr

`POST /v2/router/ocr`

Extracts text content while maintaining document structure and hierarchy

## Request body

- object
  - `model` string, required — ID of the model to use for OCR.
  - `document` union, required — Document to run OCR on. Can be a DocumentURLChunk or ImageURLChunk.
    - object
      - `type` 'document_url', required
      - `document_url` string, uri, required — URL of the document to process
      - `document_name` string — The name of the document
    - object
      - `type` 'image_url', required
      - `image_url` union, required
        - string — Base64 encoded image
        - object — URL of the image to process
          - `url` string, uri, required
          - `detail` string
  - `pages` integer[], nullable — Specific pages to process. Can be a single number, range, or list. Starts from 0. Null for all pages.
  - `ocr_settings` object — Optional settings for the OCR run
    - `include_image_base64` boolean, nullable — Whether to include image Base64 in the response. Null for default.
    - `max_images_to_include` integer — Maximum number of images to extract. Null for no limit.
    - `image_min_size` integer — Minimum height and width of image to extract. Null for no minimum.

## Response `200`

Represents an OCR response from the API.

- object
  - `model` string, required — ID of the model used for OCR.
  - `pages` object[], required
    - `index` number, required — The page index in a pdf document starting from 0
    - `markdown` string, required — The markdown string response of the page
    - `images` object[], required
      - `id` string, required — The id of the image
      - `image_base64` string, nullable — The base64 encoded image
    - `dimensions` object, nullable — The dimensions of the PDF Page's screenshot image
      - `dpi` integer, required — Dots per inch of the page-image
      - `height` integer, required — Height of the image in pixels
      - `width` integer, required — Width of the image in pixels
  - `usage` union, required
    - object — The usage information for the OCR run counted as pages processed
      - `type` 'pages', required
      - `pages_processed` integer, required — The number of pages processed
    - object — The usage information for the OCR run counted as tokens processed
      - `type` 'tokens', required
      - `tokens_processed` integer, required — The number of tokens processed

---

[API](https://skmtc.net/orq-ai/apis/orq-ai-api.md) · [All operations](https://skmtc.net/orq-ai/apis/orq-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/orq-ai/orq-ai-api/revisions/4fdc24e562eb/schema)
