AI PDF to ZUGFeRD API
Convert a PDF invoice into a ZUGFeRD compliant PDF/A-3 with embedded XML for German e-invoicing.
https://api.invoicexml.com/v1/transform/to/zugferd
- Typed, scanned or photographed PDFs
- PDF/A-3 with embedded CII XML
- New PDF in English, German or French
- Validated against EN 16931
Technical reference
Convert a PDF invoice into a ZUGFeRD hybrid invoice. The API extracts structured data from your PDF, validates it against EN 16931 business rules, and returns a PDF/A-3 with an embedded factur-x.xml attachment for German B2B and B2G exchange.
Review every result before you use it
Code Example
curl -X POST https://api.invoicexml.com/v1/transform/to/zugferd \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "[email protected]" \ -F "language=auto" \ -F "validationLanguage=de"
Request
| Parameter | Type | Description |
|---|---|---|
| file * | binary | The invoice file to process. |
| language | string | Language of the rendered PDF (labels and date format) and of the default texts the XML states on the invoice's behalf, such as the VAT exemption reason. Values: en, de, fr, auto. Defaults to auto: the language the invoice is written in, or English when that is none of the three or the AI cannot tell. Any other value is rejected with a 400 (errorCode 4002). |
| preserveOriginalPdf | boolean | true keeps your uploaded PDF as the visual layer and only embeds the XML into it, so the layout stays exactly as it was. Defaults to false: the API renders a new PDF from the extracted data, so the visible invoice shows the values the XML carries. A digital signature on the uploaded PDF does not survive the embedding. |
| includeAdvancedProperties | boolean | Adds an "Electronic invoice details" section at the end of the rendered PDF that lists the technical properties the embedded XML carries but a classic invoice layout does not show: specification and business process identifiers, party identifiers with their schemes, electronic addresses and line-level references. That way those values can be checked on the pages themselves. Defaults to true; send false for the classic layout alone. Has no effect when preserveOriginalPdf is true. |
| validationLanguage | string | Language of the finding messages when the generated invoice is rejected. Values: en, de, fr. Defaults to en. Only each finding's message changes; rule ids and field paths stay the same. Independent of language. Any other value is rejected with a 400 (errorCode 4002). See localized error messages. |
Content-Type: multipart/form-data
The source and target formats are part of the endpoint path, and everything else (syntax, declared profile, specification identifier) is read from the document itself.
Headers
| Header | Value |
|---|---|
| Authorization * | Bearer YOUR_API_KEY |
| Content-Type | multipart/form-data |
Response
200 Converted invoice
Returns the ZUGFeRD PDF as a binary file.
AI output requires human review of the structured data before use
With ZUGFeRD, one file holds two things: the PDF you see and the XML inside it. The XML is what the recipient's software and the tax authority process, so that is what you must check.
By default the visual layer is drawn from the same AI data as the XML and ends with an "Electronic invoice details" section that lists the technical properties of the XML (identifiers, electronic addresses, references), so the pages also show the technical values of the XML. If you keep your original PDF (preserveOriginalPdf), it always looks right, even when the XML is not. Either way, compare these values in the XML against your source PDF:
- Seller and buyer names, addresses and tax identifiers
- Invoice number, issue date, due date and payment terms
- Line items, quantities, unit prices and line totals
- Tax rates, tax amounts and invoice totals
- Payment details, such as the IBAN
To see the XML in a readable form:
- Open the file in the ZUGFeRD viewer on GetZUGFeRD. It shows what the embedded XML contains.
- Or use our API: pull the XML out with POST /v1/extract/xml, then render it as a PDF with POST /v1/render/xml/to/pdf.
The rendered PDF is built only from the XML values, so what you read there is exactly what the recipient's system receives. Only send, book or submit the invoice once every value matches. Our Terms of Service require this review for all AI output.
Useful resources
Companion material for integrating against the API.
Runnable ZUGFeRD integration samples in C#, Java, PHP, Python, Node.js, and browser JavaScript, ready to clone and adapt.
InvoiceXML/zugferd-api-examples
Run this endpoint on your own file or data straight from your browser, no code and no sign-up required.
www.invoicexml.com/api/transform/zugferd
The full OpenAPI 3.1 document. Drop it into Postman, Insomnia, or any code generator to scaffold a client.
api.invoicexml.com/v1/openapi
Browse and call every endpoint directly from the browser, powered by Scalar.
api.invoicexml.com/v1/scalar
Frequently Asked Questions
Ready to automate your invoices?
Validate, convert and embed compliant e-invoices through one API. Start your 30-day free trial. No credit card required.