---
title: "Detect documents in an image"
method: POST
path: "/v1/image-operations/detect-documents"
tags: ["Image Operations"]
---

# Detect documents in an image

`POST /v1/image-operations/detect-documents`

Creates a task to detect document boundaries within an image.

## Request body

- 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.

## Response `201`

Task created successfully. Returns the task details.

- union — The response of the detect-documents operation
  - object
    - `id` string, required — The unique identifier for the task.
    - `operation` 'convert', required — The type of operation being performed by the task.
    - `parameters` union, required
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `name` string — The name of the file
        - `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.
        - `target_format` 'image/png', required — The format to convert the image to.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `name` string — The name of the file
        - `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.
        - `target_format` 'image/jpeg', required — The format to convert the image to.
        - `quality` number, required — Image quality (1-100) for lossy formats like jpeg.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `name` string — The name of the file
        - `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.
        - `target_format` 'image/webp', required — The format to convert the image to.
        - `quality` number, required — Image quality (1-100) for lossy formats like webp.
    - `status` 'completed', required — The current status of the task.
    - `result` object, required
      - `documents` object[], required — The list of documents detected in the image
        - `file_id` string, required — The ID of the file containing the document
        - `vertices` object[], required — The coordinates of the vertex inside the image
          - `x` number, required — The x coordinate of the vertex inside the image in pixels
          - `y` number, required — The y coordinate of the vertex inside the image in pixels
        - `bounding_box` BoundingBox, required — The rectangle that contains the document in the image
          - `top` number, required — The position of the top-left corner of the bounding box inside the image in pixels
          - `left` number, required — The position of the top-left corner of the bounding box inside the image in pixels
          - `width` number, required — The width of the bounding box inside the image in pixels
          - `height` number, required — The height of the bounding box inside the image in pixels
    - `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` 'convert', required — The type of operation being performed by the task.
    - `parameters` union, required
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `name` string — The name of the file
        - `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.
        - `target_format` 'image/png', required — The format to convert the image to.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `name` string — The name of the file
        - `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.
        - `target_format` 'image/jpeg', required — The format to convert the image to.
        - `quality` number, required — Image quality (1-100) for lossy formats like jpeg.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `name` string — The name of the file
        - `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.
        - `target_format` 'image/webp', required — The format to convert the image to.
        - `quality` number, required — Image quality (1-100) for lossy formats like webp.
    - `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` 'convert', required — The type of operation being performed by the task.
    - `parameters` union, required
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `name` string — The name of the file
        - `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.
        - `target_format` 'image/png', required — The format to convert the image to.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `name` string — The name of the file
        - `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.
        - `target_format` 'image/jpeg', required — The format to convert the image to.
        - `quality` number, required — Image quality (1-100) for lossy formats like jpeg.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `name` string — The name of the file
        - `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.
        - `target_format` 'image/webp', required — The format to convert the image to.
        - `quality` number, required — Image quality (1-100) for lossy formats like webp.
    - `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` 'convert', required — The type of operation being performed by the task.
    - `parameters` union, required
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `name` string — The name of the file
        - `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.
        - `target_format` 'image/png', required — The format to convert the image to.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `name` string — The name of the file
        - `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.
        - `target_format` 'image/jpeg', required — The format to convert the image to.
        - `quality` number, required — Image quality (1-100) for lossy formats like jpeg.
      - object
        - `input` string, required — The id of the file or task to operate on.
        - `name` string — The name of the file
        - `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.
        - `target_format` 'image/webp', required — The format to convert the image to.
        - `quality` number, required — Image quality (1-100) for lossy formats like webp.
    - `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)
