Access: The API is included in the Pro plan. You create the API key in your account.
Endpoints
Check an e-invoice over the API
POST /v1/validate checks an e-invoice and answers with the check report. The check is synchronous: the answer is the result. The report also contains the invoice data read from the file. POST /v1/visualize returns a readable PDF for the same file.
Request
curl -sS https://api.erechnungsampel.de/v1/validate \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Accept-Language: en" \
-H "Content-Type: application/xml" \
--data-binary @invoice.xml| Body | the file as raw data, no multipart, 10 MB at most |
|---|---|
Content-Type | application/xml or text/xml for XRechnung and other XML invoices; application/pdf for ZUGFeRD and Factur-X |
Accept-Language | optional: de (default) or en. Sets the language of title and message and the language of the page explanation points to |
A PDF must have the invoice XML embedded. A PDF without embedded XML is not an e-invoice and results in red.
Answer 200: the check report
The example shows the report without the invoice field. Its content is described under Invoice data.
{
"traffic_light": "yellow",
"format": "xrechnung-cii",
"profile": "XRECHNUNG",
"rules_version": "XRechnung 3.0.2 / configuration 2026-08-31",
"violations": [
{
"rule": "BR-DE-27",
"severity": "warning",
"field": "BT-42",
"location": "/rsm:CrossIndustryInvoice[1]/rsm:SupplyChainTradeTransaction[1]/ram:ApplicableHeaderTradeAgreement[1]/ram:SellerTradeParty[1]/ram:DefinedTradeContact[1]",
"original_message": "[BR-DE-27] In BT-42 sollen mindestens drei Ziffern enthalten sein.",
"message": null,
"explanation": "https://erechnungsampel.de/en/rules/BR-DE-27"
}
],
"duration_ms": 388
}| Field | Content |
|---|---|
traffic_light | green, yellow or red |
format | xrechnung-cii, xrechnung-ubl, zugferd, en16931-ubl or unknown |
profile | EN16931, EXTENDED, XRECHNUNG, BASIC, BASIC-WL, MINIMUM or null |
rules_version | the rule set that was applied |
violations[].rule | rule ID, for example BR-DE-15, or one of our own rules starting with ERA- |
violations[].severity | error or warning |
violations[].field | the first EN 16931 field named (BT or BG), null if the rule names none |
violations[].location | XPath of the place in the document, or null |
violations[].original_message | the original text of the rule, unchanged |
violations[].message | our message in the language you asked for. It exists only for our own rules (ERA-); otherwise null |
violations[].explanation | link to the page of the rule, or null |
duration_ms | duration of the check in milliseconds |
invoice | the invoice data that was read, or null |
Invoice data
invoice holds the values read from the invoice XML, named after the EN 16931 fields (BT and BG). The field is present in every 200 answer.
{
"invoice": {
"number": "RE-2026-0042",
"type_code": "380",
"issue_date": "2026-11-20",
"due_date": "2026-12-04",
"currency": "EUR",
"buyer_reference": "04011000-12345-06",
"order_reference": null,
"seller": { "name": "Muster GmbH", "street": "Hauptstraße 1", "postal_code": "60311", "city": "Frankfurt am Main", "country": "DE", "vat_id": "DE123456789", "tax_number": null, "email": "rechnung@muster.example" },
"buyer": { "name": "Beispiel AG", "street": "Marktplatz 5", "postal_code": "10115", "city": "Berlin", "country": "DE", "vat_id": null, "tax_number": null, "email": null },
"lines": [
{ "id": "1", "name": "Beratung", "description": null, "quantity": "12.5", "unit": "HUR", "unit_price": "48.00", "net_amount": "600.00", "vat_category": "S", "vat_rate": "19" }
],
"lines_truncated": false,
"totals": { "net": "600.00", "vat": "114.00", "gross": "714.00", "prepaid": null, "payable": "714.00" },
"vat_breakdown": [
{ "category": "S", "rate": "19", "taxable": "600.00", "tax": "114.00", "exemption_reason": null }
],
"payment": { "terms": "Zahlbar innerhalb von 14 Tagen", "means_code": "58", "iban": "DE02120300000000202051", "account_name": "Muster GmbH", "bic": null },
"notes": []
}
}| Field | EN 16931 | Content |
|---|---|---|
number | BT-1 | invoice number |
type_code | BT-3 | invoice type as a code, for example 380 |
issue_date | BT-2 | issue date, YYYY-MM-DD |
due_date | BT-9 | payment due date, YYYY-MM-DD |
currency | BT-5 | currency as a code, for example EUR |
buyer_reference | BT-10 | buyer reference, for example the Leitweg-ID |
order_reference | BT-13 | purchase order number |
seller | BG-4 | seller: name (BT-27), street (BT-35), postal_code (BT-38), city (BT-37), country (BT-40), vat_id (BT-31), tax_number (BT-32), email (BT-43) |
buyer | BG-7 | buyer: name (BT-44), street (BT-50), postal_code (BT-53), city (BT-52), country (BT-55), vat_id (BT-48), email (BT-58). tax_number is always null for the buyer |
lines[] | BG-25 | invoice lines: id (BT-126), name (BT-153), description (BT-154), quantity (BT-129), unit (BT-130), unit_price (BT-146), net_amount (BT-131), vat_category (BT-151), vat_rate (BT-152) |
lines_truncated | true if the invoice has more than 200 lines. The first 200 are returned | |
totals | BG-22 | totals: net (BT-109), vat (BT-110), gross (BT-112), prepaid (BT-113), payable (BT-115) |
vat_breakdown[] | BG-23 | VAT breakdown, 20 rows at most: category (BT-118), rate (BT-119), taxable (BT-116), tax (BT-117), exemption_reason (BT-120) |
payment | payment details: terms (BT-20), means_code (BT-81) and the first bank account (BG-17) with iban (BT-84), account_name (BT-85), bic (BT-86) | |
notes[] | BT-22 | notes of the invoice, 10 at most |
- Every value is a string as it appears in the file, or
null. Amounts, quantities and percentages are not converted and not rounded. - Only
issue_dateanddue_dateare reformatted, toYYYY-MM-DD. A date that cannot be read isnull. - A value has 500 characters at most, a note in
notes[]andpayment.terms2000 at most. Longer texts are cut. invoiceisnullwhen the invoice data cannot be read, for example for a PDF without embedded invoice XML or for an unknown format.- Invoice data is returned for a red invoice too. It changes neither the traffic light nor the cost of the check.
- The API reads the values and does not judge them. What breaks a rule is listed in
violations. invoiceis not stored. The history in your account holds metadata only, see Data and retention.- Only
POST /v1/validatereturnsinvoice. The check reports of a conversion do not contain the field.
How the traffic light is decided
- Green: no violation, and the official validator recommends acceptance.
- Yellow: only violations with severity
warning. - Red: at least one violation with severity
error; or profile MINIMUM or BASIC-WL; or an unknown format; or the official validator recommends rejection.
A report is only delivered when it is complete and consistent: green never has a violation, and red always has at least one error that explains it.
Rule set
Checks use the KoSIT validator with the configuration named in rules_version. BASIC and EXTENDED are checked with a complementary scenario against the official EN 16931 rules; rules_version then ends with , complementary EN 16931 scenario. The additional rules of these profiles from the ZUGFeRD standard are not checked.
Our own rules
Rules starting with ERA- come from eRechnungsAmpel. They report what the official validator does not express as a rule, for example a PDF without an embedded invoice or a profile that is not an e-invoice. Their severity is error.
When no check takes place
| Status | code | Meaning |
|---|---|---|
400 | malformed_xml, xml_doctype, malformed_pdf, protected_pdf, empty_body | the file is rejected |
413 | body_too_large | larger than 10 MB |
415 | unsupported_media_type | neither XML nor PDF |
429 | rate_limited | limit reached; Retry-After gives the waiting time |
502 | validator_failed, invalid_report | the validator did not deliver a complete report |
503 | validator_unavailable, timeout, service_busy, service_unavailable | temporarily unavailable |
In none of these cases are credits charged. The answers about key, plan and credits (401, 402, 403) are listed under Authentication, all codes under Errors.
Example in JavaScript
import { readFile } from "node:fs/promises";
const response = await fetch("https://api.erechnungsampel.de/v1/validate", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ERA_API_KEY}`,
"Accept-Language": "en",
"Content-Type": "application/xml",
},
body: await readFile("invoice.xml"),
});
if (!response.ok) {
const problem = await response.json();
throw new Error(`${problem.code}: ${problem.title}`);
}
const report = await response.json();
console.log(report.traffic_light, report.violations.length);
console.log(report.invoice?.number, report.invoice?.totals.payable);Readable PDF
POST /v1/visualize takes the same request as POST /v1/validate: the same file, the same Content-Type, the same size limit, the same key. The answer is the invoice XML as a readable PDF with German labels. The result of the check is in the headers of the answer.
curl -sS https://api.erechnungsampel.de/v1/visualize \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/xml" \
--data-binary @invoice.xml \
-D headers.txt \
-o rechnung.pdfCheck the HTTP status before you use rechnung.pdf: on an error the body is application/problem+json instead of the PDF.
Answer 200: the PDF
| Header | Content |
|---|---|
Content-Type | application/pdf |
Content-Disposition | attachment; filename="rechnung.pdf" |
X-Erechnung-Traffic-Light | result of the check of the file you sent: green, yellow or red |
X-Erechnung-Format | the format detected, as format in the check report |
X-Erechnung-Profile | the profile detected, as profile in the check report. The header is absent when no profile was detected |
X-Erechnung-Errors | number of errors |
X-Erechnung-Warnings | number of warnings |
- The PDF is delivered for a red invoice too. Read
X-Erechnung-Traffic-Lightbefore you pass the PDF on. - The PDF does not contain the invoice XML and is therefore not an e-invoice.
- The individual violations are not part of the answer.
POST /v1/validatereturns the check report. - A delivered PDF costs as much as one check and appears in the history as a check, see Credits and plans.
- The file you sent and the PDF are not stored.
- The limits of
POST /v1/validateapply, see Limits.
When no PDF is created
| Status | code | Meaning |
|---|---|---|
422 | visual_unsupported_syntax | there is no readable PDF for this invoice format: the invoice XML is neither CII nor UBL |
422 | visual_unavailable | this file cannot be rendered as a PDF, for example a PDF without embedded invoice XML |
With 422 nothing is charged. Do not retry the request with the same file.
The other errors are those of POST /v1/validate, see When no check takes place. Nothing is charged in those cases either. A PDF without embedded invoice XML gives a red check report with POST /v1/validate and status 422 with POST /v1/visualize.