AI PDF to XRechnung API
Convert a PDF invoice into an XRechnung-compliant XML for German B2G electronic invoicing.
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
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.
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:
- Upload it to our online XRechnung preview.
- Or use our API: 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 XRechnung integration samples in C#, Java, PHP, Python, Node.js, and browser JavaScript, ready to clone and adapt.
InvoiceXML/xrechnung-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/xrechnung
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.