Skip to content

Invoice Extraction With n8n and an LLM: Where the Human Review Step Belongs

An LLM can pull fields off a supplier invoice. The design work is everything after: deterministic checks, when a person reviews, which fields they can edit, a duplicate key on vendor plus invoice number, and an ERP post that happens once. With a worked synthetic example.

A paper invoice becomes a card of extracted fields with the invoice number highlighted, passes an orange review checkpoint marked edit and approve, and ends in a ledger posted once.
Eight-stage invoice pipeline: intake, text, LLM extraction and code checks feed a routing decision; failures go to a person who edits fields and re-runs checks; approved invoices are posted once with a reserved vendor and invoice-number key and written to an audit log.
Recommended design • synthetic; n8n templates are examples, not guarantees

Text equivalent. SHAHAB BUILDS / FIELD NOTES B19 Invoice extraction Teaching diagram • Checks, review, then one ledger post 1 Intake Store file + receipt Owner: Code 2 Text Text layer or OCR Owner: Code 3 Extract LLM to strict JSON Owner: Model 4 Checks Sums, fields, vendor, PO, duplicate Owner: Code 5 Route Any failed check, unknown field, new vendor, low confidence? 6 Review (person) Original beside fields; edit fields; re-run checks; approve or reject Yes Straight-through Only after a reviewed period No 7 Post once Reserve (vendor_id, invoice_no) atomically; idempotency key 8 Audit log Extracted vs corrected, decisions, ERP result Never from the pipeline Bank detail changes, new vendors, payment release Recommended design • synthetic; n8n templates are examples, not guarantees

Full-size diagram

An LLM can read a supplier invoice and return its fields as structured data. That part is no longer the hard bit. The hard bit is deciding what happens after the model answers: which numbers get checked by code, when a person looks at the invoice, what that person is allowed to change, and how you make sure the same invoice never lands in your ledger twice. That is the real design work behind n8n invoice extraction with human review.

This article walks through the pipeline stage by stage, with one question in mind: where does the human review step belong, and what does the reviewer need in front of them? It ends with a worked example that follows one synthetic invoice from inbox to ledger.

What this is and isn't. This is a design method, not a client story. I haven't built an invoice pipeline for a named client, and nothing below is a client's data. n8n behaviour is quoted from n8n's documentation and its public workflow templates as read in November 2026. Templates are examples published in n8n's library, not product guarantees, and features change between versions. The review rules are my recommendations.

The n8n invoice extraction pipeline, stage by stage

Strip away the tools and an invoice pipeline has eight stages. Each one has a clear owner: code, the model or a person.

#StageWhat happensOwner
1IntakeAn invoice arrives by email, upload form or webhook. Store the original file and a receipt record before anything elseCode
2TextPDFs with a text layer go to a text extractor; scans and photos go to OCRCode / OCR service
3ExtractionThe LLM turns raw text into strict JSON: vendor, invoice number, dates, line items, subtotal, tax, total, currencyModel
4ChecksArithmetic, required fields, vendor lookup, PO match, duplicate checkCode
5RoutingClean, confident results go one way; anything failing a check or below a confidence threshold goes to reviewCode
6Review and approvalA person compares the extracted fields with the original, corrects what's wrong, then approves or rejectsPerson
7Ledger postThe approved values are posted to the ERP or accounting system, onceCode
8Audit logEvery decision, correction and post result is written downCode

n8n's own template library has several versions of this shape. One extracts fields with an LLM, "requests strict JSON for key invoice fields and an overall confidence score," then "logs high-confidence results to Google Sheets while routing low-confidence or incomplete extractions to a separate review queue tab" (n8n workflow 17919). Another routes "PDFs to a text extractor and images to an OCR API," and in its validation step "recalculates totals and verifies subtotal, tax, and final amounts" before review (n8n workflow 14272). Useful starting points. Neither decides your review policy for you.

Where the LLM must stop, and what the checks own

The model's job is narrow: read messy text and fill a fixed set of fields. It shouldn't decide whether an invoice is valid, whether it's a duplicate or whether it gets paid. Those are rules, and rules belong in code you can test.

What the deterministic checks should own:

  • Arithmetic. Line totals add up to the subtotal. Subtotal plus tax equals the total, within a rounding tolerance you set once. If the model "corrects" a number to make the sums work, you want to catch that, not reward it.
  • Required fields. No invoice number, no invoice date, no total: it goes to review, whatever the confidence score says.
  • Vendor match. The extracted vendor maps to a known vendor record. A new or unrecognised vendor always goes to a person.
  • PO and amount rules. If you use purchase orders, the PO exists and the amount fits within it. Larger amounts can need a different approver.
  • Format checks. Dates parse, currency is one you accept, tax rate is one that exists for that vendor.
  • Duplicate check. More on this below. It runs before the invoice reaches a reviewer, so nobody wastes time approving something that's already been paid.

A confidence score from the model is a routing hint, not a check. Treat "the model says it's 0.95 sure" as one more reason to send something to review when it's low. Never treat it as permission to skip a failed rule when it's high.

If your rules get into rounding, tax splits or rule versions, the calculation side deserves its own care. I wrote about that in deterministic financial calculations in n8n.

Where the human review step belongs, and which fields stay editable

Review belongs after the checks and before the ledger post. Too early, and the reviewer does work code could have done. Too late, and a wrong number is already in your books.

Send an invoice to review when any of these is true:

  • a check failed
  • a required field is missing or "unknown"
  • the vendor is new or doesn't match
  • the amount is above the threshold you set for straight-through posting
  • the model's confidence is below your threshold

Everything else can be considered for straight-through posting, but only once you've watched the pipeline run with review on for a while. A sensible start is to review everything and relax later, deliberately. n8n's docs give similar advice for AI tools in general: start "with human review enabled, then reduce oversight as confidence grows" (n8n Docs).

What the reviewer needs to see

  • The original invoice file, side by side with the extracted fields.
  • Which checks failed, in plain words ("Total doesn't equal subtotal + tax by 4.00").
  • The vendor record it was matched to, and any open PO.
  • Whether a possible duplicate was found.

Editable fields, not just approve or reject

If the reviewer can only approve or reject, every small extraction mistake becomes a full reject and re-run. A guide on Humangent's blog about n8n invoice approval makes this point well: "The approver sees the proposed data, corrects what is wrong, and approves. The corrected values are what get posted to the ERP" (Humangent).

I'd let reviewers edit the extracted fields (invoice number, dates, amounts, line items, vendor match) and keep these locked: the original file, the receipt timestamp, and the check results. After an edit, run the checks again before the approval counts. A correction that breaks the arithmetic shouldn't sail through just because a person typed it.

Record both versions, the model's and the reviewer's. Over time, the differences tell you which fields the model gets wrong most often, which is far more useful than an overall accuracy number.

Duplicates, idempotent ERP posts and the audit log

Paying the same invoice twice is the expensive failure here, and it usually isn't the model's fault. Vendors resend invoices. The same PDF gets forwarded by two people. A workflow times out and someone re-runs it.

Choose the duplicate key on purpose. The natural key for a supplier invoice is the vendor plus the invoice number. The Humangent guide recommends checking "on (vendor_id, invoice_number) — not on file hash, which changes when the PDF is re-saved." I agree for the business-level check. A file hash is still worth storing, because it tells you when the exact same file came in twice, but it's not the key that protects the ledger.

Some details that matter in practice:

  • Normalise before comparing. Trim spaces, unify case, and decide whether "INV-0042" and "INV 42" are the same invoice for that vendor. Write that rule down.
  • Reserve the key atomically. A "check, then insert" in two steps can let two parallel runs both pass. Use a unique constraint or an atomic insert in a real database, so the second attempt fails cleanly. One n8n template's own setup notes say to replace its demo duplicate check "with an atomic lookup/insert in your database (for example Postgres or Redis)" (n8n workflow 17806).
  • Use an idempotency key on the post, if the ERP supports one. The same template "posts approved invoices to an ERP endpoint using an Idempotency-Key header and then generates a sanitized audit log, while rejected/duplicate items are closed without ERP posting." Its setup notes also tell you to "ensure the ERP honors the Idempotency-Key header". The header only helps if the receiving system respects it.
  • Handle the unclear outcome. If the post times out, you don't know whether it landed. Check the ERP for the invoice before trying again, rather than posting blind.

The audit log should answer, for any invoice: when it arrived, what the model extracted, which checks passed or failed, who reviewed it, what they changed, when it was approved, and what the ERP returned. Keep it append-only. Mask what doesn't need to be there, like full bank details, as some templates do. If a supplier disputes a payment six months later, this log is what you'll be reading.

What not to automate in invoice intake

Some steps look automatable and shouldn't be, at least not at first.

  • Changes to vendor bank details. Anyone who can send you an email can put any account number on a PDF, so an extracted invoice is the wrong place to accept new payment details. Never update them from the pipeline. Route it to a person who confirms through a known contact, outside the email thread.
  • New vendor creation. Let the pipeline flag an unknown vendor. Let a person create the record.
  • Payment release. Approving an invoice for posting and releasing a payment are different decisions. Keep them separate, with separate approval.
  • Credit notes and disputes. These need context the invoice text doesn't carry.
  • Silent auto-correction. If the model or a rule "fixes" a number to make the totals match, that's hiding a problem. Flag it.

If you're still deciding whether invoices are the right process to start with at all, that's a question to settle first. What to automate first in a small business is a good place to start.

A worked synthetic example: one invoice, one reviewer, one post

Everything below is invented for this article: the vendor, the numbers and the IDs.

1. Intake. An email arrives in the accounts inbox with a PDF attached. The workflow stores the file, records the receipt time and computes a file hash.

2. Extraction. The PDF has a text layer, so no OCR is needed. The model returns:

FieldExtracted value
vendor_nameNorthline Fasteners Ltd
invoice_numberNF-229
invoice_date2026-11-03
line 1400 × M6 screw @ 0.12 = 48.00
line 220 × wall bracket @ 3.50 = 70.00
subtotal118.00
tax11.80
total129.80
po_numberPO-7713
confidence0.91

3. Checks.

CheckResult
Lines sum to subtotal (48.00 + 70.00 = 118.00)Pass
Subtotal + tax = total (118.00 + 11.80 = 129.80)Pass
Vendor matchedPass (vendor V-0142)
PO exists and covers amountPass
Invoice number matches the vendor's known format (NF- plus four digits)Fail
Duplicate on (V-0142, NF-229)None found

The confidence is high, but a rule failed, so the invoice goes to review. This is exactly the case where trusting the score would have been wrong.

4. Review. The reviewer opens the invoice beside the fields and sees the number is NF-2291; the model dropped the last digit. They correct the field. The checks run again: format now passes, and the duplicate check on (V-0142, NF-2291) finds nothing. They approve.

5. Post. The workflow reserves the key (V-0142, NF-2291) with an atomic insert, then posts to the ERP with that key as the idempotency key. The ERP returns a bill ID.

6. Audit log. One row records: receipt time, file hash, extracted invoice number NF-229, corrected NF-2291 by the reviewer, the check results before and after, approval time, and the ERP bill ID.

If the vendor emails the same invoice again next week, the duplicate check stops it at stage 4. Nobody approves it twice, and the ERP never sees it.

How this differs from approving AI agent actions

This is a document-processing pipeline with one fixed purpose. It's not the same problem as deciding which of an AI agent's tools need a person to approve them before they run. That broader question, including how n8n pauses an agent's tool call for approval, is covered in which AI agent actions need a human approval step. The two overlap at one point: if you later wrap invoice posting as a tool an agent can call, that tool should sit behind review, and everything above about checks and duplicate keys still applies inside it.


Thinking about automating supplier invoices? Bring a handful of anonymised sample invoices and a description of where they go today. I'll help you map the checks, the review step and the ledger post before anything is built. This sits under AI Systems & Automation; start here.


Sources

Put the thinking to work

What could this change for you?

Tell me what you’re building — I’ll tell you honestly where I’d start.

Start a project with me