Image Operations

Detect documents in an image

Creates a task to detect document boundaries within an image.

POST
/v1/image-operations/detect-documents
x-api-key
<token>

API Key for authentication

In: header

inputrequired
string

The id of the file or task to operate on.

scan_mode
string

Mode for detecting documents in the image. Available modes are:

  • 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.
  • advanced: Using a more advanced algorithm. It can detect multiple documents in the image and crop them accordingly. This mode is more accurate but may take longer to process.
Default"standard"
Value in"standard" | "advanced"
callback_url
string

The URL to call when the task is completed or failed. If you want to receive events, you probably prefer to use webhooks instead.

Formaturi

Response Body

curl -X POST "https://api.scan-documents.com/v1/image-operations/detect-documents" \  -H "Content-Type: application/json" \  -d '{    "input": "file_avyrvozb9302uwhq"  }'
{
  "id": "task_euyrvozb9302uwhq",
  "operation": "convert",
  "parameters": {
    "input": "file_avyrvozb9302uwhq",
    "name": "Example Image",
    "callback_url": "https://example.com/callback",
    "target_format": "image/png"
  },
  "status": "completed",
  "result": {
    "documents": [
      {
        "file_id": "file_avyrvozb9302uwhq",
        "vertices": [
          {
            "x": 0,
            "y": 0
          }
        ],
        "bounding_box": {
          "top": 0,
          "left": 0,
          "width": 0,
          "height": 0
        }
      }
    ]
  },
  "callback_url": "https://example.com/callback",
  "created_at": "2021-05-01T12:00:00Z",
  "updated_at": "2021-05-01T12:00:00Z"
}
{
  "type": "https://scan-documents.com/docs/errors/not-found",
  "title": "Not Found",
  "status": 404,
  "message": "{resource} with id {id} not found."
}
{
  "type": "https://scan-documents.com/docs/errors/validation-error",
  "title": "Validation Error",
  "status": 422,
  "errors": {
    "{field}": [
      "{error}."
    ]
  }
}
{
  "type": "https://scan-documents.com/docs/errors/rate-limit-error",
  "title": "Rate Limit Exceeded",
  "status": 429,
  "message": "Rate limit exceeded. Please try again later or contact support."
}
{
  "type": "https://scan-documents.com/docs/errors/internal-error",
  "title": "An unexpected error occurred. Contact support if the problem persists.",
  "status": 500,
  "message": "An unexpected error occurred. Contact support if the problem persists."
}