Extract a document to structured JSON
extract_documentSend one document (PDF, photo, or text) and receive structured JSON with per-field confidence and source grounding. Use a built-in schema name (see list_schemas, e.g. 'invoice', 'receipt') or pass your own draft-07 JSON Schema as schema_json. Processing runs in the EU on Vertex; documents are not retained. Photos can take a while — allow generous timeouts.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema | No | Built-in schema id, e.g. 'invoice' or 'receipt'. Mutually usable with schema_json (schema_json wins). | |
| file_name | No | Original file name, e.g. 'invoice.pdf' (helps type detection). | |
| force_ocr | No | Force OCR even when a text layer is detected. Leave off unless the text layer is garbage. | |
| mime_type | No | MIME type if known, e.g. 'application/pdf', 'image/jpeg'. Inferred from file_name otherwise. | |
| file_base64 | Yes | The document bytes, base64-encoded. PDF, image (PNG/JPG/WEBP) or text file. | |
| schema_json | No | Custom JSON Schema (draft-07) as a string, for anything beyond the built-ins. |