Core API

Invoice Creator API

Create e-invoices in various formats for 37 countries. Supports XRechnung, ZUGFeRD, Factur-X, FatturaPA and many more.

POST/api/v1/invoice/{countryCode}/{format}/generate

Example: POST /api/v1/invoice/de/xrechnung/generate

Authentication

The API uses Bearer Token authentication. Add your API key in the Authorization header:

bash
1Authorization: Bearer sk_live_abc123...

sk_test_* - Test mode for development — same response, same quota and same rate limit as a live key

sk_live_* - Live mode (production invoices, billed)

Example

bash
1curl -X POST https://service.invoice-api.xhub.io/api/v1/invoice/de/xrechnung/generate \
2 -H "Authorization: Bearer sk_live_abc123..." \
3 -H "Content-Type: application/json" \
4 -d '{
5 "invoice": {
6 "invoiceNumber": "RE-2025-001",
7 "type": "invoice",
8 "issueDate": "2025-01-15",
9 "dueDate": "2025-02-15",
10 "currency": "EUR",
11 "seller": {
12 "name": "Meine Firma GmbH",
13 "street": "Musterstraße 1",
14 "city": "Berlin",
15 "postalCode": "10115",
16 "countryCode": "DE",
17 "taxId": "123/456/78901",
18 "vatId": "DE123456789",
19 "email": "rechnung@meinefirma.de",
20 "phone": "+49 30 1234567",
21 "bankAccount": {
22 "iban": "DE89370400440532013000",
23 "bic": "COBADEFFXXX"
24 }
25 },
26 "buyer": {
27 "name": "Kunde AG",
28 "street": "Kundenweg 42",
29 "city": "München",
30 "postalCode": "80331",
31 "countryCode": "DE",
32 "vatId": "DE987654321",
33 "email": "einkauf@kunde.de"
34 },
35 "countrySpecific": {
36 "countryCode": "DE",
37 "buyerReference": "BUYER-REF-001"
38 },
39 "items": [
40 {
41 "position": 1,
42 "description": "Beratungsleistung",
43 "articleNumber": "CONS-001",
44 "quantity": 10,
45 "unit": "HUR",
46 "unitPrice": 150.00,
47 "taxRate": 19,
48 "taxCategoryCode": "S",
49 "netAmount": 1500.00,
50 "taxAmount": 285.00,
51 "grossAmount": 1785.00
52 }
53 ],
54 "subtotal": 1500.00,
55 "total": 1785.00,
56 "taxSummary": [
57 {
58 "taxRate": 19,
59 "netAmount": 1500.00,
60 "taxAmount": 285.00
61 }
62 ],
63 "paymentTerms": {
64 "dueDays": 30,
65 "description": "Zahlbar innerhalb von 30 Tagen ohne Abzug"
66 },
67 "paymentMethods": [
68 {
69 "type": "bank_transfer",
70 "details": "SEPA-Überweisung"
71 }
72 ],
73 "notes": "Vielen Dank für Ihren Auftrag!"
74 }
75 }'

Response

On success you will receive 200 OK with the created invoice object:

json
1{
2 "success": true,
3 "format": "xrechnung",
4 "filename": "RE-2026-0042.xml",
5 "mimeType": "application/xml",
6 "hash": "9f2c1b7d4e8a03f5c6b9d0e1a2f3c4b5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1",
7 "payloadHash": "3b1e6c5a9d2f04b7e8c1a0f3d6b9e2c5a8f1d4b7e0c3a6f9d2b5e8c1a4f7d0b3",
8 "data": "PD94bWwgdmVyc2lvbj0iMS4wIj8+...base64encoded...",
9 "errors": [],
10 "complianceErrors": [],
11 "warnings": [
12 {
13 "code": "MISSING_OPTIONAL",
14 "message": "Buyer reference is recommended for public-sector invoices",
15 "field": "countrySpecific.buyerReference"
16 }
17 ]
18}

Response Fields

FieldTypeDescription
successbooleanIndicates whether the invoice was successfully created
formatstringThe generated format, always lowercase (e.g. xrechnung, zugferd, facturx, pdf)
filenamestringSuggested filename for the invoice
mimeTypestringMIME type of the generated file (e.g. application/xml, application/pdf)
hashstringSHA-256 hash of the generated document
datastringBase64-encoded invoice data
errorsarrayList of errors (code, message, field)
warningsarrayList of warnings (code, message, field)

Request Parameters

Path Parameters

ParameterTypeDescription
countryCoderequiredstringISO 3166-1 alpha-2 country code, lower case — all 37: ae, at, au, be, bg, ch, cy, cz, de, dk, ee, es, fi, fr, gb, gr, hr, hu, ie, is, it, jp, li, lt, lu, lv, mt, nl, no, nz, om, pl, pt, ro, se, si, sk
formatrequiredstringTarget format — all 15: ebinterface, facturae, facturx, fatturapa, hr-fisk, isdoc, ksef, mydata, nav, pdf, peppol-ubl, qr-bill, ubl, xrechnung, zugferd

XRechnung (Germany)

/api/v1/invoice/de/xrechnung/generate

ZUGFeRD (Germany)

/api/v1/invoice/de/zugferd/generate

Factur-X (France)

/api/v1/invoice/fr/facturx/generate

FatturaPA (Italy)

/api/v1/invoice/it/fatturapa/generate

ebInterface (Austria)

/api/v1/invoice/at/ebinterface/generate

PDF (all countries)

/api/v1/invoice/de/pdf/generate

Body Parameters

ParameterTypeRequiredDescription
invoiceNumberstringUnique invoice number of the issuer
typestringDocument type: invoice | credit_note | correction | proforma | partial | partial_construction | partial_final_construction | final_construction | self_billed. Default: invoice. proforma is rejected with a 422 for XRechnung and Peppol BIS.
issueDatestringInvoice date in YYYY-MM-DD format
dueDatestring-Due date in YYYY-MM-DD format — optional, the spec does not list dueDate in invoice.required
deliveryDatestring-Delivery or service date in YYYY-MM-DD format
sellerobjectSeller/invoice issuer (details below)
buyerobjectBuyer/invoice recipient (details below)
itemsarrayInvoice line items (at least 1)
currencystringCurrency code (ISO 4217). Default: EUR
subtotalnumberNet total (automatically calculated if not provided)
totalnumberGross total (automatically calculated if not provided)
taxSummaryarrayTax summary by tax rates (automatically calculated)
orderNumberstring-Purchase order reference number
customerNumberstring-Customer number at the seller
contractNumberstring-Contract number
servicePeriodobject-Service period (start, end as ISO 8601 date)
paymentTermsobject-Payment terms (dueDays, description, earlyPaymentDiscount with days and discountPercent)
paymentMethodsarray-Payment methods (type: bank_transfer|direct_debit|credit_card …, details as free text) — for bank_transfer, seller.bankAccount with IBAN must be set
countrySpecificobject-Country-specific fields — countryCode is required (e.g. "DE"). For DE additionally: buyerReference (BT-10), paymentMeansCode (BT-81), leitwegId (B2G), isKleinunternehmer
notesstring-Free-text note on the invoice
templateIdstring-Reference to a saved PDF template by UUID
formatOptions.templatestring-Inline BlockTemplate JSON for PDF layout
formatOptions.zugferdProfilestring-ZUGFeRD / Factur-X profile: EN16931, BASIC or EXTENDED. On /generate the key is formatOptions.profile; zugferdProfile is only a legacy alias. MINIMUM and BASIC WL are rejected with a 400.

seller (Seller)

ParameterTypeRequiredDescription
namestringCompany name
tradingNamestring-Trading name (if different from legal name)
streetstringStreet and house number
additionalStreetstring-Additional address line
citystringCity
postalCodestringPostal code
statestring-State/region (ISO 3166-2)
countryCodestringCountry code (ISO 3166-1 alpha-2)
taxIdstring-Tax ID
vatIdstring-VAT ID (e.g. DE123456789)
emailstring-Email address
phonestring-Phone number
websitestring-Website URL
bankAccountobject-Bank account (iban, bic, bankName, accountHolder) — required as soon as paymentMethods contains a credit transfer (EN 16931, BR-61)

buyer (Buyer)

ParameterTypeRequiredDescription
namestringCompany name
tradingNamestring-Trading name (if different from legal name)
streetstringStreet and house number
additionalStreetstring-Additional address line
citystringCity
postalCodestringPostal code
statestring-State/region (ISO 3166-2)
countryCodestringCountry code (ISO 3166-1 alpha-2)
taxIdstring-Buyer tax ID
vatIdstring-Buyer VAT ID
emailstring-Email address
phonestring-Phone number
websitestring-Website URL
bankAccountobject-Bank account (iban, bic, bankName, accountHolder) — required as soon as paymentMethods contains a credit transfer (EN 16931, BR-61)

items[] (Line Items)

ParameterTypeRequiredDescription
positionnumberPosition number (automatically assigned if not provided)
descriptionstringLine item description
articleNumberstring-Article number
quantitynumberQuantity
unitstringUnit (UN/ECE Rec 20). Default: C62 (piece)
unitPricenumberUnit price net
taxRatenumberVAT rate in percent (e.g. 19, 7, 0)
taxCategoryCodestring-Tax category code (e.g. "S" for standard, "Z" for 0%, "E" for exempt)
netAmountnumberNet amount (calculated if not provided)
taxAmountnumberTax amount (calculated if not provided)
grossAmountnumberGross amount (calculated if not provided)

paymentTerms (Payment Terms)

ParameterTypeRequiredDescription
dueDaysnumber-Payment term in days (required)
descriptionstring-Free-text description of payment terms
earlyPaymentDiscountobject-Early-payment discount: { days, discountPercent }

37 supported countries and their formats

Use these combinations of countryCode and format in the endpoint path.

DEGermany
PDFZUGFeRD 2.3/2.4/2.5XRechnung 3.0/3.0.2 *
ATAustria
PDFebInterface *UBL (Peppol BIS 3.0)
CHSwitzerland
PDFZUGFeRD (CH)QR-Bill *
FRFrance
PDFFactur-X 1.0/1.08/1.09 *UBL (Peppol BIS 3.0)
ITItaly
PDFFatturaPA 1.2.3 *
ESSpain
PDFFacturae *UBL (Peppol BIS 3.0)
NLNetherlands
PDFUBL (Peppol BIS 3.0 / NL-CIUS)
BEBelgium
PDFUBL (Peppol BIS 3.0)Factur-X
PLPoland
PDFKSeF FA(3) (national UBL slot) *UBL (Peppol BIS 3.0)
PTPortugal
PDFCIUS-PT (national UBL) *UBL (Peppol BIS 3.0)
AEUnited Arab Emirates
PDFUBL (PINT-AE)
AUAustralia
PDFUBL (PINT AU-NZ)
BGBulgaria
PDFUBL (Peppol BIS 3.0)
CYCyprus
PDFUBL (Peppol BIS 3.0)
CZCzech Republic
PDFISDOC *UBL (Peppol BIS 3.0)
DKDenmark
PDFUBL (Peppol BIS 3.0)
EEEstonia
PDFUBL (Peppol BIS 3.0)
FIFinland
PDFUBL (Peppol BIS 3.0)
GBUnited Kingdom
PDFUBL (Peppol BIS 3.0 / UK)
GRGreece
PDFmyDATA *
HRCroatia
PDFUBL (Peppol BIS 3.0)
HUHungary
PDFNAV *
IEIreland
PDFUBL (Peppol BIS 3.0)
ISIceland
PDFUBL (Peppol BIS 3.0)
JPJapan
PDFUBL (PINT-JP)
LILiechtenstein
PDFQR-BillUBL (Peppol BIS 3.0)
LTLithuania
PDFUBL (Peppol BIS 3.0)
LULuxembourg
PDFUBL (Peppol BIS 3.0)
LVLatvia
PDFUBL (Peppol BIS 3.0)
MTMalta
PDFUBL (Peppol BIS 3.0)
NONorway
PDFUBL (Peppol BIS 3.0)
NZNew Zealand
PDFUBL (PINT AU-NZ)
OMOman
PDFUBL (PINT-OM)
RORomania
PDFeFactura (CIUS-RO) *UBL (Peppol BIS 3.0)
SESweden
PDFUBL (Peppol BIS 3.0)
SISlovenia
PDFUBL (Peppol BIS 3.0)
SKSlovakia
PDFUBL (Peppol BIS 3.0)

* Recommended format for the country | = Available

Leitweg-ID for Public Authorities (Germany)

For XRechnung invoices to public authorities (agencies, municipalities, etc.), the Leitweg-ID is mandatory. The format is: XXX-XXXXX-XX

You receive the Leitweg-ID from the contracting authority. A list of all Leitweg-IDs can be found in the official directory.

Limits

The number of invoice line items in items[] is capped per plan. The cap applies when generating, on both validate routes and when converting — not when parsing.

PlanLine items per invoice
Free25
Starter100
Premium1,000
Enterpriseindividually agreed

The API always rejects more than 15,000 line items per invoice. That is the service's technical ceiling, and only an Enterprise contract reaches it.

Response above the cap

Above the cap the API answers with HTTP 400 and the error code TOO_MANY_LINE_ITEMS. The response names the counted number and the limit; no invoice is produced and the call is not billed.

json
1{
2 "error": "TOO_MANY_LINE_ITEMS",
3 "message": "Too many line items for this plan",
4 "lineItems": {
5 "count": 128,
6 "limit": 100
7 }
8}

Which plan carries which cap: Pricing and line items per plan

Error Codes

HTTPCodeDescriptionSolution
400INVALID_REQUESTInvalid request dataCheck JSON format and required fields
400VALIDATION_FAILEDE-invoice does not match the schemaCheck error messages in errors array
400UNSUPPORTED_FORMATFormat not supported for this countryCheck supported formats for the selected country
400TOO_MANY_LINE_ITEMSThe invoice has more line items than the plan allowsRead lineItems.count and lineItems.limit, split the document or change plan — see Limits
401UNAUTHORIZEDMissing or invalid API keyCheck the Authorization header (sk_test_* or sk_live_*)
403FORBIDDENMissing required entitlementCheck the Authorization header (sk_test_* or sk_live_*)
422INVALID_VAT_IDInvalid VAT IDCheck the format (e.g. DE + 9 digits)
422INVALID_COUNTRYInvalid country codeUse a supported ISO 3166-1 alpha-2 code
429QUOTA_EXCEEDEDQuota exhaustedUpgrade your plan or wait until next month
500INTERNAL_ERRORInternal Server ErrorRetry the request or contact support

Full error list: Error Handling Documentation