Last reviewed September 1, 2026

How do I process documents whose layouts are all different?

Direct answer

Stop modelling the page and start modelling the fields. Template systems break on layout variance because they encode positions — this box, that region — so every new sender is a new project. A field-first approach encodes meaning instead: "invoice_number is the vendor’s own identifier for this bill, not your purchase order number", and the reader finds it wherever it sits. The right unit is one schema per document class, not one template per sender.

01

Three kinds of variance, and only one of them wants templates

It helps to name what you are actually dealing with, because the three cases have different economics.

Fixed forms are identical every time: a W-2, an ACORD certificate, a government application. The layout is defined by whoever publishes the form, and it changes only when they revise it. Semi-structured documents carry the same concepts in different arrangements: every invoice has a total, but no two vendors place it in the same spot. Free-form documents — contracts, letters, medical notes — have no reliable structure at all, only language.

Templates are defensible for fixed forms and a bad investment for the other two. If your corpus is mostly semi-structured, the number of templates you must maintain grows with your supplier list, and that curve never bends.

02

The template trap, in numbers you can check

Count your distinct senders. Multiply by the time it takes to build and test one template. Then multiply the same number by an annual churn rate — vendors redesign their paperwork, acquire each other, and change billing systems — and you have the recurring cost of the template approach for your business. Compare that against writing one schema per document class and reviewing exceptions.

The trap is that templates feel accurate. On the documents they were built for, they are: a coordinate box either contains the number or it does not. The cost is invisible until the day a supplier moves their total two centimetres left and every downstream number silently changes.

03

Write field descriptions that survive a new sender

With a field-first tool, your leverage is in the description text, because that is the instruction the reader follows. Descriptions written as labels are almost useless; descriptions written as disambiguation rules are what make a schema portable.

Compare "invoice number" with "the vendor’s own identifier for this bill, usually labelled Invoice No., Rechnung-Nr., or Document Number; never the purchase order or account number". The second one survives a German supplier, a document that prints both numbers side by side, and a template that calls it "Reference".

  • Say what the value is, then say what it is not. Most extraction errors are confusions between two similar numbers on the same page.
  • Name the synonyms you know, including other languages your suppliers use.
  • State the format you want: date as YYYY-MM-DD, money as a number with no symbol, codes uppercased.
  • For choice fields, use an enum with the exact allowed values instead of free text.
  • Mention where the value usually is only as a hint, never as a rule — position is the thing you are trying to stop depending on.
04

One schema, many senders — and a version history

When a document class genuinely splits — say your "invoice" schema now has to cover freight bills with per-container line items — the answer is a second schema, not a fork of the first. Keep each schema tied to a class of documents your workflow treats the same way.

Versioning matters more than teams expect. In Dokyumi, editing a schema’s fields bumps its version, and past extractions keep pointing at the version they ran under, so a change today does not silently reinterpret last quarter’s results. Whatever tool you use, make sure you can answer "which definition produced this row?" a year from now.

Decision table

Variance decision table: what to use when

Match the row to your corpus, not to the tool you already own. The last column is the question that decides it, and it is usually an operations question rather than a technical one.

Document typeWhat variesApproach that holds upWhat breaks itThe question to ask
Fixed government or industry form (W-2, ACORD, 1099)Almost nothing between senders; the publisher revises it occasionallyZonal/template extraction, or a schema — both workA form revision year, or a hand-filled variantWho watches for the annual revision?
Semi-structured business document (invoice, statement, purchase order)Position, labels, language, page countOne schema per class, with disambiguating field descriptionsTwo similar numbers on one page with vague descriptionsHow many new senders do we onboard a month?
Same class, many countriesLabels, date order, decimal separators, tax conceptsOne schema plus explicit format rules and enumsAssuming US date and number conventionsDo we normalise currency and dates before or after extraction?
Free-form document (contract, letter, clinical note)Everything, including whether the concept appears at allA schema of narrow questions, each with a nullable answerAsking for a summary instead of specific fieldsWhat decision does each extracted field actually drive?
Mixed pile with no classification stepThe document type itselfClassify first, then route to the right schemaRunning one giant schema across every document typeCan we tell the classes apart before extraction?

The last row is the one teams skip. If your intake is a shared mailbox where invoices, statements and contracts all arrive together, classification is a step in its own right — and it is much easier to get right than extraction, because you only need one answer per document.

Copy-pasteable artifact

The same field, written badly and written well

Two versions of one field definition. Nothing changes about the model, the OCR, or the pricing — only the instruction. This is the cheapest quality improvement available in a field-first pipeline.

weak-fields.json
[
  { "key": "number", "type": "string", "required": true, "description": "invoice number" },
  { "key": "date",   "type": "date",   "required": true, "description": "date" },
  { "key": "amount", "type": "currency", "required": true, "description": "amount" },
  { "key": "terms",  "type": "string", "required": false, "description": "payment terms" }
]

The enum in the last field is doing something subtle: it converts an open-ended reading task into a classification with four legal answers, which is both easier to get right and trivial to validate downstream.

Terminology bridge

The vocabulary here is structured, semi-structured and unstructured — and the old approach is zonal OCR

Template systems that read fixed regions are called zonal OCR or template matching; the field-first alternative is schema-driven extraction. Analysts group the whole area under intelligent document processing. If a vendor demo starts by asking you to draw boxes on a sample document, you are looking at a template system — which is fine for fixed forms and expensive for everything else.

  • zonal OCR
  • template matching
  • semi-structured documents
  • schema-driven extraction
  • document classification

Follow-up questions

How many schemas will I end up with?+
One per document class your workflow treats differently. Teams that start with "invoices, statements, tax forms" usually end at four or five. If you are heading toward dozens, check whether you are actually building templates again with a different name.
What happens when a supplier redesigns their invoice?+
With a field-first schema, usually nothing — the concepts did not change. If a redesign does introduce a genuinely new field or an ambiguity, you edit the description once for every supplier rather than rebuilding one template.
Do plan limits cap how many schemas I can have?+
Yes. Free includes 2 schemas, Starter 10, Growth 50, and Enterprise is contract-defined. That ceiling is another reason to keep the unit "one schema per document class" rather than per sender.

Evidence notes

Sources and limitations

Sources used

Limitations

  • Field-first extraction still fails when a document is genuinely ambiguous to a careful human reader. Descriptions reduce that set; they do not empty it.
  • Classification of mixed intake is a separate step. Nothing on this page claims a single schema can sort your mailbox for you.
  • Dokyumi publishes no comparative accuracy figures against template systems, and none are implied here.

Published and last reviewed September 1, 2026. Product behavior can change; the linked API, pricing, and security pages are the controlling public references.

Point one schema at three different senders

That is the whole test: same schema, three layouts, compare the JSON. The free plan includes 25 credits a month and 2 schemas, with no card required, which is enough to test this on your own documents before deciding anything.