Inteligencia artificial

How to automate invoice processing with AI, from inbox to ERP

The journey of a supplier invoice when an AI agent processes it, the controls accounting needs in order to trust it and how it fits with mandatory e-invoicing in Spain.

In many companies, supplier invoices follow the same path: they arrive in the mailbox as PDFs, someone in accounting opens them, copies the data into the ERP, looks for the purchase order and the delivery note to check that everything matches and, if something does not add up, writes to the supplier or to purchasing. Once volume goes past a few hundred invoices a month, that task can take up almost a full-time person.

Today it is also one of the processes where AI works best, because it combines documents with no fixed format, clear rules and a target system. In this article we explain how invoice processing automation with AI works from start to finish, which controls are needed and what changes with mandatory e-invoicing. It is work we are doing for a client with Outlook and NetSuite.

Which part of invoice processing can be automated

Processing a supplier invoice takes six steps. AI can handle almost all of them and leave the decisions to people:

  • Receipt: detect the emails with invoices in the mailbox, separate the attachments and discard what is not an invoice (advertising, reminders, stray delivery notes).
  • Reading: extract the issuer, tax ID, number, dates, taxable base, VAT, withholdings, total and line items, even if each supplier uses a different layout.
  • Identification: find the supplier in the ERP and the purchase order the invoice belongs to.
  • Checking: match invoice, order and receipt (three-way matching) and check for duplicates, amounts and taxes.
  • Recording: prepare the invoice in the ERP with its general ledger account, cost center and due date.
  • Exceptions: when something does not match, explain what is happening and notify the right person.

Six-step diagram of how an AI agent processes a supplier invoice: 1 receipt in the mailbox (AI), 2 reading the data (AI), 3 finding the supplier and purchase order in the ERP (AI + ERP), 4 checking invoice, order and receipt, duplicates and taxes (rules), 5 recording in the ERP with account, cost center and due date (AI + rules) and 6 approval by a person who resolves the exceptions
Download chart

Why traditional OCR fell short

Invoice automation has existed for years with OCR and templates per supplier. It works with large, consistent suppliers and fails with everything else: each new supplier needs a template, a layout change breaks it and no one knows what to do with a multi-page invoice, credit notes or line discounts.

Current language models, such as Claude, GPT or Gemini, read the invoice the way a person would. They understand that "Taxable base", "Subtotal" and "Net" mean the same thing, that a line is for shipping and not for product, or that a credit note is negative. They can also reason about what they read, for example when comparing it with the order and noticing that the unit price has gone up or that the invoice was already recorded last month.

What AI does, what rules do and what people do

Not every part of the process needs AI. We propose splitting it like this:

  • AI for whatever requires interpretation: reading variable documents, classifying the expense, understanding the text of an email or writing the explanation of an exception.
  • Programmed rules for whatever has to be exact: tax calculation, amount tolerances, tax ID validation and duplicate detection by number and supplier.
  • People to approve, decide on exceptions and keep the rules up to date when terms with a supplier change.

This combination is what we call an AI agent: a program that uses the model to understand and decide the next step, and tools with rules to act on the mailbox and the ERP. For the agent to read and write in the ERP with controlled permissions, we use connectors like the ones we describe in how to connect ChatGPT or Claude to your ERP.

Controls so that accounting can trust the system

  • A person approves before posting, at least for the first few months. The agent leaves everything ready and the confirmation is one click.
  • If the model is unsure about an amount or a date, it flags it for review instead of filling it in.
  • Tolerances are agreed with finance: for example, accepting differences of a few cents due to rounding and blocking those above a percentage of the order.
  • Every step is logged with the original document linked, for audits and to correct rules.
  • Before every change, it is tested with real invoices and compared with what a person would have done.

With these controls, the realistic outcome is that most invoices reach the ERP prepared and checked, and the team handles the ones with an exception.

How many supplier invoices do you process a month?

Tell us how they arrive, which ERP you use and where they get stuck. On the first call we suggest where to start and a cost range.

Let's talk about your invoices

Mandatory e-invoicing and Verifactu in Spain

Spanish regulations are going to change how invoices are received and issued, and it is worth taking that into account when designing the automation. This is the situation as of November 2026:

  • B2B e-invoicing (Ley Crea y Crece). Royal Decree 238/2026 and Order HAC/1028/2026, in force since October 2026, require companies to issue and receive structured electronic invoices from October 2027 if their turnover exceeds €8 million, and from October 2028 for everyone else.
  • Verifactu. It affects the software used to issue invoices, not receiving them. According to the current Official State Gazette (BOE), it is mandatory from January 1, 2027 for companies and from July 1, 2027 for everyone else. The Spanish Ministry of Finance announced on October 5, 2026 its intention to postpone it to October 2028, but the change has not yet been published.

Timeline of Verifactu and mandatory B2B e-invoicing in Spain as of November 2026: October 2026, Order HAC/1028/2026 starts the e-invoicing countdown; January 1, 2027, Verifactu for companies; July 1, 2027, Verifactu for everyone else; October 2027, e-invoicing for companies with turnover above €8 million; October 2028, e-invoicing for all other companies and the self-employed, the date to which the Ministry of Finance proposes moving Verifactu
Download chart

With e-invoicing, much of the data will already arrive structured and reading the PDF will matter less. What does not go away is the rest of the work: identifying the order, checking quantities and prices, choosing the general ledger account and handling exceptions. That is why we propose designing the agent to accept both PDFs and e-invoices and putting the effort into checking and recording.

How much it costs to automate invoice processing with AI

  • Off-the-shelf tool (the ERP's own capture modules or specialized accounts payable software): a monthly fee based on invoice volume. It fits if the process is standard.
  • Custom agent pilot on one mailbox and one ERP: €6,000 to €15,000, in 4 to 8 weeks.
  • Agent in production with three-way matching, approval and several suppliers or companies: €15,000 to €40,000.
  • AI model usage: a few cents per invoice. For a few hundred to a few thousand invoices a month, usually €50 to €300 a month.

To find out whether it pays off, count the hours the team spends on each invoice today, including exceptions. In AI agent cost we explain how to do that calculation with an example of 1,000 invoices a month.

Where to start

  • Pull a list of the invoices from the last three months: how many there are, from how many suppliers and how many had exceptions.
  • Choose one mailbox and one type of invoice with volume, for example goods suppliers with a purchase order.
  • Write down the rules and tolerances together with finance.
  • Run a parallel pilot, in which the agent processes the invoices without touching the ERP and its results are compared with what the team did.
  • Move to production with human approval and expand supplier by supplier.

If the ERP has no API for creating invoices or is heavily customized, the integration is part of the project. We handle it like any other custom software development.

$ offing init tu-proyecto

Let AI prepare the invoices and your team decide

Tell us about your idea even if it is not fully defined yet. Talking to us costs nothing and you will speak with the person who will lead the project. If your invoice volume does not justify a custom build, we will tell you and suggest an off-the-shelf tool.

Book a call
// frequently-asked-questions

Frequently asked questions about invoice processing automation with AI

Yes. An AI agent reads the invoice, identifies the supplier and the order, checks amounts and taxes and prepares the entry in the ERP. We propose that a person confirms before posting, at least at the beginning, and that the tax and tolerance rules are programmed.

OCR turns the image into text and needs a template per supplier to know where each piece of data is. An AI model understands the invoice even when the layout changes, recognizes equivalent concepts and can reason about the content, for example by comparing it with the order.

Any that allows records to be created through an API or web services: NetSuite, SAP Business One, Sage, Odoo, Microsoft Dynamics or an in-house ERP. If the ERP has no API, an integration layer or file import is considered.

It reduces the reading work, because the data will arrive structured, but not the matching against orders and delivery notes, the account coding or exception handling. In addition, the obligation arrives in October 2027 or 2028 depending on company size, and many suppliers will take time to adapt.

That is why the system assigns a confidence level to each piece of data, matches the invoice against the order and leaves final approval to a person. Errors are logged and used to adjust rules and instructions.

A custom pilot on one mailbox and one ERP costs between €6,000 and €15,000; an agent in production with matching and approval, between €15,000 and €40,000. Model usage costs a few cents per invoice.

With the business plans or the API of Anthropic or OpenAI, data is not used to train models, and processing can be kept in Europe. It is worth limiting the agent's permissions in the ERP to what is needed and logging every operation.