ZUGFeRD / Factur-X creator (PDF) API
Send the invoice as JSON, get back a ZUGFeRD / Factur-X PDF/A-3 with the XML inside, checked against the official rules.
POST https://api.curatedapi.com/v1/create/einvoice/zugferd
- Version 1
- MCP tool
create_einvoice_zugferd - Overview
Builds the CII XML for the EN 16931 profile (or the XRECHNUNG profile), draws a readable A4 invoice from the same data in German or English, and embeds the XML in a PDF/A-3b with the Factur-X metadata. The finished PDF is then read back and its XML checked with the Factur-X 1.09.2 / ZUGFeRD 2.5 rules (or KoSIT's, for XRECHNUNG). If any rule fails, no file is returned and the call is not billed.
- The PDF is drawn by us from the JSON. Bringing your own PDF layout is not supported yet.
- The PDF is written as PDF/A-3b by fpdf2, which enforces the PDF/A rules it knows; each PDF is not run through a separate PDF/A checker.
- Profiles MINIMUM, BASIC WL, BASIC and EXTENDED are not offered: MINIMUM and BASIC WL do not count as e-invoices in Germany.
Inputs
Send numbers as strings to keep every digit. A file that would break an official rule is not returned: the call fails with INVOICE_NOT_VALID (see creating e-invoices).
| Input | Type | Description |
|---|---|---|
profile |
en16931 | xrechnung default en16931 |
EN 16931 (also called COMFORT; default) or XRECHNUNG. |
language |
de | en default de |
Language of the PDF's text. The XML is the same either way. |
invoice required |
object | The invoice. Field names follow EN 16931; the BT numbers in the descriptions are the standard's own. |
invoice.type |
invoice | credit_note | corrected_invoice | partial_invoice | invoice (380, default), credit_note (381), corrected_invoice (384) or partial_invoice (326). |
invoice.number required |
string | Invoice number (BT-1). |
invoice.issue_date required |
date (YYYY-MM-DD) | BT-2, YYYY-MM-DD. |
invoice.due_date |
date (YYYY-MM-DD) | BT-9. |
invoice.currency |
string | ISO 4217 code; EUR when left out (BT-5). |
invoice.buyer_reference |
string | The buyer's reference; for German public buyers the Leitweg-ID. Required by XRechnung (BT-10). |
invoice.order_reference |
string | Purchase order number (BT-13). |
invoice.contract_reference |
string | BT-12. |
invoice.project_reference |
string | BT-11. |
invoice.preceding_invoice |
object | The invoice a credit note or corrected invoice refers to (BG-3). |
invoice.preceding_invoice.number |
string | |
invoice.preceding_invoice.issue_date |
date (YYYY-MM-DD) | |
invoice.delivery_date |
date (YYYY-MM-DD) | BT-72. |
invoice.period |
object | Invoicing period (BG-14). |
invoice.period.start |
date (YYYY-MM-DD) | |
invoice.period.end |
date (YYYY-MM-DD) | |
invoice.notes |
list of string | Invoice notes (BT-22). |
invoice.seller required |
object | |
invoice.seller.name required |
string | Legal name (BT-27 / BT-44). |
invoice.seller.trading_name |
string | Trading name, if different (BT-28 / BT-45). |
invoice.seller.address required |
object | |
invoice.seller.address.line1 |
string | Street and number (BT-35). |
invoice.seller.address.line2 |
string | Additional line (BT-36). |
invoice.seller.address.line3 |
string | Third line (BT-162). |
invoice.seller.address.city |
string | City (BT-37). |
invoice.seller.address.postcode |
string | Post code (BT-38). |
invoice.seller.address.region |
string | Region or state (BT-39). |
invoice.seller.address.country required |
string | ISO 3166 two-letter code, e.g. DE (BT-40). |
invoice.seller.vat_id |
string | VAT number with country prefix (BT-31 / BT-48). |
invoice.seller.registration_id |
string or object | Legal registration, e.g. HRB 12345 (BT-30 / BT-47). |
invoice.seller.id |
string or object | Seller or buyer identifier (BT-29 / BT-46). |
invoice.seller.electronic_address |
string or object | Where e-invoices are delivered (BT-34 / BT-49): an email address, or {"id", "scheme"} with an EAS code such as 0204 (Leitweg-ID) or 9930 (German VAT number). Required by XRechnung and Peppol. |
invoice.seller.contact |
object | Contact person, phone and email (BG-6 / BG-9). XRechnung requires all three for the seller. |
invoice.seller.contact.name |
string | |
invoice.seller.contact.phone |
string | |
invoice.seller.contact.email |
string | |
invoice.seller.tax_number |
string | National tax number, e.g. Steuernummer (BT-32). |
invoice.seller.legal_info |
string | Additional legal information: managing directors, court of registration, share capital (BT-33). |
invoice.buyer required |
object | |
invoice.buyer.name required |
string | Legal name (BT-27 / BT-44). |
invoice.buyer.trading_name |
string | Trading name, if different (BT-28 / BT-45). |
invoice.buyer.address required |
object | |
invoice.buyer.address.line1 |
string | Street and number (BT-35). |
invoice.buyer.address.line2 |
string | Additional line (BT-36). |
invoice.buyer.address.line3 |
string | Third line (BT-162). |
invoice.buyer.address.city |
string | City (BT-37). |
invoice.buyer.address.postcode |
string | Post code (BT-38). |
invoice.buyer.address.region |
string | Region or state (BT-39). |
invoice.buyer.address.country required |
string | ISO 3166 two-letter code, e.g. DE (BT-40). |
invoice.buyer.vat_id |
string | VAT number with country prefix (BT-31 / BT-48). |
invoice.buyer.registration_id |
string or object | Legal registration, e.g. HRB 12345 (BT-30 / BT-47). |
invoice.buyer.id |
string or object | Seller or buyer identifier (BT-29 / BT-46). |
invoice.buyer.electronic_address |
string or object | Where e-invoices are delivered (BT-34 / BT-49): an email address, or {"id", "scheme"} with an EAS code such as 0204 (Leitweg-ID) or 9930 (German VAT number). Required by XRechnung and Peppol. |
invoice.buyer.contact |
object | Contact person, phone and email (BG-6 / BG-9). XRechnung requires all three for the seller. |
invoice.buyer.contact.name |
string | |
invoice.buyer.contact.phone |
string | |
invoice.buyer.contact.email |
string | |
invoice.delivery |
object | Deliver-to party and address (BG-13, BG-15). |
invoice.delivery.name |
string | |
invoice.delivery.address |
object | |
invoice.delivery.address.line1 |
string | Street and number (BT-35). |
invoice.delivery.address.line2 |
string | Additional line (BT-36). |
invoice.delivery.address.line3 |
string | Third line (BT-162). |
invoice.delivery.address.city |
string | City (BT-37). |
invoice.delivery.address.postcode |
string | Post code (BT-38). |
invoice.delivery.address.region |
string | Region or state (BT-39). |
invoice.delivery.address.country |
string | ISO 3166 two-letter code, e.g. DE (BT-40). |
invoice.delivery.location_id |
string or object | |
invoice.payment |
object | Payment instructions (BG-16). XRechnung requires them. |
invoice.payment.method |
sepa_credit_transfer | credit_transfer | sepa_direct_debit | sepa_credit_transfer (58), credit_transfer (30) or sepa_direct_debit (59). |
invoice.payment.iban |
string | The seller's account (BT-84). |
invoice.payment.bic |
string | BT-86. |
invoice.payment.account_name |
string | BT-85. |
invoice.payment.reference |
string | Remittance information (BT-83). |
invoice.payment.terms |
string | Payment terms as text (BT-20). |
invoice.payment.mandate_reference |
string | Direct debit mandate (BT-89). |
invoice.payment.creditor_id |
string | SEPA creditor ID (BT-90). |
invoice.payment.debtor_iban |
string | The account debited (BT-91). |
invoice.lines required |
list of objects | |
invoice.lines[].id |
string | Line number; 1, 2, 3 … when left out (BT-126). |
invoice.lines[].name required |
string | Item name (BT-153). |
invoice.lines[].description |
string | Item description (BT-154). |
invoice.lines[].note |
string | Line note (BT-127). |
invoice.lines[].quantity required |
['number', 'string'] | Up to 4 decimals; negative for a return. |
invoice.lines[].unit |
string | UN/ECE Recommendation 20 code: C62 piece (default), HUR hour, DAY day, MON month, KGM kilogram, LS lump sum … |
invoice.lines[].unit_price required |
['number', 'string'] | Net price per unit, up to 4 decimals (BT-146). |
invoice.lines[].price_base_quantity |
['number', 'string'] | The quantity the price is for, e.g. 100 for a price per 100 (BT-149). |
invoice.lines[].vat_category required |
S | Z | E | AE | K | G | O | S standard, Z zero, E exempt, AE reverse charge, K intra-EU supply, G export, O not subject to VAT (BT-151). |
invoice.lines[].vat_rate |
['number', 'string'] | Percent, e.g. 19; 0 for Z, E, AE, K, G; left out for O (BT-152). |
invoice.lines[].seller_item_id |
string | |
invoice.lines[].buyer_item_id |
string | |
invoice.lines[].standard_item_id |
string or object | E.g. {"id": "4012345001235", "scheme": "0160"} for a GTIN (BT-157). |
invoice.lines[].order_line_reference |
string | |
invoice.lines[].period |
object | |
invoice.lines[].period.start |
date (YYYY-MM-DD) | |
invoice.lines[].period.end |
date (YYYY-MM-DD) | |
invoice.lines[].allowances |
list of objects | |
invoice.lines[].allowances[].amount |
['number', 'string'] | A number, or a number as a string to keep every digit ("12.50"). |
invoice.lines[].allowances[].percent |
['number', 'string'] | Percentage of base_amount, instead of amount. |
invoice.lines[].allowances[].base_amount |
['number', 'string'] | Base for percent. On a line it defaults to quantity × price. |
invoice.lines[].allowances[].reason |
string | |
invoice.lines[].allowances[].reason_code |
string | UNTDID 5189 (allowances) or 7161 (charges). |
invoice.lines[].charges |
list of objects | |
invoice.lines[].charges[].amount |
['number', 'string'] | A number, or a number as a string to keep every digit ("12.50"). |
invoice.lines[].charges[].percent |
['number', 'string'] | Percentage of base_amount, instead of amount. |
invoice.lines[].charges[].base_amount |
['number', 'string'] | Base for percent. On a line it defaults to quantity × price. |
invoice.lines[].charges[].reason |
string | |
invoice.lines[].charges[].reason_code |
string | UNTDID 5189 (allowances) or 7161 (charges). |
invoice.allowances |
list of objects | Document allowances (BG-20). |
invoice.allowances[].amount |
['number', 'string'] | A number, or a number as a string to keep every digit ("12.50"). |
invoice.allowances[].percent |
['number', 'string'] | Percentage of base_amount, instead of amount. |
invoice.allowances[].base_amount |
['number', 'string'] | Base for percent. On a line it defaults to quantity × price. |
invoice.allowances[].reason |
string | |
invoice.allowances[].reason_code |
string | UNTDID 5189 (allowances) or 7161 (charges). |
invoice.allowances[].vat_category |
S | Z | E | AE | K | G | O | |
invoice.allowances[].vat_rate |
['number', 'string'] | A number, or a number as a string to keep every digit ("12.50"). |
invoice.charges |
list of objects | Document charges (BG-21). |
invoice.charges[].amount |
['number', 'string'] | A number, or a number as a string to keep every digit ("12.50"). |
invoice.charges[].percent |
['number', 'string'] | Percentage of base_amount, instead of amount. |
invoice.charges[].base_amount |
['number', 'string'] | Base for percent. On a line it defaults to quantity × price. |
invoice.charges[].reason |
string | |
invoice.charges[].reason_code |
string | UNTDID 5189 (allowances) or 7161 (charges). |
invoice.charges[].vat_category |
S | Z | E | AE | K | G | O | |
invoice.charges[].vat_rate |
['number', 'string'] | A number, or a number as a string to keep every digit ("12.50"). |
invoice.prepaid_amount |
['number', 'string'] | Already paid (BT-113). |
invoice.rounding_amount |
['number', 'string'] | BT-114. |
invoice.vat_exemption_reasons |
object | The reason for each VAT category other than S and Z, e.g. {"E": "Kleinunternehmer gemäß § 19 UStG"} or {"E": {"code": "VATEX-EU-132", "text": "…"}} (BT-120, BT-121). AE, K, G and O get the standard wording when left out; E must be given. |
Result
Under result in the answer, next to validator and rules (the official artefacts used, with their versions).
| Result | Type | Description |
|---|---|---|
valid | boolean | Always true: a file that breaks a rule is not returned. |
format | string | What was made, e.g. XRechnung 3.0 (UBL). |
specification_id | string | BT-24 as written in the file. |
filename | string | A file name made from the invoice number. |
xml | string | The XML embedded in the PDF, for systems that want it alone. |
totals | object | Every amount as EN 16931 calculates it, as strings with 2 decimals: line_total (BT-106), allowance_total, charge_total, total_without_vat (BT-109), vat_total (BT-110), total_with_vat (BT-112), prepaid_amount, rounding_amount, amount_due (BT-115), vat_breakdown (BG-23) and each line's net_amount (BT-131). |
check | object | The official rules' report on the file returned: the same answer the matching /v1/validate/einvoice/… endpoint gives. |
pdf | string | The PDF/A-3b, base64-encoded, with the XML embedded. |
pdf_filename | string |
Examples
FeRD sample EN16931_Einfach rebuilt from JSON
curl https://api.curatedapi.com/v1/create/einvoice/zugferd \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"profile": "en16931",
"language": "de",
"invoice": {"number": "471102", "issue_date": "2018-03-05", "currency": "EUR", "notes": ["Rechnung gemäß Bestellung vom 01.03.2018."], "seller": {"name": "Lieferant GmbH", "id": {"id": "4000001123452", "scheme": "0088"}, "address": {"line1": "Lieferantenstraße 20", "city": "München", "postcode": "80333", "country": "DE"}, "vat_id": "DE123456789", "tax_number": "201/113/40209", "legal_info": "Lieferant GmbH, Lieferantenstraße 20, 80333 München, Deutschland, Geschäftsführer: Hans Muster, Handelsregisternummer: H A 123"}, "buyer": {"name": "Kunden AG Mitte", "id": "GE2020211", "address": {"line1": "Kundenstraße 15", "city": "Frankfurt", "postcode": "69876", "country": "DE"}}, "delivery_date": "2018-03-05", "payment": {"terms": "Zahlbar innerhalb 30 Tagen netto bis 04.04.2018, 3% Skonto innerhalb 10 Tagen bis 15.03.2018"}, "lines": [{"name": "Trennblätter A4", "quantity": 20, "unit": "H87", "unit_price": "9.90", "vat_category": "S", "vat_rate": 19, "seller_item_id": "TB100A4", "standard_item_id": {"id": "4012345001235", "scheme": "0160"}}, {"name": "Joghurt Banane", "quantity": 50, "unit": "H87", "unit_price": "5.50", "vat_category": "S", "vat_rate": 7, "seller_item_id": "ARNR2", "standard_item_id": {"id": "4000050986428", "scheme": "0160"}}]}
}'
{
"creator": "einvoice/zugferd@1",
"result": {
"valid": true,
"format": "ZUGFeRD / Factur-X PDF/A-3, profile EN 16931",
"specification_id": "urn:cen.eu:en16931:2017",
"filename": "factur-x.xml",
"pdf_filename": "471102.pdf",
"totals": {
"currency": "EUR",
"line_total": "473.00",
"allowance_total": "0.00",
"charge_total": "0.00",
"total_without_vat": "473.00",
"vat_total": "56.87",
"total_with_vat": "529.87",
"prepaid_amount": "0.00",
"rounding_amount": "0.00",
"amount_due": "529.87",
"vat_breakdown": [
{
"category": "S",
"rate": "19",
"taxable_amount": "198.00",
"vat_amount": "37.62"
},
{
"category": "S",
"rate": "7",
"taxable_amount": "275.00",
"vat_amount": "19.25"
}
],
"lines": [
{
"id": "1",
"net_amount": "198.00"
},
{
"id": "2",
"net_amount": "275.00"
}
]
},
"check": {
"scenario": "Factur-X EN 16931",
"document_type": "UN/CEFACT CII",
"specification_id": "urn:cen.eu:en16931:2017",
"errors": 0,
"warnings": 0,
"notices": 0,
"error_rules": [],
"checks": [
{
"check": "Embedded invoice",
"passed": true
},
{
"check": "XML syntax",
"passed": true
},
{
"check": "Factur-X 1.09.2 EN 16931 schema",
"passed": true
},
{
"check": "Factur-X 1.09.2 EN 16931 rules",
"passed": true
}
],
"messages": [],
"messages_truncated": false
},
"xml": "<?xml version='1.0' encoding='UTF-8'?>\n<rsm:CrossIndustryInvoice xmlns:rsm=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100\" xmlns:ram=\"urn:un:unec… (6,854 characters in all)",
"pdf": "JVBERi0xLjcKJenr8b8KMSAwIG9iago8PAovQ291bnQgMQovS2lkcyBbNCAwIFJdCi9NZWRpYUJveCBbMCAwIDU5NS4yOCA4NDEuODldCi9UeXBlIC9QYWdlcwo+PgplbmRvYmoKMiAwIG9iago8PAovQWx0ZXJu… (51,492 characters in all)"
},
"rules": [
{
"name": "Factur-X 1.09.2 / ZUGFeRD 2.5 schemas and Schematron (FNFE-MPE and FeRD), as distributed with Mustang",
"version": "1.09.2",
"url": "https://github.com/ZUGFeRD/mustangproject/tree/1d633ab612856527d536a709ed53bedd2a4ea98c/validator/src/main/resources"
},
{
"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"
}
]
}
Rules used
- Factur-X 1.09.2 / ZUGFeRD 2.5 schemas and Schematron (FNFE-MPE and FeRD), as distributed with Mustang, version 1.09.2
- KoSIT validator configuration for XRechnung 3.0.2, version 2026-08-31
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.
Errors share one format; see errors. Billing, retries and batches work the same for every endpoint.