API ReferenceConversion

Convert documents to structured data using OCR

POST
/api/convert

Process documents and extract structured data using AI-powered OCR.

Supported file formats:

  • image/jpeg (JPEG)
  • image/png (PNG)
  • image/gif (GIF)
  • image/bmp (BMP)
  • image/webp (WebP)
  • application/pdf (PDF)

Size limits:

  • Maximum file size: 100MB
  • URL download timeout: 30 seconds

Request methods:

  1. multipart/form-data: Direct file upload
  2. application/json with base64: Base64-encoded image
  3. application/json with URL: Image URL for automatic download

Authorization

ApiKeyAuth
AuthorizationBearer <token>

Bearer token para autenticación a la API

In: header

image*string

Image file to process (see supported formats)

document_type_code*string

Document type code

document_metadata?object

Additional document metadata as JSON string (optional)

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://app.docutray.com/api/convert" \  -H "Content-Type: application/json" \  -d '{    "image_base64": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAAA==",    "document_type_code": "invoice"  }'
{
  "data": {
    "invoice_number": "INV-2024-001",
    "issue_date": "2024-01-15",
    "vendor_name": "Acme Corporation",
    "vendor_address": "123 Business St, Suite 100",
    "total": 1160,
    "subtotal": 1000,
    "tax": 160
  }
}
{
  "message": "Validation error",
  "errors": [
    "string"
  ]
}
{
  "error": "Invalid API key"
}
{
  "error": "Monthly conversion quota exceeded",
  "quota": 0,
  "used": 0,
  "resetDate": "2019-08-24T14:15:22Z"
}
{
  "message": "Error accessing URL: 404 Not Found"
}
{
  "message": "URL download timeout (30000ms)"
}
{
  "message": "File exceeds maximum allowed size (100MB)"
}
{
  "message": "Unsupported Content-Type. Use multipart/form-data or application/json."
}
{
  "error": "Rate limit exceeded",
  "limitType": "minute",
  "limit": 0,
  "remaining": 0,
  "resetTime": 0,
  "retryAfter": 0
}
{
  "message": "Internal server error: Failed to process image"
}