Build compliant e-invoicing into your software.
Validate and generate XRechnung / EN 16931 documents with a TypeScript-first engine, a CLI and a hosted API. Both syntaxes — UBL and CII — auto-detected, with the rule id and the source location on every violation.
npm install @stampbench/core
Why developers use Stampbench
The compliance layer is the part of an invoicing integration that never stops moving. Stampbench is the layer, published as source you can read.
TypeScript-first
A pure-TypeScript engine with no Java runtime and no native dependencies. It installs like any other npm package and runs in Node, in a worker, or in the browser.
Deterministic validation
Rules are code, not a model’s opinion. The same document and the same ruleset version always produce the same verdict, which is what makes a result worth pinning in CI.
Diagnostics you can act on
Every violation carries the rule id, the business term (BT-/BG-) and a source location, so a failing invoice can annotate the exact line of a pull request.
Generate as well as validate
Build UBL from a typed invoice model with totals and the VAT breakdown computed from your lines, so the BR-CO arithmetic rules pass by construction.
Local-first
The library and CLI run entirely in your process. No upload, no account, no network — which is also the only honest way to promise that invoices stay on your infrastructure.
Hosted API when you want it
The same engine behind a REST endpoint, for languages that are not JavaScript and for teams who would rather not own the rule-update treadmill.
Quickstart
Install the library and validate a document. No key, no account, no network call.
npm install @stampbench/core
import { validateXml, generateUblInvoice, withComputedTotals } from '@stampbench/core';
const result = validateXml(xml, { profile: 'xrechnung' });
if (!result.valid) {
for (const v of result.violations) {
console.error(v.ruleId, v.message, v.line);
}
}curl -s https://stampbench.com/api/v1/validate \ -H "Authorization: Bearer $STAMPBENCH_API_KEY" \ -H "Content-Type: application/xml" \ --data-binary @invoice.xml
Anonymous calls are allowed at 10/hour per IP so you can try it before signing up. Keys live on your account page; the full reference is in the documentation.
Two commands: check it, and fix what is safe to fix
No SDK lock-in, no XML expertise required. Runs locally — your invoices never leave your machine.
$ npx stampbench validate invoice.xml --profile en16931
invoice.xml syntax: UBL | profile: en16931 | ruleset: 2026-08.2
ERROR BR-CO-17 VAT breakdown S @ 7%: tax amount should be
22.04 (314.86 × 7%) but is 99.99. (line 78)
ERROR BR-11 Missing buyer country code (BT-55). (~line 39)
INVALID — 2 errors, 0 warnings (40 rules run)$ npx stampbench fix invoice.xml --profile en16931 --write
invoice.xml
fix line 78 BR-CO-17, BR-S-09 99.99 → 22.04
keep BR-11 no derivable correct value —
this needs a human decision, not arithmeticThe same file is 40 rules under the European core and 56 under the German profile. --profile chooses, and the header line always names the ruleset that actually ran.
stampbench regress compares a directory against a future ruleset and exits 1 when anything would start failing — regression testing in the docs.
Your customer’s system rejected the invoice with a code like [BR-CO-17]. Now what?
Every e-invoicing standard rejects the whole document over one bad figure, and the reference validators answer in spec clauses instead of your fields. Stampbench tells you exactly why it failed, in which line — and fixes what can safely be fixed.
[BR-CO-17] VAT category tax amount (BT-117) = VAT category taxable amount (BT-116) x (VAT category rate (BT-119) / 100), rounded to two decimals.
VAT breakdown for category S at 7%: the tax amount should be 22.04 (314.86 × 7%) but the document states 99.99 — line 78.
Auto-fixable: there is exactly one correct value, so `stampbench fix` writes 22.04 into your file and revalidates it.
Never invent compliance data.
Stampbench fixes what mathematics can prove — a VAT total has exactly one right answer. Everything else goes to a human, because an invoice that quietly passes with invented data is worse than one that honestly fails.
Understand
Human-readable errors, anchored to the exact line.
How it works +How it works −
Validation that explains itself
The EN 16931 core rules and the full VAT category families everywhere, and the German BR-DE profile on top when you are invoicing Germany. Every violation carries the rule id, the business term, and a message written for developers.
The exact failing line
Every violation carries a line and column, so a broken invoice annotates your pull request where the problem is. Approximate positions say so, rather than guessing confidently.
Fix
Deterministic repairs and totals that cannot be wrong.
How it works +How it works −
It fixes what it can work out
Totals and VAT amounts that disagree with the figures they are computed from have exactly one right answer, so Stampbench corrects them in your file — and never invents data it cannot derive.
Totals computed by construction
Send lines with quantities, prices and VAT categories; Stampbench derives every total and the VAT breakdown, so the BR-CO arithmetic rules pass every time.
Stay compliant
Current and upcoming rule sets, both syntaxes.
How it works +How it works −
Know what breaks before it breaks
Rule sets change on a published schedule. Diff your invoices against the next rule set before it becomes binding and get a ranked list of what to fix.
Reads what actually arrives
Both XML syntaxes, auto-detected: UBL 2.1 and CII — the syntax ZUGFeRD and Factur-X carry. No Java, no server round-trip, no account.
What actually runs
Two profiles, both syntaxes, one national customisation. Where a market has nothing implemented, the coverage matrix says so instead of implying more.
Stampbench is developer tooling, not legal advice. For certification-grade sign-off, run the official KoSIT validator as well — the goal here is that by the time you do, it passes, and the parity results are published rather than asserted.
Open source at the core. Paid when you need the platform.
MIT-licensed, no account, no telemetry.
- Local library & CLI
- Browser playground
- Unlimited validation
- In-place repair
- Invoice creation from JSON
The engine as infrastructure, from £29/month.
- Hosted REST API
- Shareable validation reports
- Future-ruleset checks
- Quotas that scale
- Email support
No Java. No uploads. No black box.
The engine is a pure-TypeScript npm package. Validation, repair and generation run in your process — or in your browser on this site — and the rules are MIT-licensed source you can read.
Not building an integration? Just create an invoice instead.