@stampbench/core / integration reference
Validate inside the software you already operate.
The public integration surface is the MIT-licensed TypeScript library and command-line tool. Both run locally, require no Java runtime and do not require invoice bytes to leave your process.
Install
Use Node.js 20 or later. The core package depends on fast-xml-parser and zod; npm installs them with the package.
npm install @stampbench/core
Validate UBL or CII locally
The syntax is auto-detected. Select en16931 for the European core subset or xrechnung for that core plus the implemented German rules.
import { locateViolations, validateXml } from '@stampbench/core';
const result = validateXml(xml, { profile: 'xrechnung' });
const findings = locateViolations(
xml,
result.violations,
result.syntax ?? 'ubl',
);
for (const finding of findings) {
console.log({
ruleId: finding.ruleId,
severity: finding.severity,
message: finding.message,
line: finding.location.line,
column: finding.location.column,
precision: finding.location.precision,
terms: finding.terms,
});
}Result contract
Findings expose stable rule identifiers and business terms. Location precision is explicit: an absent field may resolve to its nearest existing ancestor rather than an invented exact line.
{
"valid": false,
"syntax": "ubl",
"profile": "xrechnung",
"violations": [{
"ruleId": "BR-CO-10",
"severity": "error",
"terms": ["BT-106", "BT-131"],
"location": {
"line": 40,
"column": 7,
"precision": "exact"
}
}]
}CLI and CI
The CLI returns exit code 1 for validation failures and supports JSON, GitHub annotation and SARIF output for build pipelines.
npx stampbench validate invoice.xml npx stampbench validate ./invoices --profile en16931 --json npx stampbench validate ./invoices --format sarif > stampbench.sarif
Current coverage
This is documented subset coverage, not complete KoSIT parity, certification, legal advice or a guarantee that every recipient will accept a document. See the validation evidence before making an integration decision.
Fixed-scope integration pilot
Teams that want implementation help can evaluate a £3,000 pilot covering one staging workflow, agreed representative documents, structured diagnostic mapping and a written handover. The price is an early commercial hypothesis and the scope is agreed before work starts.
Discuss a pilot ↗