Skip to content

Invoice Formats

thelawin.dev supports 9 different invoice formats to comply with various national and international e-invoicing regulations.

Overview

FormatOutputRegionUse Case
AUTOVariesAuto-detectLet the API choose
ZUGFERDPDF + CII XMLGermanyGerman B2B invoices
FACTURXPDF + CII XMLFranceFrench B2B/B2G invoices
XRECHNUNGPDF + UBL XMLGermanyGerman B2G (mandatory)
UBLXML onlyGlobalOASIS standard
CIIXML onlyGlobalUN/CEFACT standard
PEPPOLXML onlyEU/UK/AU/SG/NZ/MY/AE/JPCross-border network
FATTURAPAXML onlyItalyItalian SDI (mandatory)
PDFPDF onlyAnyPlain 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

json
{
  "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.country
  • buyer.name, buyer.country
  • items[].description, items[].quantity, items[].unit_price

Example

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

json
{
  "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 authorities
  • invoice.buyer_reference - Purchase order number (recommended)

Leitweg-ID Format

<Behördenkennung>-<Rechnungsempfänger>-<Leitweg>
Example: 04011000-12345-67

Example

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

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

json
{
  "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 ID
  • buyer.peppol_id - Peppol participant ID
  • invoice.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

json
{
  "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 code
  • buyer.codice_destinatario - SDI recipient code (7 chars) OR buyer.pec

Tipo Documento

  • TD01 - Invoice
  • TD04 - Credit note
  • TD05 - Debit note
  • TD06 - Fee invoice

Codice Destinatario

  • 7 alphanumeric characters OR
  • 0000000 if using PEC (certified email)

VAT Exemption (natura)

  • N1 - Excluded pursuant to Art. 15
  • N2 - Not subject to VAT
  • N3 - Not taxable
  • N4 - Exempt
  • N5 - Margin regime
  • N6 - Reverse charge
  • N7 - VAT paid in another EU country

Example

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

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

ScenarioRecommended FormatAlternative
German B2BZUGFeRDXRechnung
German B2GXRechnung-
French B2B/B2GFactur-XZUGFeRD
Italian B2B/B2GFatturaPA-
EU Cross-borderPeppolZUGFeRD
ERP IntegrationUBLCII
B2CPDFZUGFeRD
UnsureAUTOZUGFeRD

EU Directive 2014/55/EU

All formats (except PDF) comply with EN 16931, the European standard for electronic invoicing.

National Deadlines

CountryB2G MandatoryB2B MandatoryFormat
🇩🇪 Germany2020-11-27VoluntaryXRechnung (B2G), ZUGFeRD (B2B)
🇫🇷 France2020-01-012026-09-01 (large), 2027-09-01 (SME)Factur-X
🇮🇹 Italy2019-01-012019-01-01FatturaPA
🇪🇸 Spain2020-01-15Planned 2025Facturae 3.2
🇦🇹 Austria2020-01-27VoluntaryEN 16931

API Usage

Setting Format

json
{
  "format": "zugferd",  // or "facturx", "xrechnung", "ubl", etc.
  "profile": "en16931",
  "invoice": { ... }
}

Auto-Detection

json
{
  "format": "auto",  // API chooses best format
  "invoice": { ... }
}

Format Response

The API returns information about the chosen format:

json
{
  "format": {
    "format_used": "zugferd",
    "profile": "EN16931",
    "version": "2.3",
    "format_reason": "Auto-detected based on seller.country=DE",
    "warnings": []
  }
}

Further Reading

ZUGFeRD 2.4 & Factur-X 1.0.8 compliant