Submit the extraction of values from a document (async, vision model, structured output)
Changed onGeneric extraction of values from a document (PDF or image), e.g. used by ole-sumex-invoice-parser with the sumex-invoice profile when classic extraction is incomplete. Each page is analysed by the internal vision model, whose answer is constrained by a JSON Schema generated by the service from the requested keys (context.missingFields) and their definition in the profile (see /extraction-profiles). Without profile, every key is extracted as free text. Values are normalized (dates yyyy-MM-dd, amounts/numbers with ., identifiers without separators) and the confidence of the model is capped when no evidence is given or when the value is not found in its evidence. The value with the highest confidence is kept for each key. When the profile classifies its pages (e.g. sumex-invoice) or when context.pageHints is given, the pages are first classified (MAIN: the one invoice of the file; SUPPORTING: supporting documents; OTHER: blank or unreadable pages): pages with a hint are not classified again, the other pages are classified one by one by the vision model. The values are then extracted from the pages of the main document only, sent together (at most zia.extraction.max-images-per-call images per call), unclassified pages being treated as pages of the main document; without main document, all the pages except OTHER ones are analysed. The classification of the pages is returned in result.pages. Idempotent on Idempotency-Key: a known key returns the existing job. Jobs are kept zia.extraction.job-ttl (default 24h) after their completion.
Request
- Base URL/api/v1 (relative, and the document was published on a file host, not at the API’s origin)
- Authnone declared. Required headers: Idempotency-Key
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Headers
Request body multipart/form-data
Example request
{
"context": {
"pageHints": [
{
"page": 1,
"documentRole": "MAIN",
"documentType": "FORM",
"formId": "300.001"
},
{
"page": 3,
"documentRole": "SUPPORTING",
"documentType": "INVOICE"
}
]
}
}Response
Job created (or existing job for this Idempotency-Key)
Changes
- info
added the new optional request property
/ - info
added the optional property
/to the response with the status
- info
- info
endpoint added
- info