Skip to content

API Documentation

Base URL: https://api.optii.eu

Authentication

Include your API key in the X-API-Key or Authorization: Bearer header.

curl https://api.optii.eu/ocr/extract \
  -H "X-API-Key: optii_sk_your_key" \
  -F "file=@document.pdf"

POST /ocr/extract

Extract raw text from an image or PDF.

{
  "success": true,
  "text": "DUMONT & FILS SPRL\nTVA: BE0202239951...",
  "lines": [
    { "text": "DUMONT & FILS SPRL", "confidence": 0.9912, "bbox": [...] }
  ],
  "confidence": 0.9847,
  "processing_time_ms": 342,
  "file_hash": "a3b2c1d4"
}

POST /ocr/extract?structured=true

Extract structured fields from any document. Auto-detects document type (invoice, credit note, receipt).

{
  "document_type": "invoice",
  "supplier_name": "DUMONT & FILS SPRL",
  "supplier_vat": "BE0202239951",
  "supplier_iban": "BE68539007547034",
  "document_number": "2024-0847",
  "document_date": "2024-03-15",
  "due_date": "2024-04-15",
  "structured_communication": "+++090/9337/55493+++",
  "currency": "EUR",
  "line_items": [
    { "description": "Service annuel", "quantity": 1, "unit_price": 1250.00, "line_total": 1250.00, "vat_rate": 21.0 }
  ],
  "vat_subtotals": [
    { "rate": 21.0, "base_amount": 1250.00, "vat_amount": 262.50 }
  ],
  "total_excl_vat": 1250.00,
  "total_vat": 262.50,
  "total_incl_vat": 1512.50,
  "confidence": 0.95,
  "validations": [
    { "check": "totals_sum", "passed": true, "message": "..." },
    { "check": "iban_mod97", "passed": true, "message": "..." },
    { "check": "vat_checkdigit", "passed": true, "message": "..." }
  ],
  "processing_time_ms": 487
}

The legacy /ocr/invoice endpoint still works and maps to /ocr/extract?structured=true.

Supported formats

File types

PNG, JPG, JPEG, TIFF, BMP, WebP, PDF

Languages

French, Dutch, German, English

Error codes

Code Meaning
400Unsupported file type
401Invalid API key
413File too large
429Rate limit / quota exceeded
500Processing error