Skip to content
GitHub

Command line

src/cli.ts is exposed as the einvoice bin (bun src/cli.ts ... in a checkout; tagged releases attach standalone binaries for linux-x64, darwin-arm64 and windows-x64). A file argument of - reads stdin.

einvoice detect <file...> format id, version and profile per document (tab separated)
einvoice inspect <file...> the unwrap and detect result as JSON
einvoice convert <file...> [--out <dir>] canonical JSON array on stdout, or one <invoice-id>.json per invoice in <dir>
einvoice export <file...> --format sie|journal|csv [--accounts mapping.json] [--out <file>] bookkeeping entries
einvoice render --as html|pdf <file...> [--lang en|de|fr|it|es|nl|pl|ro] [--out <file|dir>] human-readable invoice
einvoice write <file...> --to ubl|cii [--profile peppol-bis3|xrechnung|en16931] [--out <dir>] write canonical JSON (or any invoice file) as UBL 2.1 or CII D16B
einvoice sweep <dir...> [--expect answers.json] detection coverage / known-answer check
einvoice trust-lists update [--out <snapshot.json>] [--lotl-signer <cert.pem>] fetch and verify the EU trusted lists
einvoice match --po <order.json|order.xml>... [--receipts r.json] [--tolerance '<json>'] <invoice...> match to purchase orders
einvoice duplicates <dir...> [--window days] [--index index.json] [--json] duplicate and re-sent invoices; exit 9 if found
einvoice serve [--port 8080] [--host 127.0.0.1] [--cors[=<origin>]] [--eu-trust[=<snapshot.json>]] the conversion API, see below

convert --eu-trust[=<snapshot.json>] checks signers against a trusted-list snapshot (see EU trusted lists).

Flags: --pretty indents JSON; --quiet silences notes and warnings (errors are still printed); --limits '{"maxEntries":10}' overrides UnwrapLimits; --validate is accepted by convert and is a no-op with a message until the validation module lands. duplicates converts every file under the directories and groups repeats in four levels: identical payload (same XML in another wrapper), same seller + number + date, same seller + number with a different date or amount, and likely duplicates (same seller and amount, dates within --window days, similar lines, different number). Numbers are normalised (case, separators, leading zeros) and the evidence lists every step; credit notes that cite an invoice in BG-3 are paired with it, not flagged. --index keeps the index in a JSON file so later runs only add new files. The same logic is exported as DuplicateIndex.

JSON goes to stdout only; every error is one line on stderr.

Exit Meaning
0 all converted
1 usage error (and, for sweep, any mismatch or unanswered file)
2 unsafe or malformed input (DOCTYPE, limits, not XML)
3 unsupported format or profile (including well-formed non-invoice XML)
4 validation failed
5 partially converted (some documents failed)
6 validator unavailable
7 internal error (including unreadable files)
8 match verdict is needs-review
9 duplicates found at least one duplicate group

With several failures and no success the code of the first failure is used; with at least one success it is 5.