D
Druckling
Docs

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.

FormatWhat you getXML syntaxUse it for
Factur-X 1.0 / ZUGFeRD 2.xA PDF/A-3 people can read, with the invoice XML embedded as factur-x.xmlUN/CEFACT CII D16BB2B invoices in Germany (ZUGFeRD) and France (Factur-X), where the buyer accepts a hybrid PDF
XRechnung 3.0The XML on its ownUBL 2.1 (default) or UN/CEFACT CII D16BGerman public-sector buyers, who identify themselves with a Leitweg-ID
Peppol BIS Billing 3.0The XML on its ownUBL 2.1Exchange 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:

Formateinvoice.profileeinvoice.customization_id (BT-24)Business process (BT-23)
Factur-X / ZUGFeRDEN 16931urn:cen.eu:en16931:2017Not written
XRechnungXRechnung 3.0urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0urn:fdc:peppol.eu:2017:poacc:billing:01:1.0
Peppol BISPeppol BIS Billing 3.0urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0urn: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.

request.json
{
  "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.json

The 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

FieldTypeRequiredBTDescription
numberstringYesBT-1Invoice number
type_codestringNoBT-3380 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_datedateYesBT-2Issue date
currencystringYesBT-5ISO 4217 code in capitals, e.g. EUR
buyer_referencestringXRechnungBT-10Buyer reference. For German public buyers, their Leitweg-ID
order_referencestringNoBT-13Purchase order reference
preceding_invoicestringNoBT-25Invoice a credit note or correction refers to
preceding_invoice_datedateNoBT-26Issue date of the preceding invoice
delivery_datedateNoBT-72Date of supply or service
billing_period.startdateNoBT-73Service period start
billing_period.enddateNoBT-74Service period end
notesarrayNoBG-1Invoice notes, see Notes and delivery
sellerobjectYesSee Seller and buyer
buyerobjectYesSee Seller and buyer
deliveryobjectNoDeliver-to party, see Notes and delivery
linesarrayYesBG-25Invoice lines, see Lines
allowances_chargesarrayNoBG-20, BG-21Document-level allowances and charges, see Allowances and charges
vat_exemptionsarrayNoExemption reasons per VAT category, see VAT categories
paymentobjectNoPayment terms and instructions, see Payment
prepaid_amountnumberNoBT-113Amount 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.

FieldTypeRequiredBT (seller / buyer)Description
namestringYesBT-27 / BT-44Legal name
trading_namestringNoBT-28 / BT-45Trading name, if different
idstringNoBT-29 / BT-46Seller identifier; for the buyer, your customer number
legal_idstringNoBT-30 / BT-47Legal registration, e.g. HRB 123456 B or a SIREN
legal_id_schemestringNoISO 6523 scheme of legal_id, e.g. 0002 for SIREN, 0208 for a Belgian enterprise number
legal_infostringNoBT-33 (seller only)Additional legal information, e.g. register court and share capital
tax_numberstringNoBT-32 (seller only)National tax number (Steuernummer)
vat_idstringNoBT-31 / BT-48VAT identifier with its country prefix, e.g. DE123456789
addressobjectYesSee the address table below
electronic_addressstringXRechnung, PeppolBT-34 / BT-49E-mail address, Leitweg-ID or Peppol participant identifier
electronic_address_schemestringPeppolEAS 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.namestringXRechnung (seller)BT-41 / BT-56Contact person or department
contact.phonestringXRechnung (seller)BT-42 / BT-57Contact phone
contact.emailstringXRechnung (seller)BT-43 / BT-58Contact e-mail

The address object:

FieldTypeRequiredBT (seller / buyer)Description
line1stringNoBT-35 / BT-50Street and number
line2stringNoBT-36 / BT-51Address line 2
line3stringNoBT-162 / BT-163Address line 3
postcodestringXRechnungBT-38 / BT-53Post code
citystringXRechnungBT-37 / BT-52City
regionstringNoBT-39 / BT-54Region or state
countrystringYesBT-40 / BT-55ISO 3166-1 alpha-2 code in capitals, e.g. DE

Lines

Each item of lines is one invoice line.

FieldTypeRequiredBTDescription
idstringNoBT-126Line number. Defaults to the line's position ("1", "2", …)
namestringYesBT-153Item name
descriptionstringNoBT-154Item description
seller_item_idstringNoBT-155Your item number
notestringNoBT-127Line note
quantitynumberYesBT-129Invoiced quantity
unit_codestringYesBT-130UN/ECE Recommendation 20 unit, 2 or 3 capitals or digits: C62 one, H87 piece, HUR hour, DAY day
net_pricenumberYesBT-146Net unit price. Can't be negative
price_base_quantitynumberNoBT-149Quantity the price refers to. Default 1, must be positive
vat_categorystringYesBT-151VAT category code, see VAT categories
vat_ratenumberNoBT-152VAT 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.

FieldTypeRequiredBT (allowance / charge)Description
kindstringYesallowance or charge
amountnumberYesBT-92 / BT-99Positive amount, at most 2 decimals
reasonstringOne of the twoBT-97 / BT-104Reason text
reason_codestringOne of the twoBT-98 / BT-105Reason code: UNCL 5189 for allowances (e.g. 95 discount), UNCL 7161 for charges (e.g. FC freight)
vat_categorystringYesBT-95 / BT-102VAT category code
vat_ratenumberNoBT-96 / BT-103VAT 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:

FieldTypeRequiredBTDescription
categorystringYesThe VAT category the reason applies to
reasonstringOne of the twoBT-120Exemption reason text, printed in the VAT breakdown
codestringOne of the twoBT-121Exemption reason code, e.g. VATEX-EU-AE
CodeMeaningRateAlso needs
SStandard rateAbove 0Seller VAT ID or tax number
ZZero rated0Seller VAT ID or tax number. No exemption reason
EExempt from VAT0Seller VAT ID or tax number, exemption reason
AEReverse charge0Seller VAT ID or tax number, buyer VAT ID (or legal ID), exemption reason
KIntra-community supply0Seller and buyer VAT IDs, a delivery date or billing period, the deliver-to country, exemption reason
GExport outside the EU0Seller VAT ID, exemption reason
ONot subject to VATNone, any rate is ignoredNo VAT IDs on either party, exemption reason
LCanary Islands (IGIC)Above 0Seller VAT ID or tax number
MCeuta and Melilla (IPSI)Above 0Seller VAT ID or tax number

Payment

FieldTypeRequiredBTDescription
termsstringSee belowBT-20Payment terms
due_datedateSee belowBT-9Due date
referencestringNoBT-83Remittance information, e.g. the invoice number
means_codestringXRechnungBT-81UNCL 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
ibanstringFor 30 and 58BT-84Payee IBAN
bicstringNoBT-86Payee BIC
account_namestringNoBT-85Payee account name
mandate_idstringFor 59 in XRechnung, 49 and 59 in PeppolBT-89Direct debit mandate reference
creditor_idstringFor 59 in XRechnungBT-90Your SEPA creditor identifier
debited_accountstringFor 59 in XRechnungBT-91The buyer's IBAN to debit

When an amount is due, the invoice needs a due_date or terms (BR-CO-25).

Notes and delivery

FieldTypeRequiredBTDescription
notes[].textstringYesBT-22Note text
notes[].subject_codestringNoBT-21UNTDID 4451 subject, e.g. AAB, PMT, PMD, REG, AAI
delivery.namestringNoBT-70Deliver-to party name
delivery.address.line1stringNoBT-75Deliver-to street
delivery.address.postcodestringNoBT-78Deliver-to post code
delivery.address.citystringNoBT-77Deliver-to city
delivery.address.countrystringNoBT-80Deliver-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 fieldBTHow it's calculated
lines[].net_amountBT-131quantity × net_price ÷ price_base_quantity, rounded to cents
allowances_charges[].signed_amountThe amount, negative for allowances (handy in a table)
vat_breakdown[]BG-23One entry per VAT category and rate: category (BT-118), rate (BT-119), basis (BT-116), tax (BT-117), exemption_reason (BT-120)
totals.line_totalBT-106Sum of line net amounts
totals.allowance_totalBT-107Sum of allowances
totals.charge_totalBT-108Sum of charges
totals.tax_basis_totalBT-109Line total − allowances + charges
totals.tax_totalBT-110Sum of the breakdown's VAT amounts
totals.grand_totalBT-112Total without VAT + total VAT
totals.prepaidBT-113prepaid_amount, or 0
totals.due_payableBT-115Grand 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.335 make 1.01, not 1.00.
  • Precision of your inputs. Quantities and prices can have more than two decimals. Allowance and charge amounts and prepaid_amount can have at most two (BR-DEC-01, BR-DEC-16).
  • Anything you send is overwritten. If your payload contains totals, vat_breakdown or lines[].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:

  1. Shape, against the template's JSON Schema: required fields, types, date and code formats. A problem answers 422 with code schema_validation_failed.
  2. 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 and field points 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.

RuleFieldChecks
BR-DATEany dateThe date exists in the calendar (2026-02-30 fails). A Druckling check, not an EN 16931 rule ID
BR-29billing_period.endThe billing period doesn't end before it starts
BR-CO-26seller.vat_idThe seller has an id, legal_id or vat_id
BR-CO-09seller.vat_id, buyer.vat_idVAT IDs start with a two-letter country prefix
BR-27lines.n.net_priceThe net price isn't negative
BR-DEClines.n.price_base_quantityThe base quantity is positive. A Druckling check
BR-DEC-01allowances_charges.n.amountPositive, at most 2 decimals
BR-33, BR-38allowances_charges.n.reasonEach allowance (BR-33) or charge (BR-38) has a reason or reason_code
BR-DEC-16prepaid_amountAt most 2 decimals
BR-S-05, BR-L-05, BR-M-05….vat_rateCategories 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_rateCategories Z, E, AE, K and G have rate 0
BR-S-02, BR-Z-02, BR-E-02, BR-L-02, BR-M-02seller.vat_idThese categories need the seller's VAT ID or tax number
BR-AE-02seller.vat_id, buyer.vat_idReverse charge needs the seller's VAT ID or tax number and the buyer's VAT ID or legal ID
BR-IC-02seller.vat_id, buyer.vat_idIntra-community supply needs both VAT IDs
BR-IC-11delivery_dateIntra-community supply needs a delivery date or billing period start
BR-IC-12delivery.address.countryIntra-community supply needs the deliver-to country
BR-G-02seller.vat_idExport needs the seller's VAT ID
BR-O-02seller.vat_id or buyer.vat_idAn invoice not subject to VAT carries no VAT IDs
BR-E-10, BR-AE-10, BR-IC-10, BR-G-10, BR-O-10lines.n.vat_categoryCategories E, AE, K, G and O have a reason or code in vat_exemptions
BR-S-10, BR-Z-10vat_exemptions.nCategories S and Z have no exemption reason
BR-CO-25payment.due_dateAn amount due has a due date or payment terms
BR-61payment.ibanCredit 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.

RuleFieldChecks
PEPPOL-EN16931-R020seller.electronic_addressThe seller has an electronic address
PEPPOL-EN16931-R010buyer.electronic_addressThe buyer has an electronic address
BR-CL-25….electronic_address_schemeThe scheme is on the CEF EAS code list (EM when unset is fine)
BR-DE-1payment.means_codePayment instructions are given: set the payment means code
BR-DE-3, BR-DE-4seller.address.city, seller.address.postcodeThe seller's city and post code
BR-DE-5, BR-DE-6, BR-DE-7seller.contact.name, .phone, .emailA seller contact with name, phone and e-mail
BR-DE-8, BR-DE-9buyer.address.city, buyer.address.postcodeThe buyer's city and post code
BR-DE-10, BR-DE-11delivery.address.city, .postcodeA deliver-to address with a country also has a city and post code
BR-DE-15buyer_referenceA buyer reference (the Leitweg-ID for public buyers)
BR-DE-18payment.termsSkonto lines read like #SKONTO#TAGE=14#PROZENT=2.00#, in capitals, each followed by a line break
BR-DE-23-bpayment.mandate_id or payment.debited_accountA credit transfer (30, 58) carries no direct debit details
BR-DE-24-apayment.means_codeCard payments (48) aren't supported: use 30, 58 or 59
BR-DE-25-apayment.mandate_idA SEPA direct debit (59) has the mandate reference
BR-DE-25-bpayment.ibanA SEPA direct debit has no payee IBAN: send the buyer's IBAN as debited_account
BR-DE-30payment.creditor_idA SEPA direct debit has your creditor identifier
BR-DE-31payment.debited_accountA SEPA direct debit has the IBAN to debit

Peppol BIS rules

RuleFieldChecks
PEPPOL-EN16931-R020, PEPPOL-EN16931-R010seller.electronic_address, buyer.electronic_addressBoth parties have an electronic address (their Peppol participant ID)
PEPPOL-EN16931-CL008….electronic_address_schemeThe scheme is set and on the Peppol EAS code list. EM (e-mail) isn't
PEPPOL-COMMON-R040….electronic_address, ….legal_idScheme 0088: a GLN with a valid GS1 check digit
PEPPOL-COMMON-R041sameScheme 0192: a 9-digit Norwegian organisation number
PEPPOL-COMMON-R042sameScheme 0184: a Danish CVR number (8 digits, optionally prefixed DK)
PEPPOL-COMMON-R043sameScheme 0208: a 10-digit Belgian enterprise number with valid check digits
PEPPOL-COMMON-R049sameScheme 0007: a 10-digit Swedish organisation number
PEPPOL-COMMON-R050sameScheme 0151: an 11-digit Australian Business Number
PEPPOL-EN16931-R003buyer_referenceA buyer reference or a purchase order reference
PEPPOL-EN16931-R002notes.1At most one note, unless both parties are in Germany
PEPPOL-EN16931-P0100type_codeThe type is part of Peppol BIS Billing: 389 (self-billing) isn't
PEPPOL-EN16931-P0112type_code326 and 384 only between parties in Germany
PEPPOL-EN16931-R061payment.mandate_idDirect 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.xml agree.

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:

xrechnung-request.json
{
  "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 scheme EM; a Leitweg-ID uses 0204, a German VAT number 9930.
  • The seller needs a full contact (name, phone, e-mail) and both parties a city and post code.
  • payment.means_code is mandatory. For a cash discount (Skonto), add a line like #SKONTO#TAGE=10#PROZENT=2.00# to payment.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" with mandate_id, creditor_id and debited_account, and leave iban out.

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:

peppol-request.json
{
  "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_address plus its electronic_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, in electronic_address and in legal_id.
  • Send a buyer_reference or an order_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.

TemplateDefaultAcceptedRejected
No e-invoicingpdfpdf, pngxml
Factur-X / ZUGFeRDpdfpdfpng, xml (the XML lives inside the PDF)
XRechnung or Peppol BISxmlxmlpdf, 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.

On this page