Germany (XRechnung and ZUGFeRD)
German entities can export finalized invoices and credit notes as structured e-invoices for German workflows.
Supported Formats
| Format | Output | Use |
|---|---|---|
| XRechnung | UBL XML | German EN 16931 CIUS, including public-sector workflows |
| ZUGFeRD | PDF with embedded CII XML | Hybrid invoice for recipients that need both a visual PDF and structured data |
Prerequisites
| Requirement | Description |
|---|---|
| German entity | Entity country must be Germany |
| E-invoicing feature | Germany must include the e_invoicing country feature |
| E-invoicing settings | Enable XRechnung and/or ZUGFeRD in entity settings |
| Finalized document | Draft invoices and credit notes cannot be exported |
| Complete parties | Seller 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}/xrechnungGET /invoices/{id}/zugferdGET /credit-notes/{id}/xrechnungGET /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.
await sdk.entities.update(entity.id, {
settings: {
xrechnung: { enabled: true },
zugferd: { enabled: true },
},
});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
const _xml = await sdk.invoices.downloadInvoiceXRechnung(invoice.id);const _pdf = await sdk.invoices.downloadInvoiceZugferd(invoice.id);Related API
See the Invoices API Reference, Credit Notes API Reference, and Entities API Reference for German settings and export endpoints.