Automation MCP Server Blog Pricing
Automation

E-Invoicing in n8n: ZUGFeRD, XRechnung and Factur-X with the Verified InvoiceXML Node

n8n already runs the glue between your billing data and the places invoices have to go. The German and French mandates want structured documents that a PDF node cannot produce: ZUGFeRD and Factur-X hybrids, XRechnung XML with the Leitweg-ID. The verified InvoiceXML node adds them to any workflow: install it from the nodes panel, paste your API key once, map your invoice data with expressions, and the validated file comes back as binary data for Drive, email or your ERP. The same node validates and reads the e-invoices you receive, and works as a tool for n8n's AI Agent.

n8n is where a lot of invoicing automation already lives, and it would rather not move because a mandate arrived. Since January 2025 every German business must accept structured e-invoices, and issuing them becomes mandatory from 2027; France has been live since September 2026; Belgium runs on Peppol. The documents these regimes want (ZUGFeRD and Factur-X hybrids, XRechnung XML, UBL) are not something a PDF node produces, and the usual way to close that gap has been to leave the workflow for a library and a deployment.

It does not need to be. InvoiceXML is a verified n8n node: install it from the nodes panel, add your API key once, and every compliance step becomes a node in the workflow you already run. Behind it, the InvoiceXML API applies the current FeRD, KoSIT and FNFE-MPE rule sets on every call, on their effective dates, so nothing on the n8n side changes when a format revs. This guide builds the two workflows every team ends up needing, issuing and intake, and shows the node as a tool for n8n's AI Agent.


Which operation do you need?

The node has one resource, Invoice, and five operations. Pick by what the workflow has to do:

You need toOperationInputOutput
Invoice German businesses (B2B)Create, format ZUGFeRDInvoice JSONZUGFeRD PDF/A-3
Invoice German public buyers (B2G)Create, format XRechnungInvoice JSON with the Leitweg-IDXRechnung XML
Invoice French customersCreate, format Factur-XInvoice JSONFactur-X PDF/A-3
Invoice across Peppol (Belgium, Netherlands, Nordics)Create, format UBL / Peppol BISInvoice JSONPeppol BIS UBL XML
Check e-invoices you receiveValidatePDF or XML filevalid, counts and every finding
Read a received ZUGFeRD or Factur-X into your toolsExtract DataPDF fileInvoice data as JSON
Deliver in the format the receiver asks forConvertPDF or XML fileThe same invoice in the target format
Let a person read an XRechnung, UBL or CIIRender as PDFXML fileReadable PDF in German, English or French

The invoice data is identical across formats, so a workflow built for ZUGFeRD becomes a Factur-X or XRechnung workflow by changing one dropdown. Every field is described in the create endpoint reference.


Install the node and add your API key

1. Install. In the workflow editor, open the nodes panel, search for InvoiceXML and install the verified node. That works the same on n8n Cloud and on self-hosted instances. On a self-hosted instance, the owner can also install it under Settings, Community nodes, with the package name @invoicexml/n8n-nodes-invoicexml.

2. The credential. Add the InvoiceXML node to a workflow, open the Credential field and create a new InvoiceXML API credential. Paste your API key from Account, Authentication on www.invoicexml.com (after signing up) and save. n8n tests the key on save and shows the connection as working. The key now lives in n8n's encrypted credential store, not in the workflow JSON, so workflows can be exported, versioned and shared without carrying the secret.

3. The operation. Every InvoiceXML node in your workflows reuses that credential. From here on, each step below is one node with an operation and a format.


Workflow 1: ZUGFeRD from a trigger

The issuing workflow, six nodes long:

1. Google Sheets Trigger: row added or updated, status = "Ready"
2. Edit Fields (Set): normalise dates to yyyy-MM-dd, numbers to numbers
3. InvoiceXML: Create, format ZUGFeRD
4. Google Drive: upload the file from binary field "data"
5. Gmail: send message, attachment from binary field "data"
6. Google Sheets: update the row, status = "Issued"

The trigger can be anything that carries invoice data: a Webhook node your billing system posts to, a Postgres or MySQL trigger, a HubSpot deal reaching "Closed won", a Shopify or WooCommerce order, a Stripe payment. The Edit Fields step is worth keeping even when the source looks clean, because the API expects ISO dates and numeric quantities, and spreadsheet cells and webhook payloads are strings more often than they look. One node that sets issueDate to {{ $json.date.toDateTime().format('yyyy-MM-dd') }} and quantity to {{ Number($json.qty) }} removes a whole class of rejections.

In the InvoiceXML node, choose the Create operation and the ZUGFeRD (PDF) format. The Invoice field opens with a complete example invoice that passes every format; replace its values with expressions from the previous node:

{
  "invoiceNumber": "{{ $json.invoiceNumber }}",
  "issueDate":     "{{ $json.issueDate }}",
  "dueDate":       "{{ $json.dueDate }}",
  "currency":      "EUR",
  "seller": {
    "name":          "Your Company GmbH",
    "vatIdentifier": "DE123456789",
    "postalAddress": { "line1": "Musterstraße 1", "postCode": "10115", "city": "Berlin", "country": "DE" }
  },
  "buyer": {
    "name":          "{{ $json.customerName }}",
    "vatIdentifier": "{{ $json.customerVatId }}",
    "postalAddress": {
      "line1":    "{{ $json.customerStreet }}",
      "postCode": "{{ $json.customerPostCode }}",
      "city":     "{{ $json.customerCity }}",
      "country":  "{{ $json.customerCountry }}"
    }
  },
  "paymentDetails": { "paymentAccountIdentifier": "DE02120300000000202051" },
  "lines": [
    {
      "quantity":       {{ $json.quantity }},
      "unitCode":       "HUR",
      "priceDetails":   { "netPrice": {{ $json.unitPrice }} },
      "vatInformation": { "rate": 19, "categoryCode": "S" },
      "item":           { "name": "{{ $json.description }}" }
    }
  ]
}

You do not send totals. The API computes each line's net amount, the VAT breakdown and the document totals from the lines, then validates the result against EN 16931 before returning the file, so a successful node run is a compliant invoice by definition. typeCode defaults to 380 (commercial invoice), the profile is set per format, and an IBAN makes the payment means a credit transfer.

The node puts the ZUGFeRD file in the binary field data, named after the invoice number (INV-2026-0042.pdf), with fileName and format in the item's JSON. That is exactly what the Google Drive, Gmail, Microsoft Outlook, Nextcloud, Dropbox and SFTP nodes read from: for Gmail, set Options, Attachments, Attachment Field Name to data; for Google Drive, the Input Data Field Name is data.


Line items from several rows

Real invoices have several lines, and in n8n those usually arrive as several items: a Lines sheet, an order's line records, an array in a webhook body. Two nodes turn them into the lines array.

First collect the rows of one invoice. A Google Sheets node reading the Lines tab with a filter on the invoice number does it, or an Aggregate node (All Item Data into a single list) after whatever produced the items. Then a Code node builds the whole invoice object:

// Code node, mode "Run Once for All Items"
const header = $('Edit Fields').first().json;
const lines = $input.all().map(({ json: l }) => ({
  quantity:       Number(l.qty),
  unitCode:       l.unit || 'H87',          // H87 = piece, HUR = hour
  priceDetails:   { netPrice: Number(l.unitPrice) },
  vatInformation: { rate: Number(l.vatRate), categoryCode: l.vatRate > 0 ? 'S' : 'Z' },
  item:           { name: l.description }
}));

return [{ json: {
  invoice: {
    invoiceNumber: header.invoiceNumber,
    issueDate:     header.issueDate,
    dueDate:       header.dueDate,
    currency:      'EUR',
    seller:        { /* as above */ },
    buyer: {
      name:          header.customerName,
      vatIdentifier: header.customerVatId,
      postalAddress: { line1: header.customerStreet, postCode: header.customerPostCode, city: header.customerCity, country: header.customerCountry }
    },
    paymentDetails: { paymentAccountIdentifier: 'DE02120300000000202051' },
    lines
  }
} }];

In the InvoiceXML node, the Invoice field becomes the expression {{ $json.invoice }}. The category codes matter to the rule set: S for standard VAT, AE for reverse charge, E exempt, K intra-Community, Z zero rated. The API groups lines by category and rate into the EN 16931 VAT breakdown and resolves exemption reason codes from the category, which is the part of the standard most hand-built workflows get wrong.


XRechnung and the Leitweg-ID

Invoicing a German federal, state or municipal buyer means XRechnung rather than ZUGFeRD: pure XML, validated by portals such as ZRE and OZG-RE against the KoSIT rules. In the InvoiceXML node, switch the format to XRechnung (XML), and give the invoice the buyer's Leitweg-ID:

"buyerReference": "{{ $json.leitwegId }}",
"seller": {
  "name": "Your Company GmbH",
  "electronicAddress": { "identifier": "[email protected]", "schemeId": "EM" },
  "contact": { "name": "Accounts", "phone": "+49 30 1234567", "email": "[email protected]" },
  ...
}

The Leitweg-ID is assigned by the public buyer during onboarding and appears on no source document, so it earns its own field on the customer record your trigger reads (as text: Leitweg-IDs carry leading zeros and dashes). Rule BR-DE-15 rejects the document without it, and the German rules also require a seller contact with name, phone and email, which is why the snippet adds them. The node returns an .xml file in the same data field.

Pure XML gives an approver nothing to look at. For a review step, add a second InvoiceXML node with Render as PDF and PDF Language German. It reads the XML from data and returns a readable PDF, suitable for an approval email or a Slack message before the XML goes to the portal. The full B2G treatment is in the XRechnung integration guide.


Factur-X and your own PDF

For French customers the format becomes Factur-X (PDF) and nothing else changes; ZUGFeRD and Factur-X are the same standard with different branding in the PDF metadata. The same invoice data produces a conformant Factur-X PDF/A-3 with the EN 16931 profile, validated before delivery.

Many teams already render a branded PDF elsewhere and want to keep its design. The API's embed endpoints take care of that, called from n8n's HTTP Request node with a Header Auth credential (Name Authorization, Value Bearer followed by your API key): POST https://api.invoicexml.com/v1/embed/zugferd or /v1/embed/facturx, Body Content Type Form-Data, and two parameters of type n8n Binary File, pdf for your PDF and xml for your CII XML (from a Create node with the CII format). Set the response format to File. The XML is validated against the current rules before embedding, and the response is the PDF/A-3 hybrid with correct XMP metadata and your layout untouched. The embed guide covers that last-mile step in depth.


Workflow 2: validating received e-invoices

Reception is the half of the German mandate that is already live for everyone, and n8n's email triggers make it a short workflow:

1. Gmail Trigger or IMAP Email Trigger (Download Attachments: on)
2. InvoiceXML: Validate, format ZUGFeRD, Input Binary Field "attachment_0"
3. If: {{ $json.valid }} is true
   true:  create the bill in your accounting tool, archive the file
   false: Slack or email to AP with {{ $json.errors.map(e => e.rule + ': ' + e.message).join('\n') }}

With Download Attachments on, the trigger puts each attachment in a binary field named attachment_0, attachment_1 and so on, and the InvoiceXML node reads whichever field you name. Route PDF attachments to the ZUGFeRD or Factur-X format and XML attachments to XRechnung, UBL or CII; a Switch node on the attachment's MIME type does the routing.

The node returns valid, errorCount, warningCount, and the errors and warnings arrays, each finding with its rule id, a plain-language message and the line in the XML. That is enough to tell a supplier precisely what to fix, and enough for an If node to decide whether the document is allowed into your books.


Reading received e-invoices into your tools

The same trigger with an InvoiceXML node set to Extract Data turns a received ZUGFeRD or Factur-X PDF into structured invoice data: number, dates, seller, buyer, totals and lines as JSON fields that the next node maps to a row in Google Sheets or Airtable, a bill in your accounting tool, or a record in your ERP. The read is deterministic: what the supplier declared in the embedded XML is exactly what lands in the row.

When a supplier sends a format your system does not read, Convert turns it into one it does: UBL to CII, XRechnung to ZUGFeRD, Factur-X to UBL and every other pair between XRechnung, ZUGFeRD, Factur-X, UBL and CII. The converted file arrives in data, ready for the next node.


E-invoices from an AI agent

The InvoiceXML node is also a tool for n8n's AI Agent. Add a chat trigger and an AI Agent node with the chat model of your choice, then attach InvoiceXML under the agent's Tool connection and configure its operation and format, for example Create with XRechnung. Ask the agent to "create an XRechnung test invoice" and it calls the tool, gets the validated file back and reports the result. The same works for Validate and Convert, so an agent that handles supplier mail can check every attachment before it answers.

For agents outside n8n, such as Claude, ChatGPT or Cursor, the InvoiceXML MCP server offers the same operations over the Model Context Protocol.


Errors and retries

When the API rejects an invoice, the node fails with the API's message and lists every violated EN 16931, KoSIT or FeRD rule with the field it concerns, right in the n8n error panel. Two settings on the node's Settings tab decide what happens next.

On Error. Set it to Continue (using error output). A rejected invoice now leaves through the node's error output with the message attached, instead of stopping the whole execution. Connect a Slack, email or Sheets node there to report which field to fix. Keep validation failures on that path: retrying unchanged data reproduces them.

Retry On Fail. Enable it with Max Tries 3 and Wait Between Tries of at least 10000 ms, for the transient cases such as a network blip. A rejected request was never processed, so a retry can never create a duplicate document.

The node processes the items of a run one after another, so a month-end run of a few hundred invoices needs no batching settings.


n8n Cloud or self-hosted

Everything above is identical on n8n Cloud and on a self-hosted instance. The one operational point is the credential: keep the API key in n8n's credential store, never as a literal in a workflow's JSON.

On the API side, nothing from your workflow is retained: documents are processed in memory in Frankfurt, Germany, and discarded when the response is returned, with no AI training on your data. A self-hosted n8n in your own data centre plus this API therefore keeps invoice data (VAT numbers, IBANs, customer relationships) inside your infrastructure and a stateless EU processor, which is the setup most German data protection reviews want to see. Formats and rule sets move on regulators' calendars, and the API is current with every FeRD, KoSIT and FNFE-MPE release on its effective date, so the workflow you build today does not age when XRechnung revs.


Get started

Start a free trial, no credit card needed, copy the API key into an InvoiceXML API credential, add the InvoiceXML node to the workflow that already carries your invoice data, and the first validated ZUGFeRD can be in your Drive within the next ten minutes. The node's listing is at n8n.io/integrations/invoicexml.

Related resources:


InvoiceXML is a REST API for European e-invoice compliance covering ZUGFeRD, XRechnung, Factur-X, Peppol UBL and CII, available in n8n as a verified node. Stateless processing in Frankfurt, zero data retention, and the current official rule sets applied on every call.

Start free today

Ready to automate your invoices?

Validate, convert and embed compliant e-invoices through one API. Start your 30-day free trial. No credit card required.

GDPR Compliant No credit card required Setup in minutes
Peppol UBL
Factur-X
EN 16931
142 / 142 passed
Compliant
PDF/A-3 embedded