facturx — Free Open-Source Factur-X / ZUGFeRD Validator + Generator CLI for AI Agents
facturx — Mustangproject for AI Agents: Generate and validate Factur-X/ZUGFeRD e-invoices from one JSON spec. Skip hand-writing Cross Industry Invoice XML and PDF assembly — get a valid e-invoice in one command with 8.3x fewer tokens. Offline, fast, and free.
Install in one minute — see the install commands below. Source and README: github.com/creatorops-studio/facturx. 100% local — no network calls at all in the free build.
Honest limits, stated up front: validation checks the Factur-X/ZUGFeRD schema shape, profile rules and arithmetic — it is NOT a certified EN 16931 compliance check, and the PDF is NOT a certified PDF/A-3. For a certified check, run veraPDF or Mustangproject. DE/FR only, EUR only.
One JSON spec, one valid e-invoice
Invoice ID, dates, seller and buyer, lines with VAT rates — declared in one JSON file, built in one command. The output is a human-readable A4 PDF with the Cross Industry Invoice XML embedded in the /AF list, ready to send to a German or French buyer. No Python, no PDF library wiring, no portal rejection debugging.
# 1. Start from a template (DE, BASIC profile)
facturx template > invoice.json
# 2. Generate a Factur-X PDF (human-readable A4 invoice + embedded CII XML)
facturx generate --spec invoice.json --output invoice.pdf --xml factur-x.xml
# 3. Validate it (PDF or standalone XML)
facturx validate invoice.pdf
facturx validate factur-x.xml --json
Totals are always computed from the lines, never taken from the spec: the sample 3-line invoice totals 334.00 EUR in lines, 58.06 EUR VAT, grand total 392.06 EUR. A French EN 16931 example is in examples/invoice-fr.json (394.28 EUR).
A validator that talks to your agent
validate checks structure, profile rules (BASIC / EN 16931, buyer reference BT-10), arithmetic to the cent (line totals, per-rate tax, grand total, due payable) and the PDF embedding itself — as machine-readable JSON the agent can act on. Error-level issues refuse the build entirely, so a broken invoice is never shipped.
Install in one minute
Install straight from GitHub with a Rust toolchain (cargo) — the crate is not on crates.io yet (a crate named facturx already exists there):
cargo install --git https://github.com/creatorops-studio/facturx
Prefer a ready-made binary? Download the Release v0.1.0 binary (3,689,848 B) from github.com/creatorops-studio/facturx/releases/tag/v0.1.0.
Measured numbers, not marketing
Measured 5 December 2026 on Linux x86_64, release build, with facturx benchmark on the sample DE invoice. Tokens ≈ characters / 4 (standard approximation); the spec JSON and the hand-written CII XML + assembly script are for the same 3-line invoice, so the comparison is reproducible.
| What was measured | Result |
|---|---|
| Token cost for one invoice — spec JSON | 259 tokens vs 2,160 tokens (hand-written CII XML + assembly script) — 8.3× saving |
| Generate (PDF + embedded XML) | 1.65–5.57 ms |
| Validate (XML) | 0.07–0.12 ms |
| Peak RSS | ~5.0 MB (5,000–5,160 KB) |
| Tests | 49 green (37 unit + 12 integration) |
| Binary size (release, stripped) | 3,689,848 B (3.52 MiB) |
Built for AI agents first
MCP server with four tools (generate_invoice, validate_invoice, extract_xml, list_profiles). Add this to your MCP config — no Python, no browser, no cloud:
{
"mcpServers": {
"facturx": {
"command": "facturx",
"args": ["mcp"]
}
}
}
An invoice that used to cost an agent 2,160 tokens of hand-written CII XML plus an assembly script now costs 259 tokens of JSON (8.3× saving, measured — see the repo README for the full benchmark).
Built with: Rust, a single static binary, and an MCP server — clap + lopdf + printpdf + roxmltree + serde_json.
Honest limits, stated up front
Validation checks the Factur-X/ZUGFeRD schema shape, profile rules and arithmetic — it is NOT a certified EN 16931 compliance check, and the PDF is NOT a certified PDF/A-3. For a certified check, run veraPDF or Mustangproject. DE/FR only, EUR only.
Free, offline, MIT
Single static binary, no cloud, no account. Free core is 80% of a real e-invoicing tool; Pro (coming later, $10–29/month) adds allowances/charges, credit notes, batch builds and a Cloud API.
Frequently asked questions
Is facturx EN 16931 compliant?
No — and it never claims to be. It validates against the Factur-X/ZUGFeRD schema shape and arithmetic. Use veraPDF or Mustangproject for a certified compliance check.
Which countries does it support?
Germany and France only (Factur-X/ZUGFeRD, EUR). No Peppol, no other national formats.
Does it need an API key or the internet?
No. Fully offline, single static binary, MIT.
How do I use it with Claude Code / Cursor / Codex?
Add it as an MCP server (facturx mcp) — four tools, no Python, no browser, no cloud.
What does the token saving measure?
259 tokens of spec JSON vs 2,160 tokens of hand-written CII XML + assembly script for the same 3-line invoice (8.3×, measured with the repo's own benchmark).
How do I install it?
Run cargo install --git https://github.com/creatorops-studio/facturx (needs a Rust toolchain), or download the Release v0.1.0 binary (3,689,848 B) from the v0.1.0 release. The crate is not on crates.io yet — a crate named facturx already exists there.
Generate a valid e-invoice in one command.
Free, offline, MIT licensed — get the source on GitHub. Validation checks schema shape, profile rules and arithmetic — it is not a certified EN 16931 compliance check, and the PDF is not a certified PDF/A-3.