Skip to content
Constaia

Validate supplier invoices automatically: tax IDs, VAT and totals

What a Spanish invoice must contain under the Invoicing Regulation, which errors can be caught with rules (tax ID check digits, VAT, totals) and how to turn PDF or photo invoices into a spreadsheet with those checks done.

By Constaia team5 min read

Also in: Español

Keying supplier invoices into accounting software is a job almost nobody enjoys. What takes the most time isn't typing, it's finding the invoice that's wrong: a tax ID with the wrong check letter, VAT calculated on the wrong base, a total that doesn't match the lines. If it slips through, it turns up months later in a reconciliation or an audit.

This article covers what an invoice must include under Spanish rules, which errors can be caught with rules rather than judgement, and how to automate it. The checks apply to most European invoices; the legal references are Spanish.

Not tax advice

This is general information. For specific cases (special schemes, intra-EU supplies, corrective invoices) talk to your tax adviser.

What a Spanish invoice must contain

Spain's Invoicing Regulation (Royal Decree 1619/2012) lists the content of a full invoice in article 6. The fields most used when booking it are:

  • Number and, where applicable, series, in sequence.
  • Issue date, and the date of the transaction if different.
  • Name of the issuer and the recipient.
  • Tax ID (NIF) of the issuer and, where the rules require, of the recipient.
  • Address of both.
  • Description of the goods or services, with unit price, discounts and taxable base.
  • The VAT rate or rates applied and the VAT amount, shown separately.
  • Special wording where relevant: exemption, reverse charge, special schemes, self-billing.

Article 7 allows a simplified invoice, with less content, generally when the amount doesn't exceed 400 euros including VAT.

Errors you can catch with rules

Many invoice problems need no interpretation: they can be checked with arithmetic.

Tax ID check characters

A Spanish individual's NIF (DNI or NIE) ends in a letter computed as the number modulo 23 against an official table (Ministry of the Interior). A company's NIF (formerly CIF) carries a control character computed from its digits. A typo or a misread almost always breaks it. Try it with our NIF, NIE and CIF validator, which runs in your browser without sending data.

A valid check character only means the number is well formed, not that the company exists or is registered for intra-EU VAT. For an EU VAT number from another member state, that check is done on VIES, the European Commission's service.

Totals that add up

An invoice has to be consistent with itself:

  • the sum of the lines (with discounts) is the taxable base;
  • each VAT amount is its base times its rate;
  • base + VAT − withholding = total.

Checking this takes milliseconds and catches two different things: a badly made invoice (more common than you'd think) or a misread document. Either way, someone should look before it's booked.

Dates and parties

  • Issue date not in the future, and within the period you're booking.
  • The recipient is your client (or your company), not someone else.
  • The invoice number isn't already booked for that supplier (checked in your own system).

What about Verifactu?

Royal Decree 1007/2023 sets requirements for the software businesses use to issue invoices in Spain (known as Verifactu). Royal Decree-Law 15/2025 postponed the adaptation deadlines to 1 January 2027 for corporate income taxpayers and 1 July 2027 for everyone else.

Verifactu concerns how invoices are issued, not how you check the ones you receive. But it's a good moment to tidy up invoice intake: if you're changing software anyway, what comes in should already be checked.

How Constaia does it

With the invoice type, Constaia reads PDF or photo invoices and extracts number, date, issuer, recipient (name, tax ID and address), lines, base, VAT breakdown, withholding and total. It then runs two deterministic checks:

CheckWhat it looks at
nif_check_digitThe check character of the issuer's and recipient's Spanish tax IDs
invoice_totalsThat lines, base, VAT, withholding and total add up; if not, the message says which amount doesn't match

If one fails, the verdict is invalid with the reason. If the reading isn't reliable (a poor photo, an unreadable field), it's review. Otherwise, valid.

For a single invoice:

curl https://api.constaia.com/v1/analyze \
  -H "Authorization: Bearer $CONSTAIA_API_KEY" \
  -F file=@invoice.pdf \
  -F 'options={"expect":"invoice","export":["xlsx"],"storage":"none","language":"en"}'

For the month's invoices, a batch of up to 100 with one combined spreadsheet, one row per invoice:

curl https://api.constaia.com/v1/batches \
  -H "Authorization: Bearer $CONSTAIA_API_KEY" \
  -F "files[]=@invoice_001.pdf" \
  -F "files[]=@invoice_002.pdf" \
  -F "files[]=@invoice_003.pdf" \
  -F 'options={"expect":"invoice","export":["xlsx"],"metadata":{"month":"2026-09"}}'

If you already know what an invoice should total (from the purchase order, say), add checks.expected_amount and Constaia compares it with the total.

Without code, upload invoices from the dashboard or connect Constaia to Make, Zapier, n8n or Power Automate: the Invoices to Excel guide has the details.

What Constaia does not do:

  • It doesn't ask the tax agency or VIES whether a tax ID exists or is registered.
  • It doesn't decide how to book an invoice or whether an expense is deductible.
  • It doesn't prove an invoice is genuine; for signed PDFs it does verify the electronic signature and flags files modified after signing.

Summary

  • Spain's Invoicing Regulation sets the minimum content of a full invoice (art. 6) and a simplified one (art. 7).
  • Malformed tax IDs and totals that don't add up are caught with rules, no human judgement needed.
  • Automating those checks leaves people with only the invoices that actually need a look.

To try it with a client's invoices, create a free account: 150 documents a month and test keys that don't use credits.

Sources

  1. 01Royal Decree 1619/2012, Invoicing Regulation (BOE, in Spanish)
  2. 02Royal Decree 1007/2023, requirements for invoicing software (BOE, in Spanish)
  3. 03Royal Decree-Law 15/2025, amending the deadlines of Royal Decree 1007/2023 (BOE, in Spanish)
  4. 04Spanish Ministry of the Interior — NIF/NIE check character calculation
  5. 05European Commission — VIES VAT number validation