Quick start
Validate your first e-invoice through the API in about five minutes.
1. Create a free account and a test key
Sign in at https://einvoiceengine.com/login with your e-mail address. Open API keys and create a test key. It starts with einv_test_ and is shown once — store it in your secret manager.
Test keys run the real validation engine. They are free, never billed, and limited to the sandbox quota of your plan.
export EINV_BASE=https://einvoiceengine.com
export EINV_KEY=einv_test_...
2. Validate an invoice
Send the XML as the request body. Any XRechnung 3.0 or EN 16931 document in UBL or CII works, and so does a ZUGFeRD / Factur-X PDF (Content-Type: application/pdf).
validate.sh
#!/usr/bin/env bash
# Validate an invoice with curl.
# EINV_BASE: API base URL (e.g. https://einvoicing.example.com); EINV_KEY: your API key.
set -euo pipefail
curl -sS --fail-with-body "$EINV_BASE/v1/invoices/validate" \
-H "Authorization: Bearer $EINV_KEY" \
-H "Content-Type: application/xml" \
--data-binary @"${1:-invoice.xml}"
No invoice at hand? Download the official sample or the sample with errors.
Or let the API make test invoices for you. POST /v1/testdata returns synthetic invoices in the format you name, valid ones and ones with typical errors, each already checked against the official rules. It is not billed and nothing is stored.
curl -X POST $EINV_BASE/v1/testdata \
-H "Authorization: Bearer $EINV_KEY" -H "Content-Type: application/json" \
-d '{ "target": "xrechnung-ubl" }'
Each case has name, filename, document, expected and actual. GET /v1/testdata/cases lists the cases and targets.
3. Read the result
{
"status": "invalid",
"valid": false,
"detected": { "format": "xrechnung-ubl", "syntax": "ubl", "profile": "XRechnung", "version": "3.0" },
"summary": { "errors": 2, "warnings": 0, "infos": 1 },
"findings": [
{
"severity": "error",
"ruleId": "BR-DE-15",
"message": "[BR-DE-15] Das Element \"Buyer reference\" (BT-10) muss übermittelt werden.",
"explanation": "XRechnung requires the buyer reference (BT-10). For German public buyers this is the Leitweg-ID.",
"suggestion": "Set cbc:BuyerReference (UBL) or ram:BuyerReference (CII) to the Leitweg-ID or reference supplied by the buyer.",
"location": { "path": "/Invoice", "line": 2, "column": 1 }
}
]
}
statusisvalid,invalidorunsupported. Only the official rule sets decide it.messageis the official rule text, verbatim.explanationandsuggestionrestate it in plain language.- Results come in English, German, French, Spanish, Italian, Polish, Dutch or Portuguese: add
?lang=de(oren,fr,es,it,pl,nl,pt) or sendAccept-Language. The official rule text stays inmessage;messageTranslationadds an unofficial translation when one is known. coveragelists exactly which rule sets ran and what was not checked.
4. Same thing in TypeScript and Python
validate.ts
// Validate an invoice with TypeScript (Node 20+, no dependencies).
// Run: EINV_BASE=… EINV_KEY=… npx tsx validate.ts invoice.xml
import { readFile } from "node:fs/promises";
const base = process.env.EINV_BASE!;
const key = process.env.EINV_KEY!;
const xml = await readFile(process.argv[2] ?? "invoice.xml");
const res = await fetch(`${base}/v1/invoices/validate`, {
method: "POST",
headers: { authorization: `Bearer ${key}`, "content-type": "application/xml" },
body: xml,
});
if (!res.ok) {
const { error } = await res.json();
throw new Error(`${error.code}: ${error.message} (request ${error.requestId})`);
}
const result = await res.json();
console.log(result.status, `${result.summary.errors} errors`);
for (const f of result.findings.filter((f: { severity: string }) => f.severity === "error")) {
console.log(`- ${f.ruleId}: ${f.explanation} (line ${f.location?.line ?? "?"})`);
}
validate.py
"""Validate an invoice with Python (standard library only).
Run: EINV_BASE=... EINV_KEY=... python3 validate.py invoice.xml
"""
import json
import os
import sys
import urllib.error
import urllib.request
base = os.environ["EINV_BASE"]
key = os.environ["EINV_KEY"]
path = sys.argv[1] if len(sys.argv) > 1 else "invoice.xml"
with open(path, "rb") as f:
body = f.read()
req = urllib.request.Request(
f"{base}/v1/invoices/validate",
data=body,
method="POST",
headers={"Authorization": f"Bearer {key}", "Content-Type": "application/xml"},
)
try:
with urllib.request.urlopen(req, timeout=60) as resp:
result = json.load(resp)
except urllib.error.HTTPError as e:
err = json.load(e)["error"]
sys.exit(f"{err['code']}: {err['message']} (request {err['requestId']})")
print(result["status"], f"{result['summary']['errors']} errors")
for f in result["findings"]:
if f["severity"] == "error":
line = (f.get("location") or {}).get("line", "?")
print(f"- {f['ruleId']}: {f['explanation']} (line {line})")
E-Invoicing API