Back to Blog

Creating ZUGFeRD Invoices: A Step-by-Step Guide

Published on January 15, 2026by Invapi Team
ZUGFeRDGuideE-InvoicingPDF

Creating ZUGFeRD Invoices: A Step-by-Step Guide

ZUGFeRD is one of the most popular e-invoicing formats in Germany because it combines the best of two worlds: a visually readable PDF invoice and a machine-readable XML file in a single document. This guide explains how to create a compliant ZUGFeRD invoice.

What Exactly Is a ZUGFeRD Invoice?

A ZUGFeRD invoice is a PDF/A-3 document with an embedded CII XML file (Cross-Industry Invoice). The PDF contains the visual representation of the invoice, just like a traditional PDF invoice. In addition, an XML file is embedded as an attachment within the PDF, containing all invoice data in a structured, machine-readable format. Starting with ZUGFeRD 2.1, this file is named factur-x.xml (in ZUGFeRD 2.0 it was still called zugferd-invoice.xml).

The advantage: recipients without specialised software see a normal PDF invoice. Recipients with e-invoicing systems can automatically extract and process the data.

ZUGFeRD Profiles

ZUGFeRD 2.x (currently version 2.4, corresponding to Factur-X 1.08) offers several profiles that differ in the scope of the data they contain:

Minimum

Contains only basic header data (invoice number, date, total amount). Suitable for archiving purposes only, not for automated processing.

Basic WL (Without Lines)

Extends the Minimum profile with seller and buyer information as well as VAT breakdowns, but does not include individual line items.

Basic

Like Basic WL, but with line items. This is the first level that enables meaningful automated processing.

EN 16931 (Comfort)

Maps the complete European data model EN 16931. This profile is the basis for mandatory e-invoicing requirements and covers all mandatory fields defined by the European standard.

Extended

Allows additional fields beyond EN 16931, for example for industry-specific requirements.

XRechnung

A special profile that fully maps the XRechnung CIUS, making it suitable for invoices to public sector contracting authorities.

For most use cases, we recommend at least the EN 16931 (Comfort) profile, as it meets the legal requirements.

Required Fields in a ZUGFeRD Invoice

Starting from the EN 16931 (Comfort) profile, the following core data is required:

  • Invoice number (BT-1)
  • Invoice date (BT-2)
  • Currency code (BT-5), e.g. EUR
  • Seller: name, address, VAT ID
  • Buyer: name, address
  • Line items: description, quantity, unit price, VAT rate
  • Totals: net amount, VAT, gross amount
  • Payment information: due date, payment method, IBAN

Step by Step: Creating a ZUGFeRD Invoice

Step 1: Structure the Invoice Data

Capture all invoice data in a structured format. With invapi, you use a JSON object containing all relevant fields — seller, buyer, line items, amounts, and payment information.

Step 2: Prepare the PDF

Create a visual PDF invoice with your usual layout and branding. The PDF serves as the foundation and will become the PDF/A-3 container. Make sure the information in the PDF matches the XML data.

Step 3: Generate the CII XML

The machine-readable XML file must be in the UN/CEFACT Cross-Industry Invoice format. Creating this manually is error-prone — an automated tool or API is recommended.

Step 4: Embed the XML in the PDF

The CII XML file is embedded as an attachment in the PDF. The PDF must conform to the PDF/A-3 standard and reference the XML file as a linked attachment with the correct MIME type.

Step 5: Validate

Before sending, you should validate the generated ZUGFeRD invoice. Validation checks both the XML structure and compliance with the EN 16931 business rules.

The Easy Way with invapi

Steps 3 through 5 can be automated using the invapi API. Simply submit your invoice data as JSON along with a PDF file, and invapi generates a complete, validated ZUGFeRD invoice.

The workflow via the API:

  1. Compile invoice data as JSON
  2. Upload the PDF and send it together with the JSON to the ZUGFeRD endpoint
  3. Receive a validated ZUGFeRD PDF as the result

The API handles the conversion, embedding, and validation. You can get started right away with the free plan.

Conclusion

ZUGFeRD invoices combine the best of both worlds: human readability and machine processability. While the creation process requires more than simply generating a PDF, it can be fully automated with the right tools. Getting familiar with ZUGFeRD now means being well prepared for mandatory e-invoicing requirements.