AI invoice approval: Claude reads the invoice, code checks the totals and duplicates
Invoices land in a Google Drive folder, and someone has to retype, check and approve them. This n8n workflow gives Claude the PDF or photo to read, but arithmetic, duplicates and the approval threshold are checked in code. Above the threshold a person decides.
Author
- Adrian HuniaCo-founder of SEVENEDGE
- Published:
- Last verified:
- n8n version:
- 2.8.4
In short
What it does
- Watches a Google Drive folder and downloads each new invoice
- Extracts fields from a PDF or image with Claude vision
- Checks in code that subtotal plus tax equals the total
- Looks for a duplicate invoice number in a Google Sheets ledger
- Approves small amounts on its own and sends larger ones to a person with links
What it does not do
- Does not replace structured e-invoicing such as Poland's KSeF
- Cannot tell the same invoice number from two vendors apart
- Does not convert currencies when comparing with the threshold
- Does not make the payment
What it needs
- n8n (tested on 2.8.4)
- Google Drive and Google Sheets
- An Anthropic API key
- A webhook URL for notifications (Slack, Teams or similar)
AI invoice approval: Claude reads the invoice, code checks the totals and duplicates
The process looks much the same in most small companies. An invoice arrives by email, someone saves it to a folder, retypes the amounts into a spreadsheet, checks it was not paid already and asks the boss to approve. Retyping takes the most time; approving without checking carries the most risk.
This n8n workflow splits the work so the model only does what it is good at: reading the document.

The model reads, it does not add up
The file from Drive goes to the Anthropic API as a document block (PDF) or an image block (photo). The prompt asks for JSON only and forbids guessing:
If a field is not visible, use null. Never guess a plausible-looking number.
If the response cannot be parsed, the invoice does not crash the workflow. It gets an extraction_failed flag and goes straight to a person. An unreadable invoice is exactly the case someone should see.
Three checks the model does not do
const diff = Math.abs((sub + tax) - tot);
math_ok = diff < 0.02; // rounding tolerance
Subtotal plus tax must equal the total to within two cents. A mismatch means either a reading error or an error on the invoice. Either way there is no auto-approval, whatever the amount.
The second check is the duplicate: the workflow looks the invoice number up in a Google Sheets ledger. The third is the amount threshold (500 by default).
| Situation | What happens |
|---|---|
| unreadable, totals do not match, or a duplicate | to a person, whatever the amount |
| amount below the threshold | approved automatically |
| amount at or above the threshold | to a person |
A person clicks a link
The message to the approver goes to a webhook (Slack, Teams, anything that accepts JSON with a text field) and carries the reason plus two links: approve and reject. The links point at the Wait node's $execution.resumeUrl, so the workflow simply waits for the click.
After the decision, the invoice is written to the ledger with the check results, the approval type and the running spend with that vendor, and the file moves to a "processed" or "flagged" folder.
Limitations
Duplicates are checked on the invoice number alone. Two vendors that both send invoice "1/11/2026" produce a false duplicate. A safer key is the number plus the vendor's tax ID or name.
The Google Drive trigger polls the folder every minute. Several files dropped at once arrive in one run, while the later steps are written for one invoice at a time. For bulk uploads, process files one by one.
The threshold compares the gross amount regardless of currency.
In Poland, since 2026 most business-to-business invoices go through KSeF as structured XML. Those do not need a model to read them. This workflow fits foreign invoices, receipts, bills from outside KSeF and scans.
When it does not make sense
With a dozen invoices a month, manual approval is faster than maintaining another automation. The workflow starts paying off with hundreds of documents and several people in the approval chain. If invoices should flow into accounting software, with approval permissions, history and deputies, that is a process automation project, not a single workflow. We use the same split between model and code when analysing supplier price lists.
Take it with you
How to cite this
Adrian Hunia (2026). AI invoice approval: Claude reads the invoice, code checks the totals and duplicates. SEVENEDGE. https://sevenedge.pl/en/workflows/akceptacja-faktur-ai-claude-vision (accessed: November 5, 2026)
Sources
- Claude docs — PDF supportAPI docs
- n8n docs — Waitn8n docs
- n8n docs — Google Sheetsn8n docs
Who is behind this
Adrian Hunia
Co-founder of SEVENEDGE
Co-founder of SEVENEDGE. Designs and deploys business systems for small companies, from production management to time tracking. Works with Next.js, FastAPI and PostgreSQL. SEVENEDGE has no subcontractors — both owners write the code.
Related documents
Other workflows we documented the same way.
- Contract review against your playbook: clause by clause, with a gate for the lawyerA contract lands in a folder, Claude extracts the clauses, an agent assesses each one against your negotiating positions, and code computes the verdict. While writing this up we found a bug in the published version that dropped two of every three assessments. We describe it here along with the fix.
- A three-agent AI support desk: triage, documentation research, reply draft and a human gateOne agent classifies the ticket, a second looks for the answer in your own documentation, a third drafts the reply. Only a reply that passes three conditions at once goes out on its own. A person sees the rest, and every question your docs cannot answer becomes a documentation task.


