XRechnung API

Create EN 16931 compliant XRechnung e-invoices from a simple JSON request. Ready for German public sector buyers and Germany's B2B e-invoicing mandate.

Get Your Free API Key Read the docs

No credit card required

What is XRechnung?

XRechnung is Germany's standard for electronic invoices. It is based on the European standard EN 16931 and is maintained by KoSIT, the coordination office for IT standards of the German public administration.

Unlike a PDF, an XRechnung is a structured XML file. The buyer's accounting software reads the seller, the buyer, every line item, the VAT and the payment details directly, without anyone typing them in. That is why the German government, and soon every German business, requires invoices in a format like this.

InvoicingAPI creates XRechnung 3.0 files in the CII syntax (UN/CEFACT Cross Industry Invoice) from the same JSON request you would use for a PDF invoice.

At a glance

  • Standard: XRechnung 3.0, EN 16931
  • Syntax: CII (UN/CEFACT Cross Industry Invoice)
  • File type: XML
  • Validation: official KoSIT validator rules
  • Public sector: Leitweg-ID support
  • Testing: free with your sandbox API key

Who needs XRechnung?

Germany is replacing paper and PDF invoices between businesses with e-invoices in stages. If you invoice German companies or public authorities, or build software that does, these are the dates that matter.

Since 2020

Suppliers to German federal authorities must send e-invoices, and most federal states have followed. Public buyers usually ask for XRechnung with their Leitweg-ID.

1 January 2025

Every business in Germany must be able to receive e-invoices from other businesses.

1 January 2027

Businesses with a turnover over €800,000 in the previous year must send e-invoices to other businesses.

1 January 2028

Every business must send e-invoices to other businesses. Small invoices up to €250 are exempt.

This is a summary, not tax advice. Check with your tax advisor which rules apply to your business.

One request, one XRechnung

Send your invoice as JSON with an eInvoice object. InvoicingAPI calculates the totals and VAT using the EN 16931 rounding rules and returns the XRechnung XML file. If a required field is missing, the response lists every problem at once.

Request

curl -X POST "https://dev.invoicingapi.com/v1/invoice/createinvoice" \
    -H "ApiKey: __YOUR_API_KEY__" \
    -H "Content-Type: application/json" \
    -d '{
          "invoiceNumber": "RE-2026-001",
          "issueDate": "2026-11-04",
          "dueDate": "2026-12-04",
          "currency": "EUR",
          "issuerAddress": {
              "name": "Muster Software GmbH",
              "addressLine1": "Hauptstrasse 1",
              "city": "Berlin",
              "postalCode": "10115",
              "countryCode": "DE",
              "contactName": "Max Muster",
              "telephone": "+49 30 123456",
              "email": "billing@muster-software.example",
              "vatNo": "DE123456789"
          },
          "recipientAddress": {
              "name": "Beispiel AG",
              "addressLine1": "Marktplatz 5",
              "city": "Hamburg",
              "postalCode": "20095",
              "countryCode": "DE",
              "email": "invoices@beispiel.example"
          },
          "taxData": {
              "type": "VAT",
              "percentage": 19
          },
          "lineItems": [
              {
                  "description": "Software development",
                  "quantity": 12.5,
                  "unitPrice": 95,
                  "unitCode": "HUR"
              },
              {
                  "description": "Licence",
                  "quantity": 3,
                  "unitPrice": 49.99
              }
          ],
          "eInvoice": {
              "format": "xrechnung",
              "buyerReference": "PO-4711",
              "payment": {
                  "iban": "DE02120300000000202051",
                  "bic": "BYLADEM1001",
                  "accountName": "Muster Software GmbH"
              },
              "paymentTerms": "Payable within 30 days"
          }
        }' \
    -o RE-2026-001.xml

Response (shortened)

<rsm:CrossIndustryInvoice ...>
  <rsm:ExchangedDocumentContext>
    <ram:GuidelineSpecifiedDocumentContextParameter>
      <ram:ID>urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0</ram:ID>
    </ram:GuidelineSpecifiedDocumentContextParameter>
  </rsm:ExchangedDocumentContext>
  <rsm:ExchangedDocument>
    <ram:ID>RE-2026-001</ram:ID>
    <ram:TypeCode>380</ram:TypeCode>
    ...
  </rsm:ExchangedDocument>
  <rsm:SupplyChainTradeTransaction>
    <ram:IncludedSupplyChainTradeLineItem>
      <ram:SpecifiedTradeProduct>
        <ram:Name>Software development</ram:Name>
      </ram:SpecifiedTradeProduct>
      ...
      <ram:BilledQuantity unitCode="HUR">12.5000</ram:BilledQuantity>
      ...
    </ram:IncludedSupplyChainTradeLineItem>
    ...
    <ram:ApplicableHeaderTradeSettlement>
      <ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
      ...
      <ram:SpecifiedTradeSettlementHeaderMonetarySummation>
        <ram:LineTotalAmount>1337.47</ram:LineTotalAmount>
        <ram:TaxBasisTotalAmount>1337.47</ram:TaxBasisTotalAmount>
        <ram:TaxTotalAmount currencyID="EUR">254.12</ram:TaxTotalAmount>
        <ram:GrandTotalAmount>1591.59</ram:GrandTotalAmount>
        <ram:DuePayableAmount>1591.59</ram:DuePayableAmount>
      </ram:SpecifiedTradeSettlementHeaderMonetarySummation>
    </ram:ApplicableHeaderTradeSettlement>
  </rsm:SupplyChainTradeTransaction>
</rsm:CrossIndustryInvoice>

Send the file by email, upload it to the buyer's portal (for German federal authorities, ZRE or OZG-RE), or hand it to your Peppol access point.

What's supported

VAT

Standard and reduced rates, different rates per line item, zero-rated, exempt, reverse charge, exports outside the EU, and invoices not subject to VAT.

Public sector

Add the buyer's Leitweg-ID and it is used as the buyer reference and electronic address, as German public authorities require.

Correct totals

Line totals, VAT and the amount due are calculated with the EN 16931 rounding rules, including discounts, prices that include VAT, and invoices that are already paid.

Payment details

SEPA credit transfer with IBAN, BIC and account name, your payment terms and the due date.

Line item details

UN/ECE unit codes such as hours, days or pieces, the delivery date, and the buyer's order number or reference.

Validated output

Our output is tested against the official KoSIT validator and the XRechnung 3.0 rules. Requests with missing or inconsistent data are rejected with a clear list of what to fix.

Test for free, then go live

Sandbox

Every account comes with a sandbox API key. Use it to build and test your integration with up to 200 e-invoices a day. Sandbox e-invoices are marked "SANDBOX - NOT A VALID INVOICE" and don't count towards your plan.

Pricing

An e-invoice counts as one invoice. The Free plan includes 10 invoices a month, and the Standard plan includes unlimited invoices for €5 a month. See the Pricing page. Sending thousands of e-invoices a month? Email us and we'll help with your integration.

XRechnung FAQ

What is the difference between XRechnung and ZUGFeRD?

Both follow EN 16931 and are accepted for B2B invoices in Germany. XRechnung is an XML file only. ZUGFeRD is a PDF with the same kind of XML embedded inside it, so people can read it and software can process it. German public authorities usually ask for XRechnung. InvoicingAPI creates XRechnung today. If you need ZUGFeRD or Factur-X, let us know.

Do you create the UBL or the CII syntax?

CII (UN/CEFACT Cross Industry Invoice). XRechnung allows both syntaxes, and receivers in Germany have to accept both.

Do I need a Leitweg-ID?

Only when you invoice a German public authority. The authority gives you its Leitweg-ID, usually with the order. Pass it as eInvoice.buyerLeitwegId. For businesses, use eInvoice.buyerReference with their order number or reference instead.

Can my customers still get a PDF?

The XML file is the invoice, and your customer's accounting software displays it. If you also want a readable copy, send the same request without the eInvoice object to get a PDF from any of our templates.

What happens if my request is missing something?

XRechnung needs more information than a PDF invoice, such as postal codes, country codes, the seller's contact details, VAT number and IBAN. If anything is missing or the amounts don't add up, the API returns a 400 response listing every problem, so you can fix them all in one go.

Does my business have to be in Germany?

No. XRechnung is the format German buyers expect, but the seller can be based anywhere. Set the countryCode of both addresses, and use the reverse charge or export tax categories where they apply.

Create your first XRechnung in minutes

Get Your Free API Key
No credit card required