---
title: "Extract text from an image"
method: POST
path: "/v1/image-operations/extract-text"
tags: ["Image Operations"]
---

# Extract text from an image

`POST /v1/image-operations/extract-text`

Creates a task to extract text from a specified image file.

## Request body

- union — Extract text from an image in various formats.
  - object
    - `input` string, required — The id of the file or task to operate on.
    - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
    - `format` 'plain', required — The format of the text to be extracted.
  - object
    - `input` string, required — The id of the file or task to operate on.
    - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
    - `format` 'markdown', required — The format of the text to be extracted.
  - object
    - `input` string, required — The id of the file or task to operate on.
    - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
    - `format` 'html', required — The format of the text to be extracted.
  - object
    - `input` string, required — The id of the file or task to operate on.
    - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
    - `format` 'json', required — The format of the text to be extracted.
    - `schema` JSONSchemaSpec, required — An OpenAPI schema object describing the expected JSON structure. Required if format is 'json'.
      - `type` 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'
      - `format` string
      - `description` string
      - `example` unknown
      - `properties` object
      - `items` JSONSchemaSpec — recursive
      - `required` string[]

## Response `201`

Task created successfully. Returns the task details.

- union — The response of an extract-text task
  - object
    - `id` string, required — The unique identifier for the task.
    - `operation` 'extract-text', required — The type of operation being performed by the task.
    - `parameters` union, required — Extract text from an image in various formats.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'plain', required — The format of the text to be extracted.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'markdown', required — The format of the text to be extracted.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'html', required — The format of the text to be extracted.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'json', required — The format of the text to be extracted.
        - `schema` JSONSchemaSpec, required — An OpenAPI schema object describing the expected JSON structure. Required if format is 'json'.
          - `type` 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'
          - `format` string
          - `description` string
          - `example` unknown
          - `properties` object
          - `items` JSONSchemaSpec — recursive
          - `required` string[]
    - `status` 'completed', required — The current status of the task.
    - `result` object, required
      - `format` 'plain' | 'markdown' | 'html' | 'json', required
      - `content` string, required
    - `callback_url` string, nullable, required — The URL to which the task result will be sent upon completion or failure.
    - `created_at` string, required — The creation date of the task in ISO format.
    - `updated_at` string, required — The last update date of the task in ISO format.
  - object
    - `id` string, required — The unique identifier for the task.
    - `operation` 'extract-text', required — The type of operation being performed by the task.
    - `parameters` union, required — Extract text from an image in various formats.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'plain', required — The format of the text to be extracted.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'markdown', required — The format of the text to be extracted.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'html', required — The format of the text to be extracted.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'json', required — The format of the text to be extracted.
        - `schema` JSONSchemaSpec, required — An OpenAPI schema object describing the expected JSON structure. Required if format is 'json'.
          - `type` 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'
          - `format` string
          - `description` string
          - `example` unknown
          - `properties` object
          - `items` JSONSchemaSpec — recursive
          - `required` string[]
    - `status` 'pending', required — The current status of the task.
    - `result` object, required
    - `callback_url` string, nullable, required — The URL to which the task result will be sent upon completion or failure.
    - `created_at` string, required — The creation date of the task in ISO format.
    - `updated_at` string, required — The last update date of the task in ISO format.
  - object
    - `id` string, required — The unique identifier for the task.
    - `operation` 'extract-text', required — The type of operation being performed by the task.
    - `parameters` union, required — Extract text from an image in various formats.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'plain', required — The format of the text to be extracted.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'markdown', required — The format of the text to be extracted.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'html', required — The format of the text to be extracted.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'json', required — The format of the text to be extracted.
        - `schema` JSONSchemaSpec, required — An OpenAPI schema object describing the expected JSON structure. Required if format is 'json'.
          - `type` 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'
          - `format` string
          - `description` string
          - `example` unknown
          - `properties` object
          - `items` JSONSchemaSpec — recursive
          - `required` string[]
    - `status` 'processing', required — The current status of the task.
    - `result` object, required
    - `callback_url` string, nullable, required — The URL to which the task result will be sent upon completion or failure.
    - `created_at` string, required — The creation date of the task in ISO format.
    - `updated_at` string, required — The last update date of the task in ISO format.
  - object
    - `id` string, required — The unique identifier for the task.
    - `operation` 'extract-text', required — The type of operation being performed by the task.
    - `parameters` union, required — Extract text from an image in various formats.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'plain', required — The format of the text to be extracted.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'markdown', required — The format of the text to be extracted.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'html', required — The format of the text to be extracted.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `callback_url` string, uri — The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use `webhooks` instead.
        - `format` 'json', required — The format of the text to be extracted.
        - `schema` JSONSchemaSpec, required — An OpenAPI schema object describing the expected JSON structure. Required if format is 'json'.
          - `type` 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'
          - `format` string
          - `description` string
          - `example` unknown
          - `properties` object
          - `items` JSONSchemaSpec — recursive
          - `required` string[]
    - `status` 'failed', required — The current status of the task.
    - `result` object, required
      - `error` string, required
      - `details` object, required
    - `callback_url` string, nullable, required — The URL to which the task result will be sent upon completion or failure.
    - `created_at` string, required — The creation date of the task in ISO format.
    - `updated_at` string, required — The last update date of the task in ISO format.

## Other responses

- `404` — File not found. The specified file does not exist.
- `422` — Validation Error. The request body is invalid.
- `429` — Rate Limit Exceeded.
- `5XX` — Internal Server Error.

---

[API](https://skmtc.net/scan-documents/apis/scan-documents-api.md) · [All operations](https://skmtc.net/scan-documents/apis/scan-documents-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/scan-documents/scan-documents-api/versions/42f9aa9c3b27/schema)
