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

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 always require a current valid saved validation result for the requested format.

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.

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.