Core API

Invoice Creator API

Create e-invoices in various formats for 14 European 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 (no real invoices, unlimited requests)

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 },
22 "buyer": {
23 "name": "Kunde AG",
24 "street": "Kundenweg 42",
25 "city": "München",
26 "postalCode": "80331",
27 "countryCode": "DE",
28 "vatId": "DE987654321",
29 "email": "einkauf@kunde.de"
30 },
31 "countrySpecific": {
32 "buyerReference": "BUYER-REF-001"
33 },
34 "items": [
35 {
36 "position": 1,
37 "description": "Beratungsleistung",
38 "articleNumber": "CONS-001",
39 "quantity": 10,
40 "unit": "HUR",
41 "unitPrice": 150.00,
42 "taxRate": 19,
43 "taxCategoryCode": "S",
44 "netAmount": 1500.00,
45 "taxAmount": 285.00,
46 "grossAmount": 1785.00
47 }
48 ],
49 "paymentTerms": {
50 "dueDays": 30,
51 "description": "Zahlbar innerhalb von 30 Tagen ohne Abzug"
52 },
53 "notes": "Vielen Dank für Ihren Auftrag!"
54 }
55 }'

Response

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

json
1{
2 "success": true,
3 "format": "XRECHNUNG",
4 "filename": "RE-2025-001.xml",
5 "mimeType": "application/xml",
6 "hash": "a1b2c3d4e5f6789...sha256hash",
7 "data": "PD94bWwgdmVyc2lvbj0iMS4wIj8+...base64encoded...",
8 "errors": [],
9 "warnings": [
10 {
11 "code": "W001",
12 "message": "Optionales Feld 'buyerReference' nicht gesetzt",
13 "field": "buyer.reference"
14 }
15 ]
16}

Response Fields

FieldTypeDescription
successbooleanIndicates whether the invoice was successfully created
formatstringThe generated format (e.g. XRECHNUNG, ZUGFERD)
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 Ländercode: DE, AT, CH, FR, IT, ES, NL, BE, PT, PL, CZ, HU, RO, BG
formatrequiredstringZielformat: PDF, XRECHNUNG, ZUGFERD, FACTURX, FATTURAPA, FACTURAE, UBL, EBINTERFACE, QRBILL, ISDOC, NAV

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 (alle Länder)

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

Body Parameters

ParameterTypeRequiredDescription
invoiceNumberstringUnique invoice number of the issuer
typestringDocument type: "invoice" | "credit_note" | "proforma" | "correction". Default: "invoice"
issueDatestringInvoice date in YYYY-MM-DD format
dueDatestringDue date in YYYY-MM-DD format
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)
paymentTermsobjectPayment terms (dueDate, paymentTermsText)
paymentMethodsarray-Payment methods (type: bank_transfer|direct_debit|credit_card, details)
countrySpecificobject-Country-specific fields (DE: buyerReference, paymentMeansCode, leitwegId, 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 profile (MINIMUM, BASIC, EN16931, EXTENDED)

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)

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)

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 }

Supported Countries and Formats

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

DEGermany
PDFZUGFERD 2.3XRECHNUNG 3.0 *
ATAustria
PDFEBINTERFACE *
CHSwitzerland
PDFQR-BILL *
FRFrance
PDFFACTUR-X *
ITItaly
PDFFATTURAPA *
ESSpain
PDFFACTURAE *
NLNetherlands
PDFUBL *
BEBelgium
PDFUBL *
PTPortugalQ2.2026
PDF *
PLPolandQ2.2026
PDF *
CZCzech RepublicQ2.2026
PDFISDOC *
HUHungaryQ2.2026
PDFNAV *
RORomaniaQ2.2026
PDF *
BGBulgariaQ2.2026
PDF *

* Recommended format for the country | = Available | Q2.2026 = Planned

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.

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
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