API Reference

OCR Engine API

One endpoint, one API key. Define the parameters you want extracted from a PDF and receive them back as typed, structured JSON.

Authentication

All requests are authenticated with a bearer token. Pass your API key in the Authorization header. Request a key from the contact form.

header
Authorization: Bearer YOUR_API_KEY

Extract endpoint

Send a PDF as multipart form data along with a fields object describing what you want back.

POST https://api.ocrengine.io/v1/extract
curl https://api.ocrengine.io/v1/extract \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@invoice.pdf" \
  -F 'fields={
      "invoice_number": "string",
      "total_amount":   "number",
      "due_date":       "date",
      "line_items":     "array"
    }'

Defining parameters

The fields object is where you describe the data you want. Each key is the name you'll get back in the response; each value is the expected type. The engine finds and returns only those fields.

ParameterTypeRequiredDescription
filefile (PDF)requiredThe PDF to read. Native or scanned, up to 50 MB.
fieldsobjectrequiredMap of field name → expected type.
languagestringoptionalHint such as en or auto (default).
confidencebooleanoptionalInclude a confidence score per field. Default true.
webhook_urlstringoptionalProcess asynchronously and POST the result here.

Field types

Use these values inside the fields object to describe each parameter.

TypeReturnsExample
stringText value"INV-0425"
numberNumeric value1840.00
dateISO-8601 date"2026-07-15"
booleantrue / falsetrue
arrayList of values or rows[ … ]
objectNested key/value group{ … }

Response

You get back a JSON object containing exactly the parameters you defined. When confidence is enabled, each field is paired with a score between 0 and 1.

200 OK response.json
{
  "status": "completed",
  "data": {
    "invoice_number": "INV-0425",
    "total_amount": 1840.00,
    "due_date": "2026-07-15",
    "line_items": [
      { "description": "Design retainer", "amount": 1500.00 },
      { "description": "Hosting", "amount": 340.00 }
    ]
  },
  "confidence": {
    "invoice_number": 0.99,
    "total_amount": 0.97,
    "due_date": 0.95
  }
}

Errors

The API uses conventional HTTP status codes. Error responses include a machine-readable code and a human-readable message.

StatusCodeMeaning
400invalid_requestMalformed fields object or missing file.
401unauthorizedMissing or invalid API key.
413file_too_largePDF exceeds the 50 MB limit.
422extraction_failedDocument could not be read.
429rate_limitedToo many requests — slow down or contact us.

Need something not covered here? Reach out and we'll help.