curatedapi

XRechnung creator (UBL or CII)

Send the invoice as JSON, get back an XRechnung 3.0 file that passes KoSIT's official validator.

What it does

Builds an XRechnung 3.0 invoice or credit note in UBL 2.1 or UN/CEFACT CII from plain JSON, works out every total the way EN 16931 defines it, and runs KoSIT's validator configuration on the file before returning it. If any rule fails, no file is returned and the call is not billed.

  • XRechnung needs a buyer reference (the Leitweg-ID for public buyers), the seller's contact name, phone and email, both parties' electronic addresses and payment instructions.

The totals are worked out once, the way EN 16931 defines them: each line's net amount, the VAT for each rate and category, and the amount due. The answer gives them next to the file, so your app can compare them with its own. A file that breaks an official rule is never returned: the call fails with INVOICE_NOT_VALID, names each rule and the field to look at, and is not billed.

The invoice is not stored, logged or cached. It is held in memory for the length of the call.

Rules every file is checked with

A check shows whether the invoice passes the official rule sets listed, at the versions listed. It is not legal or tax advice, and passing does not promise that a tax authority or buyer will accept the invoice. See the terms.

Use it from your code

POST /v1/create/einvoice/xrechnungVersion 1
curl https://api.curatedapi.com/v1/create/einvoice/xrechnung \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "invoice": {"number": "123456XX", "issue_date": "2016-04-04", "currency": "EUR", "buyer_reference": "04011000-12345-03", "notes": ["#ADU#Es gelten unsere Allgem. Geschäftsbedingungen, die Sie unter […] finden."], "seller": {"name": "[Seller name]", "trading_name": "[Seller trading name]", "address": {"line1": "[Seller address line 1]", "city": "[Seller city]", "postcode": "12345", "country": "DE"}, "vat_id": "DE 123456789", "registration_id": "[HRA-Eintrag]", "legal_info": "123/456/7890, HRA-Eintrag in […]", "electronic_address": "[email protected]", "contact": {"name": "nicht vorhanden", "phone": "+49 1234-5678", "email": "[email protected]"}}, "buyer": {"name": "[Buyer name]", "id": "[Buyer identifier]", "address": {"line1": "[Buyer address line 1]", "city": "[Buyer city]", "postcode": "12345", "country": "DE"}, "electronic_address": "[email protected]"}, "payment": {"method": "sepa_credit_transfer", "iban": "DE79000000001234567890", "terms": "Zahlbar sofort ohne Abzug."}, "lines": [{"id": "Zeitschrift [...]", "name": "Zeitschrift [...]", "description": "Zeitschrift Inland", "note": "Die letzte Lieferung im Rahmen des abgerechneten Abonnements erfolgt in 12/2016 Lieferung erfolgt / erfolgte direkt vom Verlag", "quantity": 1, "unit": "XPP", "unit_price": "288.79", "vat_category": "S", "vat_rate": 7, "seller_item_id": "246", "order_line_reference": "6171175.1", "period": {"start": "2016-01-01", "end": "2016-12-31"}}, {"id": "Porto + Versandkosten", "name": "Porto + Versandkosten", "quantity": 1, "unit": "XPP", "unit_price": "26.07", "vat_category": "S", "vat_rate": 7}]}
  }'
200 OKKoSIT test case 01.01a rebuilt from JSON, files shortened
{
  "creator": "einvoice/xrechnung@1",
  "result": {
    "valid": true,
    "format": "XRechnung 3.0 (UBL 2.1)",
    "specification_id": "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0",
    "filename": "123456XX.xml",
    "totals": {
      "currency": "EUR",
      "line_total": "314.86",
      "allowance_total": "0.00",
      "charge_total": "0.00",
      "total_without_vat": "314.86",
      "vat_total": "22.04",
      "total_with_vat": "336.90",
      "prepaid_amount": "0.00",
      "rounding_amount": "0.00",
      "amount_due": "336.90",
      "vat_breakdown": [
        {
          "category": "S",
          "rate": "7",
          "taxable_amount": "314.86",
          "vat_amount": "22.04"
        }
      ],
      "lines": [
        {
          "id": "Zeitschrift [...]",
          "net_amount": "288.79"
        },
        {
          "id": "Porto + Versandkosten",
          "net_amount": "26.07"
        }
      ]
    },
    "check": {
      "scenario": "EN16931 XRechnung (UBL Invoice)",
      "document_type": "UBL Invoice",
      "specification_id": "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0",
      "errors": 0,
      "warnings": 0,
      "notices": 1,
      "error_rules": [],
      "checks": [
        {
          "check": "XML syntax",
          "passed": true
        },
        {
          "check": "XML Schema for UBL 2.1 Invoice",
          "passed": true
        },
        {
          "check": "Schematron rules for EN16931 (UBL)",
          "passed": true
        },
        {
          "check": "Schematron rules for Invoice - CIUS XRechnung (UBL)",
          "passed": true
        }
      ],
      "messages": [
        {
          "rule": "BR-DE-TMP-32",
          "level": "information",
          "message": "[BR-DE-TMP-32] Eine Rechnung sollte zur Angabe des Liefer-/Leistungsdatums entweder BT-72 \"Actual delivery date\", BG-14 \"Invoicing period\" oder in jeder Rechnungsposition BG-26 \"Invoice line period\" enthalten.",
          "check": "Schematron rules for Invoice - CIUS XRechnung (UBL)",
          "location": "/Q{urn:oasis:names:specification:ubl:schema:xsd:Invoice-2}Invoice[1]"
        }
      ],
      "messages_truncated": false
    },
    "xml": "<?xml version='1.0' encoding='UTF-8'?>\n<Invoice xmlns=\"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2\" xmlns:cac=\"urn:oasis:names:specification:ubl:sche… (5,717 characters in all)"
  },
  "rules": [
    {
      "name": "KoSIT validator configuration for XRechnung 3.0.2",
      "version": "2026-08-31",
      "url": "https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/v2026-08-31/xrechnung-3.0.2-validator-configuration-2026-08-31.zip"
    }
  ]
}

MCP tool create_einvoice_xrechnung at https://mcp.curatedapi.com. Every input field, the results and the errors in the API reference.

Other e-invoice APIs

Send e-invoices from your app without writing XRechnung yourself

For invoicing apps, shop plugins and ERPs whose customers must send e-invoices: post the invoice as JSON and store or send the file that comes back. Each file has passed the official rules before you get it.

Free for up to 100 invoices created a month. 2,000 invoices created a month cost $9.00 on the Starter plan.