Invoice Formats
thelawin.dev supports 9 different invoice formats to comply with various national and international e-invoicing regulations.
Overview
| Format | Output | Region | Use Case |
|---|---|---|---|
| AUTO | Varies | Auto-detect | Let the API choose |
| ZUGFERD | PDF + CII XML | Germany | German B2B invoices |
| FACTURX | PDF + CII XML | France | French B2B/B2G invoices |
| XRECHNUNG | PDF + UBL XML | Germany | German B2G (mandatory) |
| UBL | XML only | Global | OASIS standard |
| CII | XML only | Global | UN/CEFACT standard |
| PEPPOL | XML only | EU/UK/AU/SG/NZ/MY/AE/JP | Cross-border network |
| FATTURAPA | XML only | Italy | Italian SDI (mandatory) |
| PDF only | Any | Plain invoices |
AUTO
Auto-detection - Let the API choose the best format based on your invoice data.
How it works
The API analyzes your invoice data and selects the appropriate format:
Italy buyer + codice_fiscale → FatturaPA
Germany buyer + leitweg_id → XRechnung
Peppol IDs present → Peppol
France seller → Factur-X
Germany seller → ZUGFeRD
Otherwise → ZUGFeRD (default)Example
{
"format": "auto",
"invoice": {
"seller": { "country": "DE" },
"buyer": { "country": "IT", "codice_fiscale": "12345678901" }
}
}→ Result: FatturaPA XML (because Italian buyer has codice_fiscale)
ZUGFERD
PDF/A-3 + CII XML - German standard for electronic invoices.
Specifications
- Standard: ZUGFeRD 2.4
- Profile: EN 16931 (recommended)
- Output: Visual PDF with embedded XML
- Legal basis: § 14 UStG, EU Directive 2014/55/EU
Required Fields
seller.vat_id(for EN16931 profile)seller.name,seller.countrybuyer.name,buyer.countryitems[].description,items[].quantity,items[].unit_price
Example
{
"format": "zugferd",
"profile": "en16931",
"invoice": {
"number": "RE-2026-001",
"date": "2026-01-07",
"seller": {
"name": "Acme GmbH",
"vat_id": "DE123456789",
"country": "DE"
},
"buyer": {
"name": "Customer AG",
"country": "DE"
},
"items": [{
"description": "Consulting",
"quantity": 8,
"unit": "HUR",
"unit_price": 150,
"vat_rate": 19
}]
}
}Use Cases
- German B2B: Recommended for all German business-to-business invoices
- EU Cross-border: Accepted across EU
- Accounting Software: Automatically processable by DATEV, SAP, etc.
FACTURX
PDF/A-3 + CII XML - French standard (identical to ZUGFeRD).
Specifications
- Standard: Factur-X 1.0.8 (= ZUGFeRD 2.4)
- Profile: EN 16931
- Output: Visual PDF with embedded XML
- Legal basis: Ordonnance 2021-1190, EU Directive 2014/55/EU
Required Fields
Same as ZUGFeRD (see above)
Example
{
"format": "facturx",
"profile": "en16931",
"locale": "fr"
}Use Cases
- French B2B: Recommended for French business invoices
- Chorus Pro: Required for French public sector (B2G)
- EU Cross-border: Accepted across EU
Deadlines
- B2G: Mandatory since 2020
- Large B2B: Mandatory from 2026-09-01
- SME B2B: Mandatory from 2027-09-01
XRECHNUNG
PDF/A-3 + UBL XML - German B2G standard (mandatory for public sector).
Specifications
- Standard: XRechnung 3.0.2 (UBL 2.1 based)
- Profile: EN 16931
- Output: Visual PDF with embedded UBL XML
- Legal basis: E-Rechnungs-Verordnung (ERechV), § 27 Abs. 38 UStG
Required Fields
All ZUGFeRD fields PLUS:
invoice.leitweg_id- Routing ID for German authoritiesinvoice.buyer_reference- Purchase order number (recommended)
Leitweg-ID Format
<Behördenkennung>-<Rechnungsempfänger>-<Leitweg>
Example: 04011000-12345-67Example
{
"format": "xrechnung",
"invoice": {
"leitweg_id": "04011000-12345-67",
"buyer_reference": "PO-2026-123",
"seller": {
"name": "Software GmbH",
"vat_id": "DE987654321"
},
"buyer": {
"name": "Bundesbehörde"
}
}
}Use Cases
- German B2G: Mandatory for all invoices to German public sector since 2020-11-27
- Federal Authorities: Required routing via Leitweg-ID
- B2B: Optional (ZUGFeRD is more common)
UBL
XML only - OASIS Universal Business Language standard.
Specifications
- Standard: UBL 2.1 Invoice
- Profile: EN 16931
- Output: XML file (no PDF)
- Legal basis: OASIS UBL 2.1 Standard
Required Fields
Same as ZUGFeRD
Example
{
"format": "ubl",
"invoice": {
"number": "UBL-001",
"date": "2026-01-07",
"seller": { "name": "Company Ltd" },
"buyer": { "name": "Customer Inc" },
"items": [{
"description": "Services",
"quantity": 1,
"unit_price": 1000
}]
}
}Use Cases
- ERP Integration: Machine-to-machine without visual PDF
- Base Format: Foundation for XRechnung and Peppol
- Custom Processing: When you generate PDFs yourself
CII
XML only - UN/CEFACT Cross-Industry Invoice standard.
Specifications
- Standard: UN/CEFACT CII D16B
- Profile: EN 16931
- Output: XML file (no PDF)
Required Fields
Same as ZUGFeRD
Example
{
"format": "cii",
"invoice": {
"number": "CII-001",
"date": "2026-01-07"
}
}Use Cases
- Raw XML: Base format for ZUGFeRD/Factur-X
- System Integration: When embedding in existing PDF workflow
- Custom Workflows: Full control over PDF generation
PEPPOL
XML only - Pan-European Public Procurement Online network.
Specifications
- Standard: Peppol BIS Billing 3.0 (UBL-based)
- Profile: EN 16931
- Output: XML file (no PDF)
- Network: Peppol eDelivery Network
Required Fields
All UBL fields PLUS:
seller.peppol_id- Peppol participant IDbuyer.peppol_id- Peppol participant IDinvoice.buyer_reference- Purchase order reference (mandatory)
Peppol ID Format
<EAS code>:<identifier>
Examples:
- 0088:1234567890123 (GLN)
- 0184:123456789 (DUNS)
- 9956:DE123456789 (German VAT ID)Example
{
"format": "peppol",
"invoice": {
"number": "PEPPOL-001",
"date": "2026-01-07",
"buyer_reference": "PO-2026-123",
"seller": {
"name": "EU Supplier Ltd",
"peppol_id": "0088:1234567890123"
},
"buyer": {
"name": "EU Customer GmbH",
"peppol_id": "0088:9876543210987"
},
"items": [{
"description": "Consulting Services",
"quantity": 10,
"unit_price": 100
}]
}
}Use Cases
- EU Cross-border: Invoices via Peppol network
- International B2G: Required in some EU countries
- Automated Routing: Network handles delivery
Supported Countries
Supported Countries: EU member states, UK, Australia, Singapore, New Zealand, Malaysia, UAE, Japan, Switzerland, Norway — via country profiles.
Each jurisdiction uses a specific PINT (Peppol International) profile that sets the correct CustomizationID, TaxScheme, and tax category codes. The API auto-detects the profile from seller.country, or you can pass country_profile explicitly. See the Country Profiles guide for the full list, automatic detection rules, and per-profile Schematron conformance status.
Network Registration Required
Both sender and receiver must be registered in the Peppol network with Access Points.
FATTURAPA
XML only - Italian SDI (Sistema di Interscambio) standard.
Specifications
- Standard: FatturaPA 1.2.2
- Profile: Agenzia delle Entrate schema
- Output: XML file (for SDI submission)
- Legal basis: Art. 1, comma 3, D.Lgs. 127/2015
Required Fields
All UBL fields PLUS:
invoice.tipo_documento- Document type (TD01, TD04, etc.)seller.codice_fiscale- Italian tax code (11/16 chars)buyer.codice_fiscale- Buyer's tax codebuyer.codice_destinatario- SDI recipient code (7 chars) ORbuyer.pec
Tipo Documento
TD01- InvoiceTD04- Credit noteTD05- Debit noteTD06- Fee invoice
Codice Destinatario
- 7 alphanumeric characters OR
0000000if using PEC (certified email)
VAT Exemption (natura)
N1- Excluded pursuant to Art. 15N2- Not subject to VATN3- Not taxableN4- ExemptN5- Margin regimeN6- Reverse chargeN7- VAT paid in another EU country
Example
{
"format": "fatturapa",
"invoice": {
"number": "IT-2026-001",
"date": "2026-01-07",
"tipo_documento": "TD01",
"seller": {
"name": "Fornitore Italiano SRL",
"codice_fiscale": "12345678901"
},
"buyer": {
"name": "Cliente Italiano SPA",
"codice_fiscale": "98765432109",
"codice_destinatario": "ABCDEFG"
},
"items": [{
"description": "Servizi di consulenza",
"quantity": 1,
"unit_price": 1000,
"vat_rate": 22,
"natura": "N4"
}]
}
}Use Cases
- Italian B2B/B2G: Mandatory for all Italian invoices since 2019-01-01
- SDI Submission: XML submitted to Sistema di Interscambio
- Reverse Charge: Use natura codes for tax exemptions
Mandatory in Italy
FatturaPA is legally required for all B2B and B2G invoices in Italy. Penalties apply for non-compliance.
PDF
Plain PDF - Visual invoice without embedded XML.
Specifications
- Standard: None (visual only)
- Output: PDF file (no structured data)
- Legal: Not compliant with EU Directive 2014/55/EU
Example
{
"format": "pdf",
"template": "minimal",
"invoice": {
"number": "PLAIN-001",
"date": "2026-01-07",
"seller": { "name": "Company" },
"buyer": { "name": "Customer" },
"items": [{
"description": "Product",
"quantity": 1,
"unit_price": 100
}]
}
}Use Cases
- B2C Invoices: Consumer invoices (no e-invoice required)
- Internal Use: Proforma invoices, quotes
- Non-EU: Countries without e-invoice requirements
Not Compliant
Plain PDF is NOT compliant with EN 16931 or national e-invoice regulations. Use only for B2C or internal purposes.
Format Selection Guide
Decision Tree
Is buyer Italian with codice_fiscale?
→ YES: FatturaPA
Is buyer German public sector (Behörde)?
→ YES: XRechnung (leitweg_id required)
Do both parties have Peppol IDs?
→ YES: Peppol
Is buyer French?
→ YES: Factur-X
Is buyer/seller German?
→ YES: ZUGFeRD
Otherwise:
→ ZUGFeRD (international standard)Recommendations
| Scenario | Recommended Format | Alternative |
|---|---|---|
| German B2B | ZUGFeRD | XRechnung |
| German B2G | XRechnung | - |
| French B2B/B2G | Factur-X | ZUGFeRD |
| Italian B2B/B2G | FatturaPA | - |
| EU Cross-border | Peppol | ZUGFeRD |
| ERP Integration | UBL | CII |
| B2C | ZUGFeRD | |
| Unsure | AUTO | ZUGFeRD |
Legal Compliance
EU Directive 2014/55/EU
All formats (except PDF) comply with EN 16931, the European standard for electronic invoicing.
National Deadlines
| Country | B2G Mandatory | B2B Mandatory | Format |
|---|---|---|---|
| 🇩🇪 Germany | 2020-11-27 | Voluntary | XRechnung (B2G), ZUGFeRD (B2B) |
| 🇫🇷 France | 2020-01-01 | 2026-09-01 (large), 2027-09-01 (SME) | Factur-X |
| 🇮🇹 Italy | 2019-01-01 | 2019-01-01 | FatturaPA |
| 🇪🇸 Spain | 2020-01-15 | Planned 2025 | Facturae 3.2 |
| 🇦🇹 Austria | 2020-01-27 | Voluntary | EN 16931 |
API Usage
Setting Format
{
"format": "zugferd", // or "facturx", "xrechnung", "ubl", etc.
"profile": "en16931",
"invoice": { ... }
}Auto-Detection
{
"format": "auto", // API chooses best format
"invoice": { ... }
}Format Response
The API returns information about the chosen format:
{
"format": {
"format_used": "zugferd",
"profile": "EN16931",
"version": "2.3",
"format_reason": "Auto-detected based on seller.country=DE",
"warnings": []
}
}Further Reading
- Generate API - Full API reference
- Validation - Pre-validation before PDF generation
- Error Handling - Format-specific error messages