See llms.txt for all machine-readable content.

Back to Templates

Create and email XRechnung e-invoices using forms, data tables and SMTP

Quick overview

This workflow creates German XRechnung 3.0 (UBL) e-invoices inside n8n, without a paid API, from an n8n Form or a calling workflow. It checks customer and line data in n8n Data Tables, e-mails the XML via SMTP and keeps a register of invoice numbers and their status.

How it works

  1. An n8n Form (for the users the workflow is shared with), a call from another workflow, or a test run with a sample customer starts the workflow.
  2. Invoice settings hold your company data. The data tables xr_customers and xr_invoices are created on the first run.
  3. Each invoice is checked: seller data, IBAN, customer, dates, VAT rates (19 % or 7 %) and every line, exact to the cent. If something is wrong, you get an e-mail saying what to fix, and no number is used.
  4. A new row in xr_invoices gives a unique invoice number. A second invoice for the same order or delivery ID is stopped, also when both arrive at the same moment, and you are told.
  5. The XRechnung 3.0 XML (UBL) is built inside n8n, gets its SHA-256 and goes to the customer by e-mail, with a copy to you (copyToEmail).
  6. xr_invoices keeps every number with its status (sent, send_failed, duplicate). A calling workflow gets one result per invoice: number, order ID, status, reason and whether it was a test.

Setup

  1. Add an SMTP credential to the 4 e-mail nodes.
  2. Replace every example in Invoice settings with your data (company, contact, VAT ID or tax number, IBAN, legalFooter, senderEmail, copyToEmail). Real invoices are refused until then.
  3. Test first: click Execute (test form) or pick Execute workflow (test) in the menu next to it. Runs started in the editor are tests with a TEST number, mailed only to copyToEmail.
  4. Add your customers to the xr_customers data table: customerNumber, name, street, postcode, city, email and buyerReference (unless each invoice brings one).
  5. Publish. Use the form, or call the workflow from your shop, CRM or time-tracking workflow with the JSON shown in its trigger. Pass orderId so a repeated call cannot bill twice, and testRun: true while you build the caller.

Requirements

  • n8n with Data tables (tested on n8n 2.47.7) and an SMTP account. Dates follow Europe/Berlin (set in Workflow settings).

Customization

  • Edit the German e-mail text in Send the invoice (German B2B customers expect German), or add units to UNITS in Check invoice data.

Additional info

In our November 2026 tests every sample passed KoSIT's validator (1.6.3, XRechnung 3.0.2); it does not replace checking the content. Limits: domestic B2B invoices in EUR at 19 % or 7 %; no corrections, credit notes, advance or partial invoices, price discounts, reverse charge, § 19 small businesses or ZUGFeRD PDF, and no approval step. Never delete xr_invoices or its rows: it is your number register. Keep the XML copies for 8 years after the end of the invoice year. Not tax advice; provided as is, without warranty.