E-Invoicing API: How It Works – Create, Read and Validate EN 16931 E-Invoices
Key facts
- An e-invoicing API creates, reads and validates electronic invoices according to the European standard EN 16931 – the basis of XRechnung (Germany), ZUGFeRD/Factur-X (Germany/France) and Peppol BIS Billing.
- The e2invoice REST API has three core endpoints: create (
POST /api/invoice/simple), read (POST /api/invoice/read) and validate (POST /api/invoice/validate). - Output is ZUGFeRD/Factur-X, profile EN 16931: a PDF/A-3 with embedded XML that is both human-readable and machine-processable.
- Free: 10 calls per day without sign-up, unlimited with a free API key. Full OpenAPI specification at /api/docs.
Why e-invoicing APIs exist
Across the EU, invoices are moving from PDF and paper to structured data. Germany requires all businesses to receive e-invoices since 1 January 2025 and to issue them for domestic B2B transactions from 2027 (turnover above €800,000) or 2028 (all businesses). France, Belgium, Poland and others have their own mandates, all built on EN 16931.
Building this yourself means implementing two XML syntaxes (UBL and UN/CEFACT CII), dozens of code lists, around 200 business rules and PDF/A-3 embedding. An API reduces that to one JSON request.
How an e-invoicing API works
| Step | Outgoing invoice (create) | Incoming invoice (read) |
|---|---|---|
| 1 | Your system sends invoice data as JSON | Your system uploads an XML or PDF file |
| 2 | API calculates line totals, VAT per rate and document totals | API extracts the embedded XML from PDFs |
| 3 | Values are mapped to EN 16931 business terms (BT-1 invoice number, BT-112 total incl. VAT, …) | UBL or CII is parsed into one normalised model |
| 4 | XML is generated and embedded into a PDF/A-3 | Business rules (BR, BR-CO, BR-DE) are checked |
| 5 | You download the finished e-invoice | You receive JSON data plus a validation report |
The business terms (BT) are the common language: an invoice number is always BT-1 and the amount due is always BT-115, whatever the syntax or country. That is why one API can serve XRechnung, ZUGFeRD and Factur-X.
Endpoints
| Method | Path | Purpose | Counts towards daily limit |
|---|---|---|---|
| POST | /api/invoice/simple |
Create an e-invoice from JSON | yes |
| GET | /api/invoice/{id}/pdf |
Download the PDF with embedded XML (valid 24 h) | no |
| POST | /api/invoice/read |
Parse XML/PDF, return data as JSON | yes |
| POST | /api/invoice/validate |
Validate XML/PDF against EN 16931 and XRechnung | yes |
| GET | /api/invoice/rate-limit |
Remaining free daily quota | no |
Authentication and limits
Without a key you can make 10 calls per day. For production use, log in, create a free key under Dashboard → API Keys and send it with every request:
-H "x-api-key: e2i_YOUR_API_KEY"
# or
-H "Authorization: Bearer e2i_YOUR_API_KEY"
With a key there is no limit. Without a key, every counted response includes X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset; once the quota is used up the API answers HTTP 429 with Retry-After.
Create an e-invoice
curl -X POST https://www.e2invoice.com/api/invoice/simple \
-H "Content-Type: application/json" \
-H "x-api-key: e2i_YOUR_API_KEY" \
-d '{
"invoiceNumber": "INV-2026-001",
"invoiceDate": "2026-11-08",
"dueDate": "2026-11-22",
"buyerReference": "PO-4711",
"seller": {
"name": "Muster GmbH",
"address": "Hauptstraße 1",
"postCode": "10115",
"city": "Berlin",
"email": "billing@muster.de",
"phone": "+49 30 123456",
"contactPerson": "Max Mustermann",
"vatId": "DE123456789"
},
"buyer": {
"name": "Kunde AG",
"address": "Kundenweg 2",
"postCode": "80331",
"city": "München"
},
"items": [
{ "name": "Consulting", "quantity": 8, "unit": "HUR", "price": 120, "vatRate": 19 }
],
"bankAccount": { "iban": "DE89370400440532013000", "bic": "COBADEFFXXX" }
}'
The response contains a configId and a documentUrl. Download the e-invoice from there:
curl -o INV-2026-001.pdf "https://www.e2invoice.com/api/invoice/<configId>/pdf"
Useful options: documentType (invoice, credit_note, corrected_invoice, cancellation, prepayment_invoice, partial_invoice, final_invoice), items[].vatCategory and items[].vatExemptionReason for reverse charge, intra-community supplies or exports, and "store": true to keep the invoice in your account. Invalid input returns HTTP 400 with a list of all errors and their field paths.
Read an incoming e-invoice
curl -X POST https://www.e2invoice.com/api/invoice/read \
-H "x-api-key: e2i_YOUR_API_KEY" \
-F "file=@incoming-invoice.xml"
The response contains the normalised invoice (invoice) with seller, buyer, lines, VAT breakdown, totals, payment details, attachments and preceding invoice references, the validation result (validation) and the raw XML (xml). Field names are identical whether the source was UBL or CII, so one import routine covers every format.
Validate an e-invoice
const form = new FormData();
form.append('file', fileInput.files[0]);
const response = await fetch('https://www.e2invoice.com/api/invoice/validate', {
method: 'POST',
headers: { 'x-api-key': 'e2i_YOUR_API_KEY' },
body: form,
});
const result = await response.json();
if (!result.valid) {
for (const error of result.errors) {
console.log(`${error.rule} (${error.path}): ${error.message}`);
}
}
Each finding carries the rule ID (for example BR-CO-15: total incl. VAT ≠ total excl. VAT + VAT), the affected business term (BT-112) and a description. The result also reports the detected format, profile and syntax. A German reference of all rule codes is available at XRechnung-Fehlercodes.
Choosing an e-invoicing API: checklist
| Criterion | Why it matters | e2invoice |
|---|---|---|
| EN 16931 compliance | Required for legally valid e-invoices in the EU | ✓ profile EN 16931 |
| Read UBL and CII | Incoming invoices arrive in both syntaxes | ✓ |
| Validation with clear messages | Rejections by portals are costly | ✓ BR, BR-CO, BR-DE rules |
| Hybrid PDF output | Customers without e-invoicing software can still read the invoice | ✓ ZUGFeRD/Factur-X |
| Data location | GDPR, confidentiality of invoice data | ✓ servers in Germany, no storage of read/validated files |
| Price | Many APIs charge per document | ✓ free, unlimited with API key |
| Network delivery (Peppol, EDIFACT) | Needed for some public buyers and large retailers | not included – use a Peppol access point |
Data protection
Invoice data for creating documents is kept for 24 hours so that the PDF can be downloaded, then deleted automatically. Files sent to read and validate are not stored. All servers are located in Germany.
Ready to start? Open the API documentation or try the web tools without code: create, open and validate an e-invoice.