How to Automate Invoice Processing with n8n: Inbox to Accounting
A practical n8n workflow to automate invoice processing: collect, extract, check, approve and hand over to accounting, with rules first and AI where it helps.
If your office still opens every supplier email, downloads the PDF, and types invoice number, date, amount and VAT into the accounting software by hand, you already know how slow and error-prone that is. This guide shows how to automate invoice processing end to end with n8n: collecting invoices, extracting the data, checking and approving them, and handing them to accounting. You will also see where simple rules beat AI extraction and where a person must stay in the loop.
Why manual invoice handling costs more than it looks
Typing in an invoice takes a few minutes. The real cost sits around that task:
- Searching. Invoices arrive in personal inboxes, a shared office address, supplier portals and the occasional paper letter. Someone has to collect them.
- Retyping errors. A swapped digit in an IBAN or a wrong VAT rate is easy to make and annoying to find later, often only at month end.
- Waiting. Approvals happen by forwarding emails ("Can you OK this?"), so invoices sit in someone's inbox until a payment deadline is close or an early-payment discount is gone.
- No overview. Nobody can say quickly which invoices are open, approved or already paid.
Automation will not remove every manual step, and it should not. The goal is that people only touch the invoices that need judgement, and everything else flows through on its own. Invoices are one of several business processes that are well suited to automation. If you are still deciding whether they are the right first project, our article on the ROI of automation explains how to estimate the benefit with your own numbers rather than someone else's.
The five steps of an automated invoice pipeline
Every working setup we have seen follows the same basic shape. Thinking in these five steps makes it easier to build, test and fix each part separately.
| Step | What happens | Typical n8n building blocks |
|---|---|---|
| 1. Collect | Invoices from all channels land in one place | Email Trigger (IMAP), Gmail or Outlook trigger, Schedule Trigger, HTTP Request |
| 2. Extract | Turn the PDF or image into structured fields | Extract From File, HTTP Request to an OCR or AI service, AI model node |
| 3. Check | Validate the data against rules and your master data | IF, Switch, Code, database or spreadsheet lookups |
| 4. Approve | A person confirms anything unusual | Wait node with a form or link, Slack, Teams or email message |
| 5. Hand over | Send the booking data and document to accounting | HTTP Request to the accounting API, file upload, export file |
In n8n, it pays to build each step as its own sub-workflow and connect them with the Execute Workflow node. You can then test extraction without sending emails, and swap one step later without touching the rest.
Collecting invoices from email, portals and scans
A dedicated invoice inbox
The single most useful change costs nothing: create one address such as [email protected] and ask every supplier to send invoices there. Existing personal inboxes can forward to it with a mail rule.
n8n then watches that inbox. The Email Trigger (IMAP) node works with almost any mail server; Gmail and Microsoft Outlook have their own trigger nodes. For each new message, the workflow:
- Keeps only attachments with a PDF, XML or image file type.
- Ignores obvious non-invoices (newsletters, signature logos) with simple rules on file name and size.
- Calculates a hash of each file, so the same invoice sent twice is processed only once.
- Stores the original file in a fixed location, such as a cloud folder or document store, before anything else happens.
That last point matters. The original document is your record. Every later step should work on a copy and keep a link back to the original.
Supplier portals
Some suppliers (telecoms, cloud services, utilities) only offer invoices in a customer portal. Check first whether the supplier offers an API or an automatic email with the invoice attached; many do once you look in the account settings. Scraping a portal with a headless browser is possible, but it breaks whenever the portal changes, so treat it as a last resort.
Paper and scans
For the few invoices that still arrive on paper, a scanner or phone scanning app that sends the result to the invoice inbox is enough. From then on, scanned invoices take the same path as everything else.
Extracting the data: templates, OCR or an AI model?
This is where most "AI reads your invoices" promises get vague. In practice, you have four options, and a good pipeline often combines them.
1. Structured e-invoices: no extraction needed
Formats like XRechnung or ZUGFeRD/Factur-X carry the invoice data as XML, either as the file itself or embedded in the PDF. If a supplier sends one, read the XML and skip guessing entirely. This is the most reliable path, and it is becoming more common as e-invoicing obligations expand in several countries.
2. Rules and templates for frequent suppliers
If a handful of suppliers send most of your invoices and their PDFs contain real text (not a scanned image), the Extract From File node can pull out the text, and a few regular expressions in a Code node find invoice number, date and total. This is cheap, fast and fully predictable. The downside: each layout needs its own rule, and a supplier redesign breaks it.
3. OCR for scanned documents
Image-only PDFs and photos need optical character recognition first. You can run an open-source OCR engine on your own server or call a cloud OCR service via the HTTP Request node. OCR gives you text, not fields, so you still need rules or a model on top.
4. An AI model for the messy rest
For the long tail of suppliers with different layouts, a language model with vision or text input works well: you send the document text (or image) and ask for a fixed JSON structure.
{
"supplier_name": "string",
"supplier_vat_id": "string or null",
"invoice_number": "string",
"invoice_date": "YYYY-MM-DD",
"due_date": "YYYY-MM-DD or null",
"currency": "EUR",
"net_total": 0.0,
"tax_lines": [{ "rate": 19, "amount": 0.0 }],
"gross_total": 0.0,
"iban": "string or null",
"confidence_notes": "anything unclear"
}
Ask the model to return null for anything it cannot find, rather than guessing, and validate the answer against the schema before using it. Models can misread numbers just like people, so the checks in the next step are not optional.
Which to choose
| Situation | Best fit |
|---|---|
| Supplier sends XRechnung or ZUGFeRD | Read the XML directly |
| Few suppliers, stable text PDFs | Rules and templates |
| Scans and photos | OCR, then rules or AI |
| Many suppliers, varied layouts | AI extraction with strict validation |
Data protection belongs in this decision. Invoices contain names, bank details and sometimes personal data of employees or customers. Before sending documents to an external AI or OCR provider, check where the data is processed, whether a data processing agreement is in place, and whether OCR plus a self-hosted model on your own infrastructure is the better fit.
Checks and approvals before anything reaches accounting
Extraction gives you data. Checks decide whether that data is trustworthy. This step is plain rules, no AI, and it is where most of the reliability comes from.
Automatic checks
- Arithmetic. Net plus tax equals gross, within a cent of rounding.
- Duplicates. Same supplier and invoice number seen before? Stop and flag.
- Known supplier. Look up the supplier in your master data (accounting system, CRM or a simple table) by VAT ID or name.
- Bank details. Compare the IBAN on the invoice with the IBAN stored for that supplier. A changed IBAN is a classic sign of invoice fraud and must always go to a person.
- Dates and plausibility. Invoice date not in the future, due date after invoice date, amount within the usual range for that supplier.
- Purchase order match. If you use purchase orders, compare amount and items with the open order.
Routing for approval
Based on the checks, a Switch node sends each invoice down one of three paths:
- Clean and routine (known supplier, no changes, under an amount you define): prepared for booking automatically. Many teams still let a person confirm a daily batch at first, then relax that once they trust the results.
- Needs approval (new supplier, above the threshold, cost center owner must agree): the responsible person gets a message with the key fields, a link to the PDF and two buttons, approve or reject. In n8n, the Wait node can pause the workflow until the button is clicked, with a timeout and a reminder.
- Needs a human fix (failed checks, unclear extraction, changed IBAN): goes to a review list where someone corrects the fields.
Keep a log of every decision, who made it and when. Auditors and your future self will want it. We go deeper into review screens and approval patterns in human-in-the-loop AI automation with n8n.
Handing over to your accounting software
The final step depends entirely on your accounting tool, so check its integration options before you design anything else.
- Tools with a public API. Cloud accounting tools popular in Germany and Austria, such as lexoffice or sevDesk, offer APIs for uploading receipts and creating booking records. n8n reaches them through the HTTP Request node, or through a dedicated node if one exists for your tool.
- DATEV. Many companies in the DACH region work with a tax advisor who uses DATEV. Here the usual route is getting documents and booking data into DATEV's own systems in the way your tax advisor prefers, using the interfaces DATEV provides. Agree on the format and channel with your tax advisor first.
- Tools without an API. A structured export (CSV in the format your software imports) plus the PDF in an agreed folder still saves most of the typing.
- Thailand. Thai accounting tools vary widely in their integration options. Check the vendor documentation for an API or import format, and consider whether you receive e-Tax invoices that already contain structured data.
Whatever the target, send the original document along with the booking data, so the accountant can always see the source.
This article is general information, not tax or bookkeeping advice. Retention periods, the required form of archived invoices, and e-invoicing obligations differ by country and change over time. Confirm them with your tax advisor before you switch off any manual process.
Running costs, error handling and what to monitor
What it costs to run
Costs come from three places: hosting n8n (self-hosted or cloud), any OCR or AI service you call per document, and the time someone spends on reviews. AI extraction costs are per document and depend on the model and document length, so measure them on a sample of your own invoices instead of guessing. Using rules and XML first, and AI only for the rest, keeps that bill small.
Error handling
Invoice workflows deal with messy input, so plan for failure:
- Set up an Error Trigger workflow that notifies a person when any step fails, with a link to the failed execution.
- Never drop an invoice silently. If extraction fails, the invoice goes to the review list, not into a void.
- Retry calls to external APIs with a delay, since accounting and AI services are occasionally unavailable.
- Make the hand-over step idempotent: if it runs twice, it should not create two booking records.
Our article on production-ready n8n with error handling, testing and observability walks through these patterns in detail.
What to monitor
A short weekly look at a few numbers tells you whether the pipeline is healthy:
- Invoices received versus invoices handed over (the gap should be explainable).
- Share of invoices that needed a manual fix, per supplier. A rising number often means a supplier changed their layout.
- Average time from receipt to approval.
- Number of duplicate and changed-IBAN alerts.
Frequently asked questions
Do I need AI to automate invoice processing?
Not always. If most invoices come from a few suppliers with text-based PDFs or as e-invoices, rules and XML parsing handle them reliably. AI helps with varied layouts and scans. Most pipelines combine both.
How accurate is AI extraction?
It depends on document quality, layout and the model, so test it on a few dozen of your own invoices. Treat every extracted value as a proposal that the automatic checks must confirm, and route anything unclear to a person.
Can invoices be booked without anyone looking at them?
Technically yes, for routine invoices that pass every check. Many companies still keep a quick human confirmation, at least at the start. Changed bank details and new suppliers should always be reviewed.
Is it safe to send invoices to an AI provider?
It can be, with the right contract, data location and provider settings. If that is not acceptable for your company, OCR and a self-hosted model keep the documents on your own infrastructure.
How long does it take to set up?
A first version covering one inbox, your top suppliers and one accounting tool is a small project. The time goes into agreeing on checks, approval rules and the hand-over format with accounting.
Next step: map your invoice flow with us
Invoice processing is a good first automation because the steps are clear and the benefit is easy to see. It is also a process where details matter: which suppliers, which checks, which accounting tool and which approval rules. We have built similar document pipelines before, for example AI-driven CV parsing in our recruiting platform project, which cut manual CV data entry by 90%.
If you would like a second opinion before you build, our AI & Automation service starts with a free workflow check: describe how invoices move through your company today, and we will reply by email with concrete ideas for automating it, including where it is not worth it.