Skip to content

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

Shell
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
Bodythe file as raw data, no multipart, 10 MB at most
Content-Typeapplication/xml or text/xml for XRechnung and other XML invoices; application/pdf for ZUGFeRD and Factur-X
Accept-Languageoptional: 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.

JSON
{
  "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
}
FieldContent
traffic_lightgreen, yellow or red
formatxrechnung-cii, xrechnung-ubl, zugferd, en16931-ubl or unknown
profileEN16931, EXTENDED, XRECHNUNG, BASIC, BASIC-WL, MINIMUM or null
rules_versionthe rule set that was applied
violations[].rulerule ID, for example BR-DE-15, or one of our own rules starting with ERA-
violations[].severityerror or warning
violations[].fieldthe first EN 16931 field named (BT or BG), null if the rule names none
violations[].locationXPath of the place in the document, or null
violations[].original_messagethe original text of the rule, unchanged
violations[].messageour message in the language you asked for. It exists only for our own rules (ERA-); otherwise null
violations[].explanationlink to the page of the rule, or null
duration_msduration of the check in milliseconds
invoicethe 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.

JSON
{
  "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": []
  }
}
FieldEN 16931Content
numberBT-1invoice number
type_codeBT-3invoice type as a code, for example 380
issue_dateBT-2issue date, YYYY-MM-DD
due_dateBT-9payment due date, YYYY-MM-DD
currencyBT-5currency as a code, for example EUR
buyer_referenceBT-10buyer reference, for example the Leitweg-ID
order_referenceBT-13purchase order number
sellerBG-4seller: 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)
buyerBG-7buyer: 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-25invoice 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_truncatedtrue if the invoice has more than 200 lines. The first 200 are returned
totalsBG-22totals: net (BT-109), vat (BT-110), gross (BT-112), prepaid (BT-113), payable (BT-115)
vat_breakdown[]BG-23VAT breakdown, 20 rows at most: category (BT-118), rate (BT-119), taxable (BT-116), tax (BT-117), exemption_reason (BT-120)
paymentpayment 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-22notes 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_date and due_date are reformatted, to YYYY-MM-DD. A date that cannot be read is null.
  • A value has 500 characters at most, a note in notes[] and payment.terms 2000 at most. Longer texts are cut.
  • invoice is null when 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.
  • invoice is not stored. The history in your account holds metadata only, see Data and retention.
  • Only POST /v1/validate returns invoice. 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

StatuscodeMeaning
400malformed_xml, xml_doctype, malformed_pdf, protected_pdf, empty_bodythe file is rejected
413body_too_largelarger than 10 MB
415unsupported_media_typeneither XML nor PDF
429rate_limitedlimit reached; Retry-After gives the waiting time
502validator_failed, invalid_reportthe validator did not deliver a complete report
503validator_unavailable, timeout, service_busy, service_unavailabletemporarily 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

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.

Shell
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.pdf

Check 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

HeaderContent
Content-Typeapplication/pdf
Content-Dispositionattachment; filename="rechnung.pdf"
X-Erechnung-Traffic-Lightresult of the check of the file you sent: green, yellow or red
X-Erechnung-Formatthe format detected, as format in the check report
X-Erechnung-Profilethe profile detected, as profile in the check report. The header is absent when no profile was detected
X-Erechnung-Errorsnumber of errors
X-Erechnung-Warningsnumber of warnings
  • The PDF is delivered for a red invoice too. Read X-Erechnung-Traffic-Light before 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/validate returns 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/validate apply, see Limits.

When no PDF is created

StatuscodeMeaning
422visual_unsupported_syntaxthere is no readable PDF for this invoice format: the invoice XML is neither CII nor UBL
422visual_unavailablethis 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.