What this automation does
Every invoice that lands in your AP inbox gets read, checked and either posted or flagged, without anyone retyping it.
- Capture. A workflow watches a shared mailbox such as ap@yourcompany.com and pulls every PDF or image attachment. Vendor portals and scanned mail can drop files into a watched folder instead.
- Extract. A vision-capable model reads the document and returns vendor name, invoice number, invoice date, due date, PO number, currency, subtotal, tax, total and line items as strict JSON.
- Validate. Code, not the model, checks the result. Line items must sum to the subtotal, subtotal plus tax must equal the total, the vendor must exist in your accounting system, and the invoice number must not already be on file.
- Route. Clean invoices under your approval threshold are created as bills. Anything that fails a check, or is over the threshold, goes to a person with the reason attached.
- Post and log. The bill is created in QuickBooks Online or Xero with the original PDF attached, and every decision is written to a log you can audit.
When it is worth building
This pays off when someone on your team spends more than a few hours a week keying invoices. Below about 100 invoices a month, the built-in capture features in your accounting software or a tool like BILL are often enough. Above a few thousand a month, or with heavy PO matching, you will want the purchase order matching step as well.
It also pays off when invoices arrive in many formats from many vendors. Template-based OCR tools break every time a vendor changes their layout. A model-based extractor does not need a template per vendor.
Architecture
| Layer | What we use | Why |
|---|---|---|
| Orchestration | n8n, self-hosted or cloud | Visual workflow, built-in Gmail, Outlook, QuickBooks and Xero nodes, and you can keep data on your own servers |
| Extraction | Claude or GPT vision models through the API | Reads PDFs and images directly and follows a JSON schema reliably |
| Validation | A code step inside n8n | Arithmetic and duplicate checks should be deterministic, never left to the model |
| Exceptions | Slack message or a review sheet | Reviewers already live there, and one-click approve keeps the queue moving |
| System of record | QuickBooks Online or Xero | Bills, vendors and attachments stay where your accountant expects them |
How to build it
- Set up the inbox. Create a dedicated AP address and forward vendor invoices to it. Mixing invoices into a personal inbox is the most common reason these projects stall.
- Write the extraction schema first. Decide exactly which fields you need and their formats, for example ISO dates and amounts as numbers. Give the model the schema and two or three example invoices.
- Extract with structured output. Call the model with the attachment and the schema. Use the provider’s structured output or tool-calling mode so you always get parseable JSON.
- Validate in code. Check the arithmetic, look up the vendor by name and tax ID, and search for the invoice number to block duplicates. Assign a reason code to every failure.
- Route by confidence and amount. Auto-create bills only when every check passes and the amount is under your threshold. Send everything else to the exceptions channel.
- Post as draft first. For the first few weeks, create Xero bills as Draft or Awaiting Approval, and in QuickBooks Online have a person confirm each bill in the review queue before it is created. Compare against what your team would have entered.
- Turn on auto-post per vendor. Once a vendor has a clean track record, let their invoices post directly. Keep high-value invoices on human approval permanently.
The downloadable starter template below covers steps 1, 3, 4 and 5 for Gmail and QuickBooks Online.
What breaks in production
- Multi-invoice PDFs. Some vendors send statements with several invoices in one file. Detect page count and ask the model to split before extracting.
- Vendor name drift. “ACME Corp”, “Acme Corporation” and “ACME CORP.” are the same vendor. Match on tax ID or remit-to address, and keep an alias table.
- Credit memos. They look like invoices with negative totals. Classify document type before extraction so they are not posted as bills.
- Duplicate sends. Vendors resend invoices when they are late. The duplicate check on vendor plus invoice number catches this, but only if you run it before posting.
- Silent model changes. Pin a model version and keep a small test set of real invoices you re-run whenever you upgrade.
Timeline and cost
A single-entity setup with one inbox and one accounting system typically takes two to four weeks. Lumeor builds this in the range of $5,000 to $12,000, depending on the number of entities, whether PO matching is included, and how many vendors need special handling. Running costs are usually modest: model usage for a few thousand invoices a month is commonly well under $100, plus n8n hosting.
How to measure success
- Minutes of manual entry per invoice, before and after
- Share of invoices posted with no human touch
- Exception rate by vendor, which tells you where to improve
- Duplicate payments caught
- Days from invoice receipt to approval