Let the model read the invoice, not approve it: an n8n pattern for AP automation
Description and use
The model extracts invoice data but does not approve payments. An n8n workflow validates the data, applies business rules, and routes invoices to auto‑approve, Slack approval, or hold with clear reasons.
Problem
Automating accounts payable requires decisions beyond invoice extraction; models should not approve invoices, and fraud or errors must be caught before payment.
Outcome
The pattern separates extraction from decision logic, normalises data, applies comprehensive checks (vendor, bank, arithmetic, duplicates, PO), and routes invoices appropriately, improving accuracy and auditability.
Workflow
- Trigger on Gmail email with PDF
- Execute workflow per email
- Store PDF in Google Drive
- Claude call to extract JSON with fixed schema and confidence
- Code node normalises fields and runs checks
- Route to auto_approve, approve, or hold
- Create QuickBooks bill for approved invoices
- Send Slack message for approvals or holds
- Log all actions in Google Sheet
- Label Gmail thread with status
Evidence
The model never approves anything. This post walks through the pattern, with the actual checks we run.
If one batch run handles five invoices and the third one throws, you get a half-processed mess. One execution per invoice means one red run you can retry.
The extraction prompt asks for a fixed schema: vendor name, tax ID, invoice number, dates, currency, subtotal, tax, total, PO number, bank details, line items, plus two fields that do a lot of work: is_invoice and confidence.
We also run a regex over the email body and the model's notes for phrases like "updated bank details" or "remit to our new account".
- Record date: 2026-10-07T10:41:02.617Z