extract_document
Turn a document into JSON shaped like template, with a calibrated confidence (0-1) for every field.
template: the shape of the answer; each leaf names a type: "verbatim-string" (copied exactly), "string",
"number", "integer", "date" (YYYY-MM-DD), "date-time", "boolean", ["a", "b"] (pick one), [["a", "b"]] (pick
any), ["string"] (a list), or [{...}] (a list of objects, e.g. line items).
Example: {"merchant": "verbatim-string", "total": "number", "date": "date",
"items": [{"name": "verbatim-string", "price": "number"}]}
Give the document as exactly one of:
text: the document as text.
image: a JPEG or PNG, base64 or a data URL (a photo, scan or screenshot of one page).
pdf: a PDF with a text layer, base64.
file_path: a JPEG/PNG, PDF or text file on this machine (local server only).
instructions: optional guidance, e.g. "dates are day/month/year" or "amounts in kobo".
Long documents (over 60,000 characters) are split into parts, extracted in parallel and merged; that can take
minutes. Missing values come back as null. Treat fields with confidence below about 0.95 as needing a check.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| No | |||
| text | No | ||
| image | No | ||
| template | Yes | ||
| file_path | No | ||
| instructions | No |