What this automation does
Files arrive in a folder or inbox, and structured rows come out the other side, with every value traceable to the page it came from.
- Collect. Files land in a watched Google Drive, SharePoint or Dropbox folder, an email inbox, or an upload form. Each file gets an ID and its original is stored untouched.
- Split and classify. Multi-document PDFs, such as a packet with an application, a certificate and an ID, are split by page ranges. Each part is classified by type, for example W-9, certificate of insurance, bill of lading, rental application or purchase agreement.
- Extract per type. Each document goes to a vision-capable model with that type’s schema. For every field the model returns the value, the page number and the exact source text it read.
- Check in code. Format checks (EIN pattern, ZIP code, date), cross-field checks (policy expiration after effective date, weights summing to the total), lookups against your records, and a check that the quoted source text appears in the page’s text layer when one exists.
- Route. Documents with every field passing are written straight to the destination. Others go to a review queue with only the failing fields highlighted.
- Learn. Every reviewer correction is stored with the original value, building the error log you use to improve prompts and schemas.
When it is worth building
This is worth building when people spend hours a week reading documents and retyping values, the documents come in many layouts, and the data has a clear destination. Insurance certificates from dozens of carriers, shipping paperwork from many shippers and onboarding packets from many clients are good fits.
For invoices specifically, there is a dedicated invoice processing guide with accounting-specific checks. For freight paperwork, see bill of lading processing. If your documents are digital forms you control, skip extraction entirely and send form submissions straight to a database. And if you process one fixed form at very high volume, compare per-page pricing of cloud document processing services before building on a general model.
Architecture
| Layer | What we use | Why |
|---|---|---|
| Intake | Google Drive, SharePoint or Dropbox folder watch, or an email inbox | Meets documents where they already arrive |
| Orchestration | n8n | Built-in Drive, Dropbox, Airtable, Postgres and SharePoint nodes, with Microsoft Graph for anything the SharePoint node does not cover |
| Pre-processing | PDF splitting, rotation fix and text-layer extraction | Rotated or merged scans are a leading cause of bad extraction |
| Classification | Claude Haiku 5.5 or a small OpenAI GPT model on the first pages | Cheap and fast, and routes each document to the right schema |
| Extraction | Claude Sonnet 5.5 or a comparable OpenAI GPT vision model with structured output | Reads layouts, tables and scans and returns schema-valid JSON with page citations |
| Validation | Code step with per-type rules | Format, arithmetic and lookup checks are exact and testable |
| Review | Airtable interface or a small internal web app showing field and page side by side | Reviewers fix one field in seconds instead of re-reading the whole document |
| Destination | Postgres, Airtable or your system of record’s API | Structured data where downstream work happens |
How to build it
- Pick the first document type by volume times pain. One type done well beats five types done halfway.
- Build a labeled test set of 50 to 100 real documents with the correct value for every field, including the ugly ones: faxes, phone photos, rotated pages.
- Write the schema with field names, types, allowed formats and a one-line description of where the field usually appears. Mark which fields are required.
- Write the extraction prompt requiring page number and verbatim source text per field, and telling the model to return null rather than guess when a field is missing or unreadable.
- Write validation rules for every field you can check, and a source-text check against the page’s text layer.
- Run the test set and measure accuracy per field, not per document. A 95 percent document score can hide one field that is wrong a third of the time.
- Build the review screen, showing the page image next to only the fields that failed.
- Go live with review on every document, then allow straight-through processing for fields and document types that hold up on live traffic.
The downloadable starter template below covers folder intake, classification, extraction with page citations, validation and an Airtable review queue.
What breaks in production
- Mixed packets. One scanned PDF holds four different documents. Without splitting, the model extracts fields from the wrong one. Classify page by page and group pages before extracting.
- Helpful normalization. The model “fixes” a name’s spelling or reformats an ID number. Require verbatim values for identifiers and normalize in code afterwards, never in the prompt.
- Ambiguous dates. 03/04/2026 is March 4 in the US and April 3 elsewhere. Return the raw string alongside the parsed date and flag any day value of 12 or less on documents from outside the US.
- Tables spanning pages. Line items or schedules split across pages get truncated or duplicated. Extract the table across the full page range in one call and check row counts.
- Low-quality scans. Faxes and phone photos produce plausible but wrong digits. Run a quick image quality check and send poor scans to review by default.
- New layouts and versions. A carrier or agency updates its form. Track review rates per source and look at any source whose rate jumps.
- Sensitive data in logs. Workflow execution logs store full extracted payloads by default. Mask sensitive fields or turn off payload logging for those steps.
Timeline and cost
One document type with a review queue and one destination typically takes two to four weeks. Lumeor builds document extraction workflows in the range of $4,000 to $12,000 per workflow. The low end is a single, consistent document type written to Airtable or Sheets. The high end covers mixed packets with splitting and classification, several document types, a custom review screen and writing to a system of record through its API. Model costs depend on page count and image quality, and are usually a small fraction of the review time saved.
How to measure success
- Field-level accuracy on the labeled test set, re-run whenever the prompt, schema or model changes
- Straight-through rate: share of documents written with no human touch, by document type
- Review time per document, which should fall as reviewers only see failing fields
- Corrections per field, from the error log, which shows exactly what to fix next
- Cost per document, including model usage and reviewer time