---
title: "Scan an image"
method: POST
path: "/v1/image-operations/scan"
tags: ["Image Operations"]
---

# Scan an image

`POST /v1/image-operations/scan`

Creates a task to scan an image file. 
This is an equivalent operation for `detect-documents` and `warp` combined, additionally it can apply effects to the scanned image.

## Request body

- object
  - `input` string, required — The id of the file or task to operate on.
  - `name` string — The name of the file
  - `scan_mode` 'none' | 'standard', required — Mode for detecting documents in the image. Available modes are: - **none**: No document detection is performed. - **standard**: Using a quick algorithm. Document is detected in the image, and the image is cropped to the detected document area fixing the perspective to match the document's shape.
  - `effect` 'none' | 'grayscale' | 'scanner' | 'black-background', required — The effect to apply to the image
  - `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 an scan task
  - object
    - `id` string, required — The unique identifier for the task.
    - `operation` 'scan', required — The type of operation being performed by the task.
    - `parameters` object, required
      - `input` string, required — The id of the file or task to operate on.
      - `name` string — The name of the file
      - `scan_mode` 'none' | 'standard', required — Mode for detecting documents in the image. Available modes are: - **none**: No document detection is performed. - **standard**: Using a quick algorithm. Document is detected in the image, and the image is cropped to the detected document area fixing the perspective to match the document's shape.
      - `effect` 'none' | 'grayscale' | 'scanner' | 'black-background', required — The effect to apply to the image
      - `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.
    - `status` 'completed', required — The current status of the task.
    - `result` object, required
      - `generated_files` ImageFromTaskResponse[], required
        - `id` string, required — The id of the file
        - `name` string, required — The name of the file
        - `task_id` string, required — The id of the task that generated this file
        - `created_at` string, required — The creation date of the file in ISO format
        - `type` 'image/png' | 'image/jpeg' | 'image/webp', required — The MIME type of the file
        - `properties` object, required
          - `size` number, required — The size of the image in bytes
          - `width` number, required — The width of the image in pixels
          - `height` number, required — The height of 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` 'scan', required — The type of operation being performed by the task.
    - `parameters` object, required
      - `input` string, required — The id of the file or task to operate on.
      - `name` string — The name of the file
      - `scan_mode` 'none' | 'standard', required — Mode for detecting documents in the image. Available modes are: - **none**: No document detection is performed. - **standard**: Using a quick algorithm. Document is detected in the image, and the image is cropped to the detected document area fixing the perspective to match the document's shape.
      - `effect` 'none' | 'grayscale' | 'scanner' | 'black-background', required — The effect to apply to the image
      - `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.
    - `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` 'scan', required — The type of operation being performed by the task.
    - `parameters` object, required
      - `input` string, required — The id of the file or task to operate on.
      - `name` string — The name of the file
      - `scan_mode` 'none' | 'standard', required — Mode for detecting documents in the image. Available modes are: - **none**: No document detection is performed. - **standard**: Using a quick algorithm. Document is detected in the image, and the image is cropped to the detected document area fixing the perspective to match the document's shape.
      - `effect` 'none' | 'grayscale' | 'scanner' | 'black-background', required — The effect to apply to the image
      - `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.
    - `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` 'scan', required — The type of operation being performed by the task.
    - `parameters` object, required
      - `input` string, required — The id of the file or task to operate on.
      - `name` string — The name of the file
      - `scan_mode` 'none' | 'standard', required — Mode for detecting documents in the image. Available modes are: - **none**: No document detection is performed. - **standard**: Using a quick algorithm. Document is detected in the image, and the image is cropped to the detected document area fixing the perspective to match the document's shape.
      - `effect` 'none' | 'grayscale' | 'scanner' | 'black-background', required — The effect to apply to the image
      - `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.
    - `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)
