Create XRechnung Invoice using REST-API
Generate a complete XRechnung-compliant XML invoice from structured form data. Submit seller and buyer details, line items, totals, and Leitweg-ID — the API produces a valid XRechnung 3.0 CII XML document, validated against EN 16931 Schematron rules and KoSIT CIUS constraints, ready for submission to German government portals (ZRE, OZG-RE) or via the Peppol network.
/v1/create/xrechnung
Request
Submit invoice data as multipart/form-data.
All monetary values use decimal format (e.g. 1234.56).
Invoice Header
| Field | Type | Description |
|---|---|---|
| InvoiceNumber * | string | Unique invoice identifier (e.g. INV-2025-001). |
| IssueDate * | string | Issue date in YYYY-MM-DD format. |
| PaymentDueDate | string | Payment due date in YYYY-MM-DD format. |
| Currency * | string | ISO 4217 currency code (e.g. EUR, USD). |
Seller & Buyer
Both parties share the same field structure. Replace Seller with Buyer for the buyer fields.
| Field | Type | Description |
|---|---|---|
| SellerName * | string | Legal business name. |
| SellerLegalId | string | Legal registration number (e.g. SIRET, HRB). |
| SellerTaxId * | string | VAT identification number (e.g. DE123456789). |
| SellerStreet * | string | Street address. |
| SellerPostcode * | string | Postal code. |
| SellerCity * | string | City name. |
| SellerCountry * | string | ISO 3166-1 alpha-2 country code (e.g. DE, FR). |
Line Items
Submit one or more line items using indexed field names: Lines[0].Description, Lines[1].Description, etc.
| Field | Type | Description |
|---|---|---|
| Lines[n].Description * | string | Description of the goods or service. |
| Lines[n].Quantity * | decimal | Quantity of items. |
| Lines[n].UnitPrice * | decimal | Price per unit (net, excluding VAT). |
| Lines[n].LineTotal | decimal | Line net total. Auto-calculated from Quantity × UnitPrice if omitted. |
| Lines[n].UnitCode | string | UN/ECE Rec 20 unit code. Default: C62 (piece). Common: HUR (hour), DAY. |
| Lines[n].TaxPercentage * | decimal | VAT rate for this line (e.g. 19, 20). |
| Lines[n].TaxCategoryCode * | string | VAT category: S (standard), AE (reverse charge), E (exempt), G (export). |
Totals & Payment
| Field | Type | Description |
|---|---|---|
| LineTotalAmount * | decimal | Sum of all line net totals. |
| TaxTotalAmount * | decimal | Total VAT amount. |
| GrandTotalAmount * | decimal | Total payable amount (net + tax). |
| PaymentMeansCode | string | UNTDID 4461 code: 30 (credit transfer), 49 (SEPA DD), 54 (card). |
| IBAN | string | Seller bank account IBAN. |
| BIC | string | Seller bank BIC/SWIFT code. |
Headers
| Header | Value |
|---|---|
| Authorization * | Bearer YOUR_API_KEY |
| Content-Type | multipart/form-data |
Response
{
"type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
"title": "Model Validation Failed",
"status": 400,
"errorCode": 4002,
"detail": "One or more fields are invalid.",
"errors": {
"SellerName": ["Seller name is required."],
"Lines[0].Description": ["Line item description is required."]
}
}
{
"type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
"title": "XML Validation Failed",
"status": 400,
"errorCode": 4001,
"detail": "The generated invoice contains 2 validation error(s).",
"errors": {
"xml": [
"[BR-CO-15] Invoice total amount with VAT = 1785.00 expected 1500.00 + 285.00.",
"[BR-S-08] VAT category tax amount must equal category basis × rate."
]
}
}
Error Reference
Errors are returned as RFC 7807 ProblemDetails. The errorCode field indicates the error category.
| errorCode | Meaning | errors key |
|---|---|---|
| 4001 | XML validation — the generated XML violates EN 16931 Schematron rules. | errors.xml[] |
| 4002 | Model validation — one or more request fields are missing or invalid. | errors.{FieldName}[] |
| 4000 | General error — check detail for more information. |
— |
Code Example
curl -X POST https://api.invoicexml.com/v1/create/xrechnung \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "InvoiceNumber=INV-2025-001" \ -F "IssueDate=2025-07-01" \ -F "Currency=EUR" \ -F "SellerName=Acme GmbH" \ -F "SellerTaxId=DE123456789" \ -F "SellerStreet=Musterstr. 1" \ -F "SellerPostcode=10115" \ -F "SellerCity=Berlin" \ -F "SellerCountry=DE" \ -F "BuyerName=Example Corp" \ -F "BuyerTaxId=FR87654321012" \ -F "BuyerStreet=12 Rue de Rivoli" \ -F "BuyerPostcode=75001" \ -F "BuyerCity=Paris" \ -F "BuyerCountry=FR" \ -F "Lines[0].Description=Consulting Services" \ -F "Lines[0].Quantity=10" \ -F "Lines[0].UnitPrice=150.00" \ -F "Lines[0].UnitCode=HUR" \ -F "Lines[0].TaxPercentage=19" \ -F "Lines[0].TaxCategoryCode=S" \ -F "LineTotalAmount=1500.00" \ -F "TaxTotalAmount=285.00" \ -F "GrandTotalAmount=1785.00" \ -o invoice-xrechnung.xml
Frequently Asked Questions
What is the difference between /create/xrechnung and /create/zugferd?
The /create/zugferd endpoint produces a hybrid PDF/A-3 with embedded XML, ideal for B2B exchange. The /create/xrechnung endpoint produces a standalone XML document with stricter German CIUS rules, required for B2G submissions to government portals.
Is the Leitweg-ID required?
Yes. XRechnung mandates a Leitweg-ID (routing identifier) in the BuyerReference field for B2G invoicing. You must supply it in the request data — the API validates its presence before generating the output.
Which XRechnung version is generated?
The API generates XRechnung 3.0 in CII syntax by default, aligned with the latest KoSIT validation rules and the current German e-invoicing requirements.
Is the output validated automatically?
Yes. Every generated XRechnung invoice is validated against EN 16931 Schematron business rules and the additional XRechnung CIUS constraints before delivery. If validation fails, the API returns a 400 response with errorCode 4001 and the specific rule violations.
Where do I submit the generated XRechnung?
XRechnung invoices are typically submitted via the Peppol network or uploaded directly to the ZRE (Zentrale Rechnungseingangsplattform) or OZG-RE portals for German federal, state, and municipal authorities.