Invoices are the highest-volume document in most businesses and the purest example of the variable-layout problem: every vendor designs their own, there are effectively infinite formats, and new ones arrive weekly. That is why template-based invoice tools require per-vendor setup and why AP teams still re-key data in 2026.
This guide covers the fields an invoice parser should extract, why the fixed-vs-variable distinction decides your tooling, the synchronous API integration pattern, optional webhook delivery for upload-site submissions, and how confidence-based review keeps bad data out of your ERP.
What an invoice contains
Layouts vary infinitely; the information does not. A commercial invoice carries four clusters of data:
- ▪Vendor identity — name, address, tax ID/VAT number, remit-to details, contact info
- ▪Invoice metadata — invoice number, invoice date, due date, currency, PO/contract references, payment terms (Net 30, early-payment discounts)
- ▪Line items — the table: description, SKU, quantity, unit price, line total, per-line tax treatment
- ▪Totals — subtotal, tax, shipping, discounts, amount due, and sometimes payment instructions (ACH/wire details)
The extraction schema
The schema below is the shape most AP integrations start from — the same one used in our accounts payable use case:
| Field | Type | Required | Notes |
|---|---|---|---|
| vendor_name | string | Yes | |
| vendor_address | string | No | |
| invoice_number | string | Yes | Dedup key together with vendor_name |
| invoice_date | date | Yes | Normalized to ISO 8601 |
| due_date | date | No | |
| po_number | string | No | For three-way matching |
| currency | string | Yes | Explicit — never inferred from a symbol alone |
| subtotal | currency | No | |
| tax_amount | currency | No | |
| total_amount | currency | Yes | Anchor for math validation |
| line_items | array | No | Array of { description, quantity, unit_price, line_total } |
The variable-layout problem, properly solved
Invoices are the canonical variable-layout document. The total might be top-right, bottom-left, or mid-page; "Invoice #", "Inv No.", "Reference", and "Document number" all mean the same field; line-item tables nest sub-items, span pages, and interleave notes between rows. European invoices add VAT semantics and comma-as-decimal amounts.
Template tools handle this by making you define extraction zones per vendor — workable at five vendors, unmanageable at fifty, and broken every time a vendor refreshes their branding. Schema-first extraction reads the document the way a person does: it finds the vendor, the total, and the table wherever they sit, and returns them under the field names you chose. Vendor number fifty-one requires no new template, though each extraction still consumes credits.
Plan for multi-page line-item tables, rescanned quality loss, and duplicate submissions. Test arrays that cross page boundaries on representative invoices and route review results before downstream use. Dedupe on vendor_name + invoice_number in your own system; an identical file can reuse cached OCR and may return faster, while every extraction still consumes credits.
API integration
Define the schema once (plain-English description or inference from samples), then every invoice is one call:
Request — POST /api/v1/extract
curl -X POST https://dokyumi.com/api/v1/extract \
-H "Authorization: Bearer dk_live_your_api_key" \
-F "file=@acme-invoice.pdf" \
-F "schema=invoice-parser"Response
{
"id": "278fa88c-d752-455f-8c4e-3ccb4adf6d67",
"status": "completed",
"request_id": "24617d74-d28b-4cac-9419-231922140213",
"schema": "invoice-parser",
"data": {
"vendor_name": "Acme Office Supply Co.",
"invoice_number": "INV-2026-00847",
"invoice_date": "2026-03-10",
"due_date": "2026-04-09",
"po_number": "PO-1187",
"currency": "USD",
"subtotal": 2340.00,
"tax_amount": 187.20,
"total_amount": 2527.20,
"line_items": [
{
"description": "Office Chair (Ergonomic, Model X3)",
"quantity": 4,
"unit_price": 285.00,
"line_total": 1140.00
},
{
"description": "Standing Desk (Adjustable, 60in)",
"quantity": 2,
"unit_price": 600.00,
"line_total": 1200.00
}
]
},
"confidence": {
"vendor_name": 0.99,
"invoice_number": 0.98,
"total_amount": 0.99,
"line_items": 0.95
},
"validation": {
"valid": true,
"errors": [],
"low_confidence_fields": []
},
"meta": {
"processing_time_ms": 4210,
"page_count": 1,
"credits_used": 1,
"ocr_cached": false,
"model": "anthropic/claude-sonnet-4"
}
}For webhook delivery, configure the URL on a Dokyumi upload site. Documents submitted through that site POST their completed result to your endpoint; direct API extraction requests return synchronously and do not accept a webhook_url field.
Map the response explicitly into the fields, currency, tax, and line-item structure required by your AP system. Resolve review results before creating a bill or invoice record.
Confidence scores and the review queue
AP automation lives or dies on trust: a wrong total that reaches payment is worse than a slow process. On a review result, inspect both validation.errors and validation.low_confidence_fields; the model-reported confidence map may not include every field. Your workflow decides what needs human verification before posting.
Invoices also support deterministic checks: subtotal + tax should equal total, and line totals should sum to the subtotal. Apply those checks alongside the review status, and block downstream posting in your own integration until the required checks pass.
What it costs
Flat tiers, priced in extraction credits. A 5-page invoice with a 90-row line-item table is one credit — line-item count never affects price:
A mid-sized AP team processing 500 short invoices a month fits exactly in Starter at $99 flat — with per-page metered pricing, the same volume produces a bill you cannot predict until month-end. The full cost comparison is in the invoice automation guide.
- ▪Free — $0/month: 25 extraction credits, 2 schemas. Enough to validate extraction quality on your real documents before paying anything.
- ▪Starter — $99/month: 500 extraction credits, 10 schemas, REST API and webhook delivery.
- ▪Growth — $499/month: 3,000 extraction credits, 50 schemas, 25 white-label upload portals.
- ▪Enterprise — quoted: custom volume, documents beyond the 50-page self-serve limit, unlimited schemas and portals, schemas built for you.
- ▪One credit covers a document of up to 5 pages. A 6–10 page document uses 2 credits, 11–15 uses 3, and so on up to the 50-page self-serve ceiling — no per-page metering and no overage billing.
Full details on the pricing page.