Turn a raw invoice or receipt into structured JSON — vendor, invoice/due dates, currency, line items, subtotal, tax, and total. Dates normalized to ISO 8601, amounts to plain decimals. Optional locale hint disambiguates date and number formats. A worked, strongly-typed specialization of key-information-extraction.
Turn the raw text of an invoice or receipt (pasted or OCR'd) into clean, strongly-typed JSON: vendor, invoice and due dates, currency, line items, subtotal, tax, and total. Dates are normalized to ISO 8601 and amounts to plain decimals.
This is the worked, fixed-schema specialization of key-information-extraction — use it when your input really is invoices and you want typed numbers and dates out of the box.
| Entrypoint | Renders | Inputs |
|---|---|---|
systemPrompt | Instructions, field list, normalization rules + embedded schema | optional localeHint |
userPrompt | The delimited invoice document | text |
text (string, required) — the raw invoice/receipt text.localeHint (string, optional) — disambiguates date and number formats, e.g. "US" (MM/DD/YYYY, 1,234.56) vs "EU" (DD/MM/YYYY, 1.234,56). Omit if the document is unambiguous.{
"reasoning": "Standard one-page invoice; total and tax printed, due date inferred from terms.",
"vendor": { "name": "Acme LLC", "address": "1 Main St, Springfield", "tax_id": "GB123456789" },
"invoice_number": "INV-2042",
"invoice_date": "2026-05-01",
"due_date": "2026-05-31",
"currency": "USD",
"line_items": [
{ "description": "Widget", "quantity": 3, "unit_price": 19.99, "amount": 59.97 }
],
"subtotal": 59.97,
"tax": 5.40,
"total": 65.37
}
reasoning first (house convention).parseOutput() gives you typed values directly.null, never invented. The single computed exception: a line amount may be filled as quantity × unit_price when both are present and no line total was printed.text so symbols, ampersands, and angle brackets survive.<document> delimiters around the input for clearer parsing and injection-resistance.null for anything not on the page.additionalProperties: false on every object.Verified by local render (with and without localeHint). Suggested default claude-sonnet-4-6 at temperature: 0. For high-volume or compliance-critical pipelines, validate totals (subtotal + tax ≈ total) in your own code as a cheap sanity gate.