Skip to content

Germany (XRechnung and ZUGFeRD)

German entities can export finalized invoices and credit notes as structured e-invoices for German workflows.

Supported Formats

FormatOutputUse
XRechnungUBL XMLGerman EN 16931 CIUS, including public-sector workflows
ZUGFeRDPDF with embedded CII XMLHybrid invoice for recipients that need both a visual PDF and structured data

Prerequisites

RequirementDescription
German entityEntity country must be Germany
E-invoicing featureGermany must include the e_invoicing country feature
E-invoicing settingsEnable XRechnung and/or ZUGFeRD in entity settings
Finalized documentDraft invoices and credit notes cannot be exported
Complete partiesSeller and buyer names, addresses, cities, postal codes, and invoice lines are required
Seller tax identifierThe seller needs a VAT ID (tax_number) or a German tax number (tax_number_2, Steuernummer). Small businesses under § 19 UStG can use the tax number alone. Intra-community supplies (K) and exports (G) need the VAT ID
Seller email (XRechnung)The seller email is required for XRechnung

Exporting

Use the document actions menu in the app, or call the document API endpoint for the required format:

  • XRechnung downloads XML.
  • ZUGFeRD downloads a PDF containing embedded Factur-X/ZUGFeRD XML.

Available API endpoints:

  • GET /invoices/{id}/xrechnung
  • GET /invoices/{id}/zugferd
  • GET /credit-notes/{id}/xrechnung
  • GET /credit-notes/{id}/zugferd

Entity settings enable each standard and run validation by default. API create/update requests can set xrechnung.validation_required: true or zugferd.validation_required: true to make invalid validation block a final document save. Exports use the saved validation result when it is still current. Otherwise the document is validated again at export time, so issued invoices and credit notes stay exportable after payments or entity changes. A document that fails validation returns 422 with the field errors.

Enable German exportstypescript
await sdk.entities.update(entity.id, {
  settings: {
    xrechnung: { enabled: true },
    zugferd: { enabled: true },
  },
});
Create validated invoicetypescript
const _invoice = await sdk.invoices.create({
  customer: {
    name: "Stadtwerke Beispiel",
    address: "Rathausplatz 1",
    post_code: "10115",
    city: "Berlin",
    country: "Germany",
    country_code: "DE",
    e_invoicing: {
      buyer_reference: "04011000-12345-03",
    },
  },
  items: [
    {
      name: "Platform subscription",
      quantity: 1,
      price: 1200,
      taxes: [{ rate: 19 }],
    },
  ],
  xrechnung: { validation_required: true },
});

Buyer Reference

For German public-sector recipients, provide the buyer reference or Leitweg-ID as customer.e_invoicing.buyer_reference before exporting. Space Invoices maps it into the structured invoice as the EN 16931 buyer reference.

VAT categories

XRechnung and ZUGFeRD exports set the EN 16931 VAT category of each line automatically:

LineCategory
Positive VAT rateS
No VAT on an EU B2B sale (transaction_type: "intra_eu_b2b"), goods (classification: "product") delivered to another EU country (goods sold to a Northern Ireland business with an XI VAT number count the same)K intra-community supply, VATEX-EU-IC
No VAT on an EU B2B sale, anything elseAE reverse charge, VATEX-EU-AE
Goods (classification: "product") delivered outside the EU on a 3w_b2b or 3w_b2c saleG export, VATEX-EU-G
Other reverse-charge linesAE
Seller not VAT-registeredE
Any other 0 % lineZ

Send classification: "product" on goods lines to get K or G. Lines without a classification keep AE or Z.

The exemption reason text is the document tax_clause when set, otherwise a standard English text for the category. New entities get two default clauses for EU B2B sales in settings.tax_clause_defaults: intra_eu_b2b_goods for goods and intra_eu_b2b for services; an invoice with both kinds of lines gets both.

The deliver-to country is delivery_address.country_code, or the customer’s country when there is no delivery address. K needs seller and buyer VAT IDs and a delivery date (date_service).

{
"date_service": "2026-10-01",
"items": [
{
"name": "Industrial sensor",
"quantity": 10,
"price": 120,
"classification": "product"
}
]
}

For edge cases, override the category per line with items[].e_invoicing.vat_category: code is one of Z, E, AE, K or G, and exemption_reason_code and exemption_reason are optional. The override applies to XRechnung and ZUGFeRD exports and only to lines without VAT charged.

The exemption_reason_code must be a VATEX code that is valid for the category, for example VATEX-EU-IC only with K. Reverse charge (AE) needs the buyer’s VAT ID (customer.tax_number); a legal registration ID counts instead only with an ISO 6523 scheme, which customer records cannot carry yet.

{
"items": [
{
"name": "Training course",
"quantity": 1,
"price": 500,
"taxes": [{ "rate": 0 }],
"e_invoicing": {
"vat_category": {
"code": "E",
"exemption_reason": "Exempt education service"
}
}
}
]
}

Download Examples

Download XRechnungtypescript
const _xml = await sdk.invoices.downloadInvoiceXRechnung(invoice.id);
Download ZUGFeRDtypescript
const _pdf = await sdk.invoices.downloadInvoiceZugferd(invoice.id);

See the Invoices API Reference, Credit Notes API Reference, and Entities API Reference for German settings and export endpoints.