Integrationn8nNo-Code

Automatically Validate E-Invoices with n8n

Build an automated invoice validation system with n8n and Invoice-api.xhub. Schema validation, error diagnosis, and automatic escalation -- completely without code.

Automatically Validate E-Invoices with n8n
Patrick Jerominek

Patrick Jerominek

Cofounder & CEO

January 15, 2026
10 min reading time

Automatically Validate E-Invoices with n8n

The e-invoicing mandate 2025 poses challenges for many companies: How do I automatically validate incoming invoices? How do I detect faulty data? And what happens when the automated check finds problems?

In this article, I'll show you how to build an automated validation system with n8n and Invoice-api.xhub that solves exactly these problems -- without writing a single line of code.


The Problem

Imagine you receive dozens of e-invoices from various suppliers every day. Each invoice must be:

  1. Formally validated (XRechnung-compliant, all mandatory fields present)
  2. Substantively checked (amounts are correct, VAT ID valid)
  3. Escalated when problems arise (notify staff)
  4. Archived (GoBD-compliant)

Doing this manually is time-consuming and error-prone. With the Invoice-api.xhub API and n8n, you can fully automate this process.


The Solution: Automated Validation Workflow

Our system uses specialized "agents" -- independent workflows that collaborate:

Loading diagram...

The 4 Agents

AgentTask
CoordinatorReceives requests, routes to specialized agents
Validation AgentChecks invoices against XRechnung/ZUGFeRD schemas
Generation AgentCreates e-invoices from text/JSON
Parsing AgentExtracts data from PDFs/XMLs

What Makes This System Special?

1. Schema Validation with Invoice-api.xhub

The heart of the system is the Validation Agent. It uses the Invoice-api.xhub API for comprehensive checks:

  • Validates against official XRechnung/ZUGFeRD schemas
  • Checks VAT IDs, calculations, mandatory fields
  • Detects format and structural errors
  • Provides detailed error messages with correction hints

The API gives you a clear status:

json
1{
2 "valid": true,
3 "errors": [],
4 "warnings": [],
5 "suggestions": []
6}
FieldDescription
validtrue or false -- validation result
errorsList of errors
warningsWarnings (not critical)
suggestionsImprovement suggestions

2. Human-in-the-Loop

Critical errors are automatically escalated:

  • Slack message to the responsible team member
  • Request ID for tracking
  • Error details and correction suggestions

This keeps humans in control without having to manually review every invoice.

3. Automatic Error Diagnosis

The Error Handler Agent analyzes errors in a structured way:

json
1{
2 "diagnosis": {
3 "rootCause": "VAT ID format invalid",
4 "classification": "validation",
5 "severity": "medium"
6 },
7 "autoFix": {
8 "possible": true,
9 "action": "Correct format"
10 }
11}

For simple errors, the system can even auto-correct.


Step-by-Step Setup

Step 1: Set Up n8n

Start n8n with Docker:

bash
1docker run -it --rm \
2 --name n8n \
3 -p 5678:5678 \
4 -v n8n_data:/home/node/.n8n \
5 n8nio/n8n

Then install the Invoice-api.xhub Community Node:

  1. Settings → Community Nodes
  2. Search: n8n-nodes-invoice-xhub
  3. Install

Step 2: Configure Credentials

Create the following credentials in n8n:

CredentialValue
Invoice-api.xhub APIYour API key (sk_test_... or sk_live_...)
SlackBot Token (optional for escalations)

Step 3: Create the Workflow

The basic workflow has 5 nodes:

text
1Webhook Extract Parameters Invoice-api.xhub Validate Build Response Respond
  1. Webhook: Receives POST requests on /validate-invoice
  2. Set Node: Extracts invoice and countryCode
  3. Invoice-api.xhub Node: Validates the invoice
  4. Code Node: Builds the response
  5. Respond to Webhook: Sends the result back

Step 4: Error Handling & Escalation

Add an IF Node:

  • Condition: {{ $json.validation.valid === false }}
  • True path: Error handling and optionally Slack notification
  • False path: Send response directly

Live Example: Validate an Invoice

Send a test invoice:

bash
1curl -X POST https://service.invoice-api.xhub.io/api/v1/invoice/parse \
2 -H "Content-Type: application/json" \
3 -d '{
4 "countryCode": "DE",
5 "invoice": {
6 "invoiceNumber": "INV-2025-001",
7 "invoiceDate": "2025-01-15",
8 "seller": {
9 "name": "ACME GmbH",
10 "vatId": "DE123456789",
11 "address": {
12 "street": "Hauptstraße 1",
13 "city": "Berlin",
14 "postalCode": "10115",
15 "country": "DE"
16 }
17 },
18 "buyer": {
19 "name": "Customer AG",
20 "vatId": "DE987654321",
21 "address": {
22 "street": "Nebenstraße 2",
23 "city": "München",
24 "postalCode": "80331",
25 "country": "DE"
26 }
27 },
28 "lineItems": [
29 {
30 "description": "Beratung",
31 "quantity": 10,
32 "unit": "HUR",
33 "unitPrice": 150.00,
34 "vatRate": 19
35 }
36 ],
37 "currency": "EUR",
38 "total": 1785.00
39 }
40 }'

Response for a valid invoice:

json
1{
2 "success": true,
3 "validation": {
4 "valid": true,
5 "errors": [],
6 "warnings": [],
7 "suggestions": []
8 }
9}

Response for an invalid invoice:

json
1{
2 "success": true,
3 "validation": {
4 "valid": false,
5 "errors": [
6 {
7 "code": "E001",
8 "message": "VAT ID format invalid",
9 "field": "seller.vatId",
10 "suggestion": "Correct VAT ID format (DE + 9 digits)"
11 }
12 ],
13 "warnings": []
14 },
15 "needsReview": true,
16 "reviewReason": "Validation errors detected - review recommended"
17}

Import the Ready-Made Workflow

Want to get started right away? Import the ready-made workflow:

  1. Download simple-validation-workflow.json
  2. In n8n: Settings → Import Workflow
  3. Select the JSON file
  4. Assign credentials
  5. Activate

The complete multi-agent workflow with all 4 agents is also available.


Advantages of This Architecture

For Developers

  • Modular: Each agent is an independent workflow
  • Extensible: Easily add new agents
  • Testable: Test and debug agents individually

For Companies

  • Reliable: Official schema validation minimizes errors
  • Transparent: Detailed error messages with correction hints
  • Efficient: Only truly problematic cases are escalated

For Compliance

  • Traceable: Every decision is documented
  • Audit-ready: All validations are logged
  • Up-to-date: Automatic schema updates via Invoice-api.xhub

Next Steps

  1. Install n8n and add the community node
  2. Get a free API key at Invoice-api.xhub.io
  3. Work through the tutorial with all details
  4. Go to production and save time

The complete tutorial with all code examples can be found in our documentation.


Conclusion

With n8n and Invoice-api.xhub, you can build a production-ready validation system in just a few hours. The API provides reliable schema validation according to official standards -- fast and deterministic.

Questions? Contact us or try the API directly in the Playground.

Get started now -- the first 100 e-invoices per month are free.

Share article
Patrick Jerominek

Written by

Patrick Jerominek

Cofounder & CEO

Builds APIs that developers love. Writes about e-invoicing, TypeScript, and everything in between.

Ready to master e-invoicing?

Get started in under 5 minutes with Invoice-api.xhub. No credit card required.