Automation MCP Server Blog Pricing

AI PDF to XRechnung API

Convert a PDF invoice into an XRechnung-compliant XML for German B2G electronic invoicing.

POST https://api.invoicexml.com/v1/transform/to/xrechnung
  • Typed, scanned or photographed PDFs
  • Your Leitweg-ID set as buyer reference
  • EN 16931 and KoSIT rules checked
  • Ready for ZRE, OZG-RE and Peppol

Technical reference

Convert a PDF invoice into a XRechnung-compliant XML document. Our engine reads your invoice data from a PDF, and generates a validated XRechnung XML automatically. XRechnung is Germany's national CIUS (Core Invoice Usage Specification) of the EN 16931 standard and is mandatory for all invoices sent to German federal, state, and municipal authorities.

Review every result before you use it

AI can make mistakes. Before you send the invoice or submit it to an authority, check every value in the XML against the source PDF, including the XML embedded in a ZUGFeRD or Factur-X PDF, not only the visual layer.

Code Example

curl -X POST https://api.invoicexml.com/v1/transform/to/xrechnung \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "[email protected]" \
  -F "buyerReference=04011000-12345-34" \
  -F "validationLanguage=de"

Request

Parameter Type Description
file * binary The invoice file to process.
buyerReference * string The buyer reference (BT-10), for German public buyers the Leitweg-ID. Replaces anything the AI read from the PDF.
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. 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.

Default texts the XML needs but the invoice does not state, such as the payment terms or the VAT exemption reason, are written in the language the invoice is written in: English, German or French, or English for any other language.

Headers

Header Value
Authorization * Bearer YOUR_API_KEY
Content-Type multipart/form-data

Response

200 Converted invoice

Returns the XRechnung XML document.

Content-Type: application/xml

AI output requires human review of the structured data before use

With XRechnung, the XML is the invoice. It is what the recipient's software and the tax authority process, so every value in it must be checked before you send it.

The XML is what the AI produced from your PDF. Compare these values in it 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:

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.

Frequently Asked Questions

What is XRechnung?

XRechnung is the German implementation (CIUS) of EN 16931. It adds stricter validation rules on top of the European core standard and is mandatory for B2G invoicing with German government entities since November 2020.

Do I need a Leitweg-ID?

Yes. German government recipients require a Leitweg-ID (routing identifier) in the buyer reference (BT-10). Send it in the buyerReference form field: it is required on this endpoint and replaces anything the AI read from the PDF.

What is the difference between XRechnung and ZUGFeRD?

XRechnung produces a standalone XML file for B2G portals (e.g., ZRE, OZG-RE). ZUGFeRD produces a hybrid PDF with embedded XML, primarily for B2B exchange. Both can satisfy EN 16931 requirements.

Which XRechnung version is generated?

The API generates the latest XRechnung specification, aligned with the current KoSIT validation rules.

Which syntax does the output use?

UBL, the XRechnung default across the API. German portals accept both official syntaxes; if you need the UN/CEFACT CII binding, create the invoice via POST /v1/create/xrechnung with options.syntax set to cii.

Where do I submit XRechnung invoices?

XRechnung invoices are typically submitted via the Peppol network or uploaded directly to the ZRE (Zentrale Rechnungseingangsplattform) or OZG-RE portals.

Start free today

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.

GDPR Compliant No credit card required Setup in minutes
Peppol UBL
Factur-X
EN 16931
142 / 142 passed
Compliant
PDF/A-3 embedded