extract_document
Extract STRUCTURED FIELDS from a document image: invoices, receipts, ID cards — or any custom JSON schema you supply. Every field returns {value, confidence, box} where the confidence and box come from the OCR geometry (never model guesswork); absent fields are null. preset="zatca" additionally decodes the Saudi ZATCA e-invoice QR (TLV) and cross-validates it against the printed fields — use it for Saudi tax invoices. Arabic-first accuracy. 2 credits/page (zatca 4).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"image_base64": "<image_base64>"
},
"name": "extract_document"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lang | No | Language hint; default auto. | auto |
| preset | No | Built-in schema. Use zatca for Saudi e-invoices (adds QR validation). | |
| schema | No | Custom extraction schema instead of a preset: an object whose keys are the fields you want, values describing them, e.g. {"policy_number": "string|null"}. | |
| api_key | No | Optional Auto-Reader OCR key (nsk_live_...). If omitted, a free trial key is auto-provisioned and returned to you in the result. | |
| image_base64 | Yes | The document image as base64 (data: URI prefix accepted). |