E-invoicing
Render EN 16931 e-invoices from one invoice payload, as ZUGFeRD and Factur-X PDFs or as XRechnung and Peppol BIS XML.
Druckling produces EN 16931 e-invoices from the same API call that renders any other document. You send the invoice data in data.invoice. Druckling computes the line totals, the VAT breakdown and the amount due, checks the business rules, and returns either a PDF/A-3 with the XML embedded or the XML on its own. The template decides which.
This guide covers choosing a format, setting up a template, the invoice payload field by field, what Druckling calculates for you, and how rule violations come back.
Choose a format
An e-invoice template has one output format. All three are built from the same invoice payload, so you can switch a template between them without changing your integration's data.
| Format | What you get | XML syntax | Use it for |
|---|---|---|---|
| Factur-X 1.0 / ZUGFeRD 2.x | A PDF/A-3 people can read, with the invoice XML embedded as factur-x.xml | UN/CEFACT CII D16B | B2B invoices in Germany (ZUGFeRD) and France (Factur-X), where the buyer accepts a hybrid PDF |
| XRechnung 3.0 | The XML on its own | UBL 2.1 (default) or UN/CEFACT CII D16B | German public-sector buyers, who identify themselves with a Leitweg-ID |
| Peppol BIS Billing 3.0 | The XML on its own | UBL 2.1 | Exchange over the Peppol network (Belgium, the Netherlands, the Nordics and more) |
Each format writes its specification identifier (BT-24) into the XML, and the document resource reports it back:
| Format | einvoice.profile | einvoice.customization_id (BT-24) | Business process (BT-23) |
|---|---|---|---|
| Factur-X / ZUGFeRD | EN 16931 | urn:cen.eu:en16931:2017 | Not written |
| XRechnung | XRechnung 3.0 | urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0 | urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 |
| Peppol BIS | Peppol BIS Billing 3.0 | urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0 | urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 |
Factur-X and ZUGFeRD invoices are always produced at the EN 16931 profile (called COMFORT in older ZUGFeRD versions). The MINIMUM, BASIC WL, BASIC and EXTENDED profiles aren't available.
Druckling creates the file, you deliver it
Druckling generates the invoice file and returns a download link. It doesn't transmit invoices. To send a Peppol BIS invoice over the Peppol network, hand the XML to your Peppol access point; for French e-invoicing platforms or German public-sector portals, upload it the way they require.
Set up an e-invoice template
Start from a starter or an existing template
The quickest start is a starter: in the dashboard, go to Templates › New template and pick Rechnung (ZUGFeRD) (German, with the §14 UStG details and a GiroCode payment QR) or Facture (Factur-X) (French, with the mandatory mentions as invoice notes). Both come with the invoice variables, a layout with a VAT breakdown, PDF/A-3b and a sample invoice that passes the rules.
To turn an existing template into an e-invoice, open it with Open editor, select the Document tab in the right-hand panel and, under Output, switch on E-invoice (EN 16931).
Choose the e-invoice format
Under Output › E-invoice format, choose Factur-X / ZUGFeRD (PDF), XRechnung (XML) or Peppol BIS Billing 3.0 (XML). For XRechnung, also pick a Syntax: UBL 2.1 or UN/CEFACT CII. Both are valid XRechnung.
Turning e-invoicing on, or changing the format, sets up what the format needs:
- It declares the canonical
invoice.*variables, including the amounts Druckling computes. - For Factur-X, it sets PDF standard to PDF/A-3b if the template had something else. Factur-X only allows PDF/A-3b or PDF/A-3a, the PDF/A parts that permit embedded files. Choose PDF/A-3a for an accessible invoice (see Accessible PDFs).
- If the sample data doesn't pass the new format's rules, it's replaced with a sample invoice that does.
XRechnung and Peppol templates render XML only. Their layout is used for the editor preview; the PDF standard setting has no effect on them.
Bind the layout to the invoice
Bind your blocks to invoice.* paths, for example {{invoice.number}}, {{invoice.seller.name}}, a table over invoice.lines and another over invoice.vat_breakdown. Use the computed amounts (invoice.totals.grand_total, line.net_amount) instead of calculating totals yourself, so the visible PDF shows exactly the numbers in the XML. Show VAT rates with {{line.vat_rate | number:0-2}} to print 19 and 5.5 without trailing zeros.
Variables outside invoice work as in any template, for example a logo_url or a marketing message. A variable you declare under invoice. that isn't part of the invoice model gets a warning in the editor: it's neither validated nor written to the XML.
Publish
Publishing checks the sample invoice against the same rules as an API request, so a template can't go live with a sample that would be rejected. Problems show in the status menu above the canvas while you edit.
Render an e-invoice
Send the invoice in data.invoice to POST /v1/documents. This request is valid for a Factur-X template created from the Rechnung (ZUGFeRD) starter; replace rechnung with your template's slug.
{
"template": "rechnung",
"filename": "RE-2026-0042.pdf",
"data": {
"invoice": {
"number": "RE-2026-0042",
"type_code": "380",
"issue_date": "2026-10-20",
"currency": "EUR",
"order_reference": "PO-7781",
"delivery_date": "2026-10-15",
"seller": {
"name": "Acme Studio GmbH",
"legal_id": "HRB 123456 B",
"legal_info": "Amtsgericht Berlin-Charlottenburg HRB 123456 B · Managing director: Ada Weber",
"vat_id": "DE123456789",
"tax_number": "37/123/45678",
"address": { "line1": "Lindenstraße 12", "postcode": "10969", "city": "Berlin", "country": "DE" },
"electronic_address": "billing@acme-studio.example",
"contact": { "name": "Ada Weber", "phone": "+49 30 1234567", "email": "billing@acme-studio.example" }
},
"buyer": {
"name": "Northwind Handels AG",
"id": "K-1001",
"address": { "line1": "Hafenweg 3", "postcode": "20457", "city": "Hamburg", "country": "DE" },
"electronic_address": "purchasing@northwind.example"
},
"lines": [
{ "id": "1", "name": "Brand identity, phase 2", "quantity": 1, "unit_code": "C62", "net_price": 4800, "vat_category": "S", "vat_rate": 19 },
{ "id": "2", "name": "Design system audit", "quantity": 12, "unit_code": "HUR", "net_price": 180, "vat_category": "S", "vat_rate": 19 },
{ "id": "3", "name": "Book: Typography on the web", "quantity": 2, "unit_code": "H87", "net_price": 39.9, "vat_category": "S", "vat_rate": 7 }
],
"allowances_charges": [
{ "kind": "allowance", "amount": 100, "reason": "Loyalty discount", "reason_code": "95", "vat_category": "S", "vat_rate": 19 }
],
"payment": {
"terms": "Payable within 30 days without deduction.",
"due_date": "2026-11-19",
"reference": "RE-2026-0042",
"means_code": "58",
"iban": "DE02120300000000202051",
"bic": "BYLADEM1001",
"account_name": "Acme Studio GmbH"
}
}
}
}curl https://druckling-nine.vercel.app/v1/documents \
-H "Authorization: Bearer $DRUCKLING_API_KEY" \
-H "Content-Type: application/json" \
--data @request.jsonThe response is a document with an einvoice object:
{
"id": "pdf_8Qw2kLm3nP0aB1cD",
"object": "document",
"status": "rendered",
"template": "rechnung",
"version": 1,
"filename": "RE-2026-0042.pdf",
"format": "pdf",
"content_type": "application/pdf",
"image": null,
"pages": 1,
"size_bytes": 48211,
"url": "https://…",
"expires_at": "2026-11-19T09:14:03.000Z",
"error": null,
"einvoice": {
"format": "factur-x",
"syntax": "cii",
"profile": "EN 16931",
"customization_id": "urn:cen.eu:en16931:2017",
"attachment": "factur-x.xml"
},
"batch": null,
"language": "de",
"test_mode": true,
"created_at": "2026-10-20T09:14:02.000Z"
}The PDF is a PDF/A-3 with factur-x.xml attached (relationship Alternative, MIME type text/xml) and the Factur-X XMP metadata that readers look for: document type INVOICE, version 1.0, conformance level EN 16931.
The payload is validated before anything is rendered or queued. With async: true a valid invoice comes back with status queued, but an invalid one still fails right away with a 422, just like a synchronous request.
The invoice payload
data.invoice is an EN 16931 invoice in snake_case. Amounts are decimal numbers in the invoice currency, dates are YYYY-MM-DD strings and codes are strings, even when they look like numbers ("380", "58").
The JSON Schema returned by GET /v1/templates/{slug} describes the same object, with each field's business term (BT) in its description. Fields you send that aren't part of the model are accepted, but they aren't validated and never reach the XML.
The tables list required fields as EN 16931 requires them. XRechnung and Peppol make more fields mandatory; those appear under Business rules and in the required column as "XRechnung" or "Peppol".
Invoice
| Field | Type | Required | BT | Description |
|---|---|---|---|---|
number | string | Yes | BT-1 | Invoice number |
type_code | string | No | BT-3 | 380 invoice (default), 381 credit note, 384 corrected invoice, 389 self-billed invoice, 326 partial invoice, 875 partial construction invoice, 876 partial final construction invoice, 877 final construction invoice |
issue_date | date | Yes | BT-2 | Issue date |
currency | string | Yes | BT-5 | ISO 4217 code in capitals, e.g. EUR |
buyer_reference | string | XRechnung | BT-10 | Buyer reference. For German public buyers, their Leitweg-ID |
order_reference | string | No | BT-13 | Purchase order reference |
preceding_invoice | string | No | BT-25 | Invoice a credit note or correction refers to |
preceding_invoice_date | date | No | BT-26 | Issue date of the preceding invoice |
delivery_date | date | No | BT-72 | Date of supply or service |
billing_period.start | date | No | BT-73 | Service period start |
billing_period.end | date | No | BT-74 | Service period end |
notes | array | No | BG-1 | Invoice notes, see Notes and delivery |
seller | object | Yes | See Seller and buyer | |
buyer | object | Yes | See Seller and buyer | |
delivery | object | No | Deliver-to party, see Notes and delivery | |
lines | array | Yes | BG-25 | Invoice lines, see Lines |
allowances_charges | array | No | BG-20, BG-21 | Document-level allowances and charges, see Allowances and charges |
vat_exemptions | array | No | Exemption reasons per VAT category, see VAT categories | |
payment | object | No | Payment terms and instructions, see Payment | |
prepaid_amount | number | No | BT-113 | Amount already paid, at most 2 decimals |
Seller and buyer
seller and buyer share one shape. Where the business terms differ, the table shows the seller's first.
| Field | Type | Required | BT (seller / buyer) | Description |
|---|---|---|---|---|
name | string | Yes | BT-27 / BT-44 | Legal name |
trading_name | string | No | BT-28 / BT-45 | Trading name, if different |
id | string | No | BT-29 / BT-46 | Seller identifier; for the buyer, your customer number |
legal_id | string | No | BT-30 / BT-47 | Legal registration, e.g. HRB 123456 B or a SIREN |
legal_id_scheme | string | No | ISO 6523 scheme of legal_id, e.g. 0002 for SIREN, 0208 for a Belgian enterprise number | |
legal_info | string | No | BT-33 (seller only) | Additional legal information, e.g. register court and share capital |
tax_number | string | No | BT-32 (seller only) | National tax number (Steuernummer) |
vat_id | string | No | BT-31 / BT-48 | VAT identifier with its country prefix, e.g. DE123456789 |
address | object | Yes | See the address table below | |
electronic_address | string | XRechnung, Peppol | BT-34 / BT-49 | E-mail address, Leitweg-ID or Peppol participant identifier |
electronic_address_scheme | string | Peppol | EAS code of electronic_address. Default EM (e-mail), which Peppol doesn't accept. Common codes: 0204 Leitweg-ID, 9930 German VAT number, 0208 Belgian enterprise number, 0088 GLN | |
contact.name | string | XRechnung (seller) | BT-41 / BT-56 | Contact person or department |
contact.phone | string | XRechnung (seller) | BT-42 / BT-57 | Contact phone |
contact.email | string | XRechnung (seller) | BT-43 / BT-58 | Contact e-mail |
The address object:
| Field | Type | Required | BT (seller / buyer) | Description |
|---|---|---|---|---|
line1 | string | No | BT-35 / BT-50 | Street and number |
line2 | string | No | BT-36 / BT-51 | Address line 2 |
line3 | string | No | BT-162 / BT-163 | Address line 3 |
postcode | string | XRechnung | BT-38 / BT-53 | Post code |
city | string | XRechnung | BT-37 / BT-52 | City |
region | string | No | BT-39 / BT-54 | Region or state |
country | string | Yes | BT-40 / BT-55 | ISO 3166-1 alpha-2 code in capitals, e.g. DE |
Lines
Each item of lines is one invoice line.
| Field | Type | Required | BT | Description |
|---|---|---|---|---|
id | string | No | BT-126 | Line number. Defaults to the line's position ("1", "2", …) |
name | string | Yes | BT-153 | Item name |
description | string | No | BT-154 | Item description |
seller_item_id | string | No | BT-155 | Your item number |
note | string | No | BT-127 | Line note |
quantity | number | Yes | BT-129 | Invoiced quantity |
unit_code | string | Yes | BT-130 | UN/ECE Recommendation 20 unit, 2 or 3 capitals or digits: C62 one, H87 piece, HUR hour, DAY day |
net_price | number | Yes | BT-146 | Net unit price. Can't be negative |
price_base_quantity | number | No | BT-149 | Quantity the price refers to. Default 1, must be positive |
vat_category | string | Yes | BT-151 | VAT category code, see VAT categories |
vat_rate | number | No | BT-152 | VAT rate in percent, e.g. 19 or 5.5. Unset counts as 0 |
Allowances and charges
Document-level discounts and surcharges go in allowances_charges. Each one belongs to a VAT category and rate, and Druckling subtracts or adds it in that group of the VAT breakdown.
| Field | Type | Required | BT (allowance / charge) | Description |
|---|---|---|---|---|
kind | string | Yes | allowance or charge | |
amount | number | Yes | BT-92 / BT-99 | Positive amount, at most 2 decimals |
reason | string | One of the two | BT-97 / BT-104 | Reason text |
reason_code | string | One of the two | BT-98 / BT-105 | Reason code: UNCL 5189 for allowances (e.g. 95 discount), UNCL 7161 for charges (e.g. FC freight) |
vat_category | string | Yes | BT-95 / BT-102 | VAT category code |
vat_rate | number | No | BT-96 / BT-103 | VAT rate in percent |
VAT categories
vat_category takes a UNCL 5305 code. Some categories need a reason in vat_exemptions, an array with one entry per category:
| Field | Type | Required | BT | Description |
|---|---|---|---|---|
category | string | Yes | The VAT category the reason applies to | |
reason | string | One of the two | BT-120 | Exemption reason text, printed in the VAT breakdown |
code | string | One of the two | BT-121 | Exemption reason code, e.g. VATEX-EU-AE |
| Code | Meaning | Rate | Also needs |
|---|---|---|---|
S | Standard rate | Above 0 | Seller VAT ID or tax number |
Z | Zero rated | 0 | Seller VAT ID or tax number. No exemption reason |
E | Exempt from VAT | 0 | Seller VAT ID or tax number, exemption reason |
AE | Reverse charge | 0 | Seller VAT ID or tax number, buyer VAT ID (or legal ID), exemption reason |
K | Intra-community supply | 0 | Seller and buyer VAT IDs, a delivery date or billing period, the deliver-to country, exemption reason |
G | Export outside the EU | 0 | Seller VAT ID, exemption reason |
O | Not subject to VAT | None, any rate is ignored | No VAT IDs on either party, exemption reason |
L | Canary Islands (IGIC) | Above 0 | Seller VAT ID or tax number |
M | Ceuta and Melilla (IPSI) | Above 0 | Seller VAT ID or tax number |
Payment
| Field | Type | Required | BT | Description |
|---|---|---|---|---|
terms | string | See below | BT-20 | Payment terms |
due_date | date | See below | BT-9 | Due date |
reference | string | No | BT-83 | Remittance information, e.g. the invoice number |
means_code | string | XRechnung | BT-81 | UNCL 4461 payment means: 58 SEPA credit transfer, 59 SEPA direct debit, 30 credit transfer, 49 direct debit, 48 bank card, 10 cash, 57 standing agreement, ZZZ mutually defined |
iban | string | For 30 and 58 | BT-84 | Payee IBAN |
bic | string | No | BT-86 | Payee BIC |
account_name | string | No | BT-85 | Payee account name |
mandate_id | string | For 59 in XRechnung, 49 and 59 in Peppol | BT-89 | Direct debit mandate reference |
creditor_id | string | For 59 in XRechnung | BT-90 | Your SEPA creditor identifier |
debited_account | string | For 59 in XRechnung | BT-91 | The buyer's IBAN to debit |
When an amount is due, the invoice needs a due_date or terms (BR-CO-25).
Notes and delivery
| Field | Type | Required | BT | Description |
|---|---|---|---|---|
notes[].text | string | Yes | BT-22 | Note text |
notes[].subject_code | string | No | BT-21 | UNTDID 4451 subject, e.g. AAB, PMT, PMD, REG, AAI |
delivery.name | string | No | BT-70 | Deliver-to party name |
delivery.address.line1 | string | No | BT-75 | Deliver-to street |
delivery.address.postcode | string | No | BT-78 | Deliver-to post code |
delivery.address.city | string | No | BT-77 | Deliver-to city |
delivery.address.country | string | No | BT-80 | Deliver-to country code. The deliver-to address is only written to the XML when it's set |
What Druckling computes
Don't send totals. Druckling calculates them from the lines, allowances and charges, writes them to the XML and makes them available to the template, so the PDF and the XML always agree.
| Computed field | BT | How it's calculated |
|---|---|---|
lines[].net_amount | BT-131 | quantity × net_price ÷ price_base_quantity, rounded to cents |
allowances_charges[].signed_amount | The amount, negative for allowances (handy in a table) | |
vat_breakdown[] | BG-23 | One entry per VAT category and rate: category (BT-118), rate (BT-119), basis (BT-116), tax (BT-117), exemption_reason (BT-120) |
totals.line_total | BT-106 | Sum of line net amounts |
totals.allowance_total | BT-107 | Sum of allowances |
totals.charge_total | BT-108 | Sum of charges |
totals.tax_basis_total | BT-109 | Line total − allowances + charges |
totals.tax_total | BT-110 | Sum of the breakdown's VAT amounts |
totals.grand_total | BT-112 | Total without VAT + total VAT |
totals.prepaid | BT-113 | prepaid_amount, or 0 |
totals.due_payable | BT-115 | Grand total − prepaid |
How the arithmetic works:
- VAT is calculated once per group. Each VAT breakdown entry adds the line net amounts of its category and rate, subtracts its allowances and adds its charges; the VAT is that basis × rate, rounded once. Druckling never rounds VAT per line, as EN 16931 requires.
- Exact decimals. Amounts are calculated in fixed-point decimals, not floating point, and rounded half away from zero to cents. Three items at
0.335make1.01, not1.00. - Precision of your inputs. Quantities and prices can have more than two decimals. Allowance and charge amounts and
prepaid_amountcan have at most two (BR-DEC-01, BR-DEC-16). - Anything you send is overwritten. If your payload contains
totals,vat_breakdownorlines[].net_amount, Druckling replaces them with its own values.
For the request above, the template sees:
{
"totals": {
"line_total": 7039.8,
"allowance_total": 100,
"charge_total": 0,
"tax_basis_total": 6939.8,
"tax_total": 1308.99,
"grand_total": 8248.79,
"prepaid": 0,
"due_payable": 8248.79
},
"vat_breakdown": [
{ "category": "S", "rate": 7, "basis": 79.8, "tax": 5.59, "exemption_reason": "" },
{ "category": "S", "rate": 19, "basis": 6860, "tax": 1303.4, "exemption_reason": "" }
]
}The loyalty discount of 100 sits in the 19% group, so its basis is 4,800 + 2,160 − 100 = 6,860. In an e-invoice template, the money filter uses the invoice's currency, not the template's currency setting.
Business rules
Before rendering, Druckling checks the payload in two steps:
- Shape, against the template's JSON Schema: required fields, types, date and code formats. A problem answers 422 with code
schema_validation_failed. - Business rules, the cross-field rules of EN 16931 and of the format's CIUS. A broken rule answers 422 with code
validation_failed. The message ends with the rule's ID in parentheses andfieldpoints at the offending value.
Both come back in the same error format. data.errors lists every problem found, each with its field and message, and rule for business rules. The failed attempt is recorded as a failed document; data.documentId is its ID.
For example, an XRechnung invoice without a buyer reference:
{
"defined": false,
"code": "UNPROCESSABLE_CONTENT",
"status": 422,
"message": "The buyer reference is required (for public buyers: their Leitweg-ID) (BR-DE-15)",
"data": {
"code": "validation_failed",
"field": "invoice.buyer_reference",
"documentId": "pdf_3Hk9QmZ1xT7pLw2V",
"errors": [
{
"field": "invoice.buyer_reference",
"message": "The buyer reference is required (for public buyers: their Leitweg-ID) (BR-DE-15)",
"rule": "BR-DE-15"
}
]
}
}A reverse-charge line without the buyer's VAT ID and exemption reason reports both rules:
"errors": [
{ "field": "invoice.buyer.vat_id", "message": "Reverse charge needs the buyer's VAT identifier (BR-AE-02)", "rule": "BR-AE-02" },
{ "field": "invoice.lines.0.vat_category", "message": "VAT category AE needs an exemption reason or code in vat_exemptions (BR-AE-10)", "rule": "BR-AE-10" }
]The SDKs raise these as validation errors, with every rule in errors:
import Druckling, { ValidationError } from "@druckling/sdk";
const druckling = new Druckling();
try {
await druckling.documents.create({ template: "xrechnung", data: { invoice } });
} catch (error) {
if (!(error instanceof ValidationError)) throw error;
for (const problem of error.errors) {
console.log(problem.rule, problem.field, problem.message);
}
}The editor runs the same checks on your sample data and shows broken rules in the preview, for example E-invoice: A seller contact point (name or department) is required (BR-DE-5).
What the checks cover
Druckling checks the rules that depend on your data. Rules about the XML's structure are guaranteed by the generator. This isn't a full run of the official schematron: if a recipient requires certified validation, check a sample with the validator they name, such as the KoSIT validator for XRechnung or the Peppol BIS validation artifacts.
EN 16931 rules
These apply to every format.
| Rule | Field | Checks |
|---|---|---|
BR-DATE | any date | The date exists in the calendar (2026-02-30 fails). A Druckling check, not an EN 16931 rule ID |
BR-29 | billing_period.end | The billing period doesn't end before it starts |
BR-CO-26 | seller.vat_id | The seller has an id, legal_id or vat_id |
BR-CO-09 | seller.vat_id, buyer.vat_id | VAT IDs start with a two-letter country prefix |
BR-27 | lines.n.net_price | The net price isn't negative |
BR-DEC | lines.n.price_base_quantity | The base quantity is positive. A Druckling check |
BR-DEC-01 | allowances_charges.n.amount | Positive, at most 2 decimals |
BR-33, BR-38 | allowances_charges.n.reason | Each allowance (BR-33) or charge (BR-38) has a reason or reason_code |
BR-DEC-16 | prepaid_amount | At most 2 decimals |
BR-S-05, BR-L-05, BR-M-05 | ….vat_rate | Categories S, L and M have a rate above 0 |
BR-Z-05, BR-E-05, BR-AE-05, BR-IC-05, BR-G-05 | ….vat_rate | Categories Z, E, AE, K and G have rate 0 |
BR-S-02, BR-Z-02, BR-E-02, BR-L-02, BR-M-02 | seller.vat_id | These categories need the seller's VAT ID or tax number |
BR-AE-02 | seller.vat_id, buyer.vat_id | Reverse charge needs the seller's VAT ID or tax number and the buyer's VAT ID or legal ID |
BR-IC-02 | seller.vat_id, buyer.vat_id | Intra-community supply needs both VAT IDs |
BR-IC-11 | delivery_date | Intra-community supply needs a delivery date or billing period start |
BR-IC-12 | delivery.address.country | Intra-community supply needs the deliver-to country |
BR-G-02 | seller.vat_id | Export needs the seller's VAT ID |
BR-O-02 | seller.vat_id or buyer.vat_id | An invoice not subject to VAT carries no VAT IDs |
BR-E-10, BR-AE-10, BR-IC-10, BR-G-10, BR-O-10 | lines.n.vat_category | Categories E, AE, K, G and O have a reason or code in vat_exemptions |
BR-S-10, BR-Z-10 | vat_exemptions.n | Categories S and Z have no exemption reason |
BR-CO-25 | payment.due_date | An amount due has a due date or payment terms |
BR-61 | payment.iban | Credit transfers (30, 58) have the payee's IBAN |
XRechnung rules
XRechnung adds the German CIUS rules (BR-DE) and the electronic addresses it made mandatory.
| Rule | Field | Checks |
|---|---|---|
PEPPOL-EN16931-R020 | seller.electronic_address | The seller has an electronic address |
PEPPOL-EN16931-R010 | buyer.electronic_address | The buyer has an electronic address |
BR-CL-25 | ….electronic_address_scheme | The scheme is on the CEF EAS code list (EM when unset is fine) |
BR-DE-1 | payment.means_code | Payment instructions are given: set the payment means code |
BR-DE-3, BR-DE-4 | seller.address.city, seller.address.postcode | The seller's city and post code |
BR-DE-5, BR-DE-6, BR-DE-7 | seller.contact.name, .phone, .email | A seller contact with name, phone and e-mail |
BR-DE-8, BR-DE-9 | buyer.address.city, buyer.address.postcode | The buyer's city and post code |
BR-DE-10, BR-DE-11 | delivery.address.city, .postcode | A deliver-to address with a country also has a city and post code |
BR-DE-15 | buyer_reference | A buyer reference (the Leitweg-ID for public buyers) |
BR-DE-18 | payment.terms | Skonto lines read like #SKONTO#TAGE=14#PROZENT=2.00#, in capitals, each followed by a line break |
BR-DE-23-b | payment.mandate_id or payment.debited_account | A credit transfer (30, 58) carries no direct debit details |
BR-DE-24-a | payment.means_code | Card payments (48) aren't supported: use 30, 58 or 59 |
BR-DE-25-a | payment.mandate_id | A SEPA direct debit (59) has the mandate reference |
BR-DE-25-b | payment.iban | A SEPA direct debit has no payee IBAN: send the buyer's IBAN as debited_account |
BR-DE-30 | payment.creditor_id | A SEPA direct debit has your creditor identifier |
BR-DE-31 | payment.debited_account | A SEPA direct debit has the IBAN to debit |
Peppol BIS rules
| Rule | Field | Checks |
|---|---|---|
PEPPOL-EN16931-R020, PEPPOL-EN16931-R010 | seller.electronic_address, buyer.electronic_address | Both parties have an electronic address (their Peppol participant ID) |
PEPPOL-EN16931-CL008 | ….electronic_address_scheme | The scheme is set and on the Peppol EAS code list. EM (e-mail) isn't |
PEPPOL-COMMON-R040 | ….electronic_address, ….legal_id | Scheme 0088: a GLN with a valid GS1 check digit |
PEPPOL-COMMON-R041 | same | Scheme 0192: a 9-digit Norwegian organisation number |
PEPPOL-COMMON-R042 | same | Scheme 0184: a Danish CVR number (8 digits, optionally prefixed DK) |
PEPPOL-COMMON-R043 | same | Scheme 0208: a 10-digit Belgian enterprise number with valid check digits |
PEPPOL-COMMON-R049 | same | Scheme 0007: a 10-digit Swedish organisation number |
PEPPOL-COMMON-R050 | same | Scheme 0151: an 11-digit Australian Business Number |
PEPPOL-EN16931-R003 | buyer_reference | A buyer reference or a purchase order reference |
PEPPOL-EN16931-R002 | notes.1 | At most one note, unless both parties are in Germany |
PEPPOL-EN16931-P0100 | type_code | The type is part of Peppol BIS Billing: 389 (self-billing) isn't |
PEPPOL-EN16931-P0112 | type_code | 326 and 384 only between parties in Germany |
PEPPOL-EN16931-R061 | payment.mandate_id | Direct debits (49, 59) have the mandate reference |
When both the seller and the buyer are in Germany (address.country is DE for both), a Peppol invoice also has to pass the German rules from the XRechnung table, reported with Peppol's IDs: DE-R-001 for BR-DE-1, DE-R-015 for BR-DE-15, DE-R-025-1 and DE-R-025-2 for BR-DE-25-a and -b, and so on.
Format notes
Factur-X and ZUGFeRD
- The only extra requirement is the PDF standard: PDF/A-3b (the starters' default) or PDF/A-3a. PDF/UA-1 can't be used, because a PDF claims one standard and Factur-X needs PDF/A-3.
- Electronic addresses are optional. Without a scheme, an address is written with scheme
EM(e-mail). - The template's layout is yours, but the numbers come from the payload: bind to the computed fields so the page and
factur-x.xmlagree.
XRechnung
A complete XRechnung invoice for a German federal authority. The buyer reference and the buyer's electronic address both carry the Leitweg-ID, with EAS scheme 0204:
{
"template": "xrechnung",
"data": {
"invoice": {
"number": "RE-2026-0043",
"issue_date": "2026-10-20",
"currency": "EUR",
"buyer_reference": "04011000-12345-03",
"order_reference": "BE-2026-118",
"delivery_date": "2026-10-15",
"seller": {
"name": "Acme Studio GmbH",
"legal_id": "HRB 123456 B",
"vat_id": "DE123456789",
"address": { "line1": "Lindenstraße 12", "postcode": "10969", "city": "Berlin", "country": "DE" },
"electronic_address": "billing@acme-studio.example",
"contact": { "name": "Ada Weber", "phone": "+49 30 1234567", "email": "billing@acme-studio.example" }
},
"buyer": {
"name": "Bundesamt für Beispielwesen",
"address": { "line1": "Musterallee 1", "postcode": "53113", "city": "Bonn", "country": "DE" },
"electronic_address": "04011000-12345-03",
"electronic_address_scheme": "0204"
},
"lines": [
{ "name": "Brand identity, phase 2", "quantity": 1, "unit_code": "C62", "net_price": 4800, "vat_category": "S", "vat_rate": 19 },
{ "name": "Design system audit", "quantity": 12, "unit_code": "HUR", "net_price": 180, "vat_category": "S", "vat_rate": 19 }
],
"payment": {
"terms": "Payable within 30 days.\n#SKONTO#TAGE=10#PROZENT=2.00#\n",
"due_date": "2026-11-19",
"reference": "RE-2026-0043",
"means_code": "58",
"iban": "DE02120300000000202051",
"bic": "BYLADEM1001",
"account_name": "Acme Studio GmbH"
}
}
}
}The document comes back as XML:
{
"format": "xml",
"content_type": "application/xml",
"filename": "xrechnung-8Qw2kLm3.xml",
"pages": null,
"einvoice": {
"format": "xrechnung",
"syntax": "ubl",
"profile": "XRechnung 3.0",
"customization_id": "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0",
"attachment": null
}
}Things to know:
buyer_reference(BT-10) is mandatory. Public buyers give you their Leitweg-ID for it; for other buyers, use the reference they ask for.- Both parties need an
electronic_address. An e-mail address works with the default schemeEM; a Leitweg-ID uses0204, a German VAT number9930. - The seller needs a full contact (name, phone, e-mail) and both parties a city and post code.
payment.means_codeis mandatory. For a cash discount (Skonto), add a line like#SKONTO#TAGE=10#PROZENT=2.00#topayment.terms, followed by a line break. To give the base amount, write#SKONTO#TAGE=10#PROZENT=2.00#BASISBETRAG=500.00#.- For a SEPA direct debit, use
means_code: "59"withmandate_id,creditor_idanddebited_account, and leaveibanout.
Peppol BIS Billing
A Belgian B2B invoice. Both parties are addressed by their enterprise number (EAS 0208), and the same number is their legal ID:
{
"template": "peppol-invoice",
"data": {
"invoice": {
"number": "FAC-2026-0158",
"issue_date": "2026-10-20",
"currency": "EUR",
"buyer_reference": "MKT-2026",
"order_reference": "PO-4471",
"delivery_date": "2026-10-16",
"seller": {
"name": "Studio Noord BV",
"legal_id": "0123456749",
"legal_id_scheme": "0208",
"vat_id": "BE0123456749",
"address": { "line1": "Kortrijksesteenweg 112", "postcode": "9000", "city": "Gent", "country": "BE" },
"electronic_address": "0123456749",
"electronic_address_scheme": "0208",
"contact": { "name": "Lotte Peeters", "phone": "+32 9 123 45 67", "email": "invoices@studionoord.example" }
},
"buyer": {
"name": "Brasserie Lambiek NV",
"legal_id": "0987654394",
"legal_id_scheme": "0208",
"vat_id": "BE0987654394",
"address": { "line1": "Grote Markt 7", "postcode": "1000", "city": "Brussel", "country": "BE" },
"electronic_address": "0987654394",
"electronic_address_scheme": "0208"
},
"lines": [
{ "name": "House style design", "quantity": 1, "unit_code": "C62", "net_price": 2400, "vat_category": "S", "vat_rate": 21 },
{ "name": "Workshop", "quantity": 2, "unit_code": "DAY", "net_price": 750, "vat_category": "S", "vat_rate": 21 },
{ "name": "Printed menu cards", "quantity": 250, "unit_code": "H87", "net_price": 1.84, "vat_category": "S", "vat_rate": 21 }
],
"payment": {
"terms": "Payment within 30 days of the invoice date.",
"due_date": "2026-11-19",
"reference": "FAC-2026-0158",
"means_code": "58",
"iban": "BE68539007547034",
"bic": "GKCCBEBB",
"account_name": "Studio Noord BV"
}
}
}
}Things to know:
- Both parties need a Peppol participant ID:
electronic_addressplus itselectronic_address_scheme. E-mail addresses can't be Peppol endpoints. - For the schemes in the Peppol table (
0088,0192,0184,0208,0007,0151), Druckling checks the identifier's format and check digits, inelectronic_addressand inlegal_id. - Send a
buyer_referenceor anorder_reference. - Merge notes into one, unless both parties are in Germany.
- Self-billed invoices (
389) aren't part of Peppol BIS Billing.
Credit notes
Set type_code to 381 and reference the invoice you're crediting. Amounts stay positive: the type code makes it a credit. In UBL syntax (XRechnung, Peppol) Druckling writes a CreditNote document instead of an Invoice.
{
"invoice": {
"number": "CN-2026-0007",
"type_code": "381",
"issue_date": "2026-10-27",
"preceding_invoice": "RE-2026-0043",
"preceding_invoice_date": "2026-10-20",
"lines": [
{ "name": "Credit: design system audit (2 hours)", "quantity": 2, "unit_code": "HUR", "net_price": 180, "vat_category": "S", "vat_rate": 19 }
],
"payment": { "terms": "We'll refund the amount to your account.", "due_date": "2026-11-03", "means_code": "58", "iban": "DE02120300000000202051" }
}
}The other fields (currency, buyer_reference, seller, buyer) are the same as on the original invoice. The starters' layouts switch their heading to Gutschrift or Avoir when type_code is 381.
Reverse charge and exempt supplies
Categories other than S, Z, L and M need an exemption reason. For a German seller invoicing a Belgian business customer under reverse charge:
{
"buyer": {
"name": "Studio Noord BV",
"vat_id": "BE0123456749",
"address": { "line1": "Kortrijksesteenweg 112", "postcode": "9000", "city": "Gent", "country": "BE" }
},
"lines": [
{ "name": "Design system audit", "quantity": 12, "unit_code": "HUR", "net_price": 180, "vat_category": "AE", "vat_rate": 0 }
],
"vat_exemptions": [
{ "category": "AE", "reason": "Reverse charge: VAT is due from the recipient", "code": "VATEX-EU-AE" }
]
}The reason appears in the VAT breakdown as exemption_reason, so a template can print it next to the 0% line.
Output formats per template
The format parameter of POST /v1/documents defaults to what the template produces. Asking for another format answers 422 validation_failed on format; Druckling never switches silently.
| Template | Default | Accepted | Rejected |
|---|---|---|---|
| No e-invoicing | pdf | pdf, png | xml |
| Factur-X / ZUGFeRD | pdf | pdf | png, xml (the XML lives inside the PDF) |
| XRechnung or Peppol BIS | xml | xml | pdf, png |
To send a readable PDF along with an XRechnung or Peppol invoice, render it from a second e-invoice template set to Factur-X, with the same data. Its PDF shows the same computed totals.
XML documents
XRechnung and Peppol documents have format: "xml", content_type: "application/xml", pages: null, a file name ending in .xml and einvoice.attachment: null. Everything else works as for PDFs: download the file from url, poll or subscribe to webhooks for async renders, and create share links. Each XML document counts as one document toward your plan in live mode.
Rendering an XML e-invoice doesn't run the typesetter: the XML is generated from the payload and the layout plays no part. The language parameter is still validated and recorded on the document, but it doesn't change the XML. In a Factur-X PDF, language changes the visible pages only; the embedded XML is the same in every language. See Multi-language templates.
Batches of e-invoices
Batches work with e-invoice templates. Every item's invoice is checked against the schema and the business rules before anything renders. If any item fails, nothing is rendered and the 422 names the first problem, for example field: "items.3.data.invoice.buyer_reference", with data.errors listing the first invalid items.
XRechnung and Peppol batches produce XML files: file names end in .xml (a .pdf in filename_pattern or an item's filename becomes .xml), and the batch ZIP contains the XML files.
curl https://druckling-nine.vercel.app/v1/batches \
-H "Authorization: Bearer $DRUCKLING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "xrechnung",
"filename_pattern": "{{invoice.number}}.xml",
"items": [
{ "data": { "invoice": { "number": "RE-2026-0043", "…": "…" } } },
{ "data": { "invoice": { "number": "RE-2026-0044", "…": "…" } } }
]
}'Test before you go live
Render with a dr_test_… key while you build your integration: test-mode documents go through exactly the same validation and generation and don't count toward your quota. Check a few generated files with the validators your recipients use before switching to a live key.