> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opper.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Extract text (OCR)

> Extract text from a document or image synchronously and get it back as per-page markdown. `model` and `document` are required; `document` is one of `{type:"document_url", document_url}`, `{type:"image_url", image_url}`, `{type:"base64", content, document_name}` (PDF or image), or `{type:"file", file_id}` for a `file_<id>` from POST /v3/files. `pages` selects 0-based page indices; `include_image_base64`/`image_limit`/`image_min_size` control embedded-image extraction; everything in `parameters` is forwarded verbatim to the provider (e.g. Docling's `ocr_engine`, `lang`, `table_mode`, `do_formula_enrichment`). Billed per page processed.

See the [OCR guide](/build/multimodal/ocr) for runnable examples, document sources (URL / base64 / `file_id`), and language options.


## OpenAPI

````yaml post /v3/ocr
openapi: 3.1.0
info:
  description: Schema-driven generative API that orchestrates LLM-powered workflows.
  title: Task API
  version: 3.0.0
servers:
  - description: Production
    url: https://api.opper.ai
  - description: Local development
    url: http://localhost:8080
security:
  - BearerAuth: []
tags:
  - description: Schema-driven function management and execution
    name: Functions
  - description: OpenAI-compatible chat completions
    name: Chat
  - description: OpenAI Responses API compatible endpoint
    name: Responses
  - description: Google-compatible interactions endpoint
    name: Interactions
  - description: Model registry and capabilities
    name: Models
  - description: Synchronous image generation
    name: Images
  - description: Text-to-speech and speech-to-text
    name: Audio
  - description: Asynchronous video generation
    name: Videos
  - description: Reusable file storage for media inputs and generated outputs
    name: Files
  - description: Async generation status and downloads
    name: Artifacts
  - description: OpenAI-compatible embeddings
    name: Embeddings
  - description: Recorded HTTP request/response generations
    name: Generations
  - description: System health and status
    name: System
  - description: Roundtable endpoint — fan out a query to multiple LLMs and combine results
    name: Roundtable
  - description: Web search, fetch, and other utility tools
    name: Tools
  - description: Caller identity, credits, and usage
    name: Account
paths:
  /v3/ocr:
    post:
      tags:
        - OCR
      summary: Extract text (OCR)
      description: >-
        Extract text from a document or image synchronously and get it back as
        per-page markdown. `model` and `document` are required; `document` is
        one of `{type:"document_url", document_url}`, `{type:"image_url",
        image_url}`, `{type:"base64", content, document_name}` (PDF or image),
        or `{type:"file", file_id}` for a `file_<id>` from POST /v3/files.
        `pages` selects 0-based page indices;
        `include_image_base64`/`image_limit`/`image_min_size` control
        embedded-image extraction; everything in `parameters` is forwarded
        verbatim to the provider (e.g. Docling's `ocr_engine`, `lang`,
        `table_mode`, `do_formula_enrichment`). Billed per page processed.
      operationId: createOCR
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OCRRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OCRResponse'
          description: Successful response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad request
        '401':
          description: Unauthorized - missing or invalid API key
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
components:
  schemas:
    OCRRequest:
      properties:
        document:
          properties:
            content:
              type: string
            document_name:
              type: string
            document_url:
              type: string
            file_id:
              type: string
            image_url:
              type: string
            type:
              type: string
          required:
            - type
          type: object
        image_limit:
          type: integer
        image_min_size:
          type: integer
        include_image_base64:
          type: boolean
        model:
          type: string
        pages:
          items:
            type: integer
          type: array
        parameters:
          type: object
      required:
        - model
        - document
      type: object
    OCRResponse:
      properties:
        id:
          type: string
        model:
          type: string
        pages:
          items:
            properties:
              blocks:
                items:
                  properties:
                    bottom_right_x:
                      type: integer
                    bottom_right_y:
                      type: integer
                    content:
                      type: string
                    top_left_x:
                      type: integer
                    top_left_y:
                      type: integer
                    type:
                      type: string
                  required:
                    - type
                    - top_left_x
                    - top_left_y
                    - bottom_right_x
                    - bottom_right_y
                  type: object
                type: array
              confidence_scores:
                type: object
              dimensions:
                additionalProperties:
                  type: integer
                type: object
              elements:
                items:
                  type: object
                type: array
              images:
                items:
                  type: object
                type: array
              index:
                type: integer
              markdown:
                type: string
            required:
              - index
              - markdown
            type: object
          type: array
        usage:
          properties:
            cost:
              type: number
            pages_processed:
              type: integer
          required:
            - cost
            - pages_processed
          type: object
      required:
        - id
        - model
        - pages
        - usage
      type: object
    ErrorResponse:
      properties:
        error:
          properties:
            code:
              type: string
            details:
              description: Any value
            message:
              type: string
          required:
            - code
            - message
          type: object
        meta:
          type: object
      required:
        - error
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: API Key
      description: API key authentication. Pass your API key as a Bearer token.
      scheme: bearer
      type: http

````