CLI
Validate, scaffold, and convert offline — or send to Peppol with one command.
Installation
Install @getpeppr/cli globally or run it directly with npx.
Install globally
npm install -g @getpeppr/cliOr use npx (no install)
npx @getpeppr/cli validate invoice.jsonScaffold an Invoice
Generate a starter JSON file with all required fields pre-filled — a Belgian seller, the Belgian sandbox test receiver as buyer, two invoice lines. Ready to edit, validate, and send.
# Default — creates invoice.json
getpeppr init
# Custom filename
getpeppr init my-invoice.json
# Credit note template
getpeppr init --credit-note
# Overwrite an existing file
getpeppr init --force| Flag | Description |
|---|---|
[filename] | Output filename (default invoice.json) |
--credit-note | Generate a credit note template instead of an invoice |
--force | Overwrite an existing file |
Validate an Invoice
Pass a JSON file to getpeppr validate to check it against three validation engines:
- Structure — required fields, types, and format checks
- Offline Checks — 40 registered partial pre-flight checks: exact network-rule equivalents plus explicit
GETPEPPR-*diagnostics; the legacy provider-capability diagnosticunsupported_vat_categorycan also appear outside that count - Country Rules — Belgium, France, Italy, Netherlands, Germany
getpeppr validate invoice.jsonExample output
Validating: invoice.json
── Structure ──────────────────────────────
✓ No errors
⚠ to.vatNumber — Buyer VAT number not provided. May be required for B2B.
── Offline Checks (partial) ───────────────────
✓ No findings
── Country Rules ────────────────────────────
⚠ No structured communication reference (BE-02)
── Summary ──────────────────────────────────
✓ Pre-flight checks passed (2 warnings)validateInvoice, validateSchematron, validateCountryRules).
This offline pass catches common issues; it is not a Peppol conformance verdict.
Sending invoices to Peppol does require an API key — see Send to Peppol below.
Validate Flags
| Flag | Description |
|---|---|
--json | Machine-readable JSON output |
--quiet | Exit code only, no output |
--version | Show version number |
--help | Show help |
Convert to UBL XML
Convert a getpeppr JSON invoice to Peppol BIS 3.0 UBL 2.1 XML. Credit notes ("isCreditNote": true) are detected automatically and produce the correct UBL CreditNote document.
# Print UBL XML to stdout
getpeppr convert invoice.json
# Write to file
getpeppr convert invoice.json -o invoice.xml
# Validate before converting (errors block conversion)
getpeppr convert invoice.json --validate -o invoice.xml| Flag | Description |
|---|---|
-o, --output <file> | Write XML to file instead of stdout |
--validate | Validate before converting — errors block conversion |
Lookup the Peppol Directory
Search the public Peppol Directory to verify any participant on the network — by Peppol ID or company name.
# Direct lookup by Peppol ID
getpeppr lookup 0208:0685660237
# Search by company name
getpeppr lookup --name "Dupont"
# Filter by country
getpeppr lookup --name "GmbH" --country DE
# JSON output for tooling
getpeppr lookup 0208:0685660237 --json| Flag | Description |
|---|---|
--name <name> | Search by company name (min 3 characters) |
--country <code> | Filter by ISO 2-letter country code |
--json | Output results as JSON |
--limit <n> | Max results for search (default 10) |
Exit Codes
| Code | Meaning |
|---|---|
0 | Pre-flight completed without blocking findings (may have warnings) |
1 | Pre-flight found blocking errors |
2 | File not found or invalid JSON |
JSON Output
Use --json for machine-readable output, ideal for CI pipelines and tooling.
getpeppr validate invoice.json --json{
"structure": { "errors": [], "warnings": [...] },
"schematron": { "errors": [], "warnings": [] },
"countryRules": { "errors": [], "warnings": [...] },
"totalErrors": 0,
"totalWarnings": 2,
"valid": true
}CI/CD Integration
Use --quiet in CI pipelines to gate deployments on invoice compliance.
# Fail the pipeline if the invoice is invalid
getpeppr validate invoice.json --quiet || exit 1
# Or validate multiple files
for file in invoices/*.json; do
getpeppr validate "$file" --quiet || exit 1
done
# Send via API key in env (no login state needed)
GETPEPPR_API_KEY=$SANDBOX_KEY getpeppr send invoice.json --json--quiet flag suppresses all output and relies only on exit codes. It takes
precedence over --json, so use one or the other: --json alone in CI to capture
structured results, --quiet alone when only the exit code matters.
Invoice Format
The input file must be a JSON object matching the InvoiceInput type. See the Type Definitions for all available fields.
{
"number": "INV-2026-001",
"date": "2026-04-07",
"dueDate": "2026-05-07",
"currency": "EUR",
"buyerReference": "PO-12345",
"to": {
"name": "SPF Economie (test receiver)",
"peppolId": "9925:BE0314595348",
"street": "Rue du Progrès 50",
"city": "Brussels",
"postalCode": "1210",
"country": "BE"
},
"lines": [
{
"description": "Consulting services",
"quantity": 10,
"unitPrice": 150,
"vatRate": 0,
"vatCategory": "O",
"taxExemptReason": "Integration test"
}
]
}Send to Peppol
When your invoice JSON is ready, send it through the getpeppr API to the Peppol network — straight from the terminal. Sandbox is the default; pass --prod for production.
getpeppr login — Save your API key
Stores a getpeppr API key in $XDG_CONFIG_HOME/getpeppr/credentials.json — ~/.config/getpeppr/credentials.json by default, %APPDATA%\getpeppr\credentials.json on Windows. On Unix-like systems the file is created and checked with mode 0600; Windows has no POSIX mode, so there the file relies on your account's own permissions. Sandbox and live keys can coexist — the CLI picks the right one based on the target environment.
# Interactive (recommended) — masked input
getpeppr login
# Explicit (required in CI / non-TTY)
getpeppr login --key sk_sandbox_... --sandbox
getpeppr login --key sk_live_... --live| Flag | Description |
|---|---|
--key <key> | API key. CI use only — visible in ps/shell history. Prefer the prompt or GETPEPPR_API_KEY. |
--sandbox | Store as sandbox key (default) |
--live | Store as live (production) key |
--key flag → GETPEPPR_API_KEY env var → stored credentials.
In CI, prefer the env var pattern over login --key to avoid leaking the key into shell history.
getpeppr send — Send an invoice
Sends an invoice through the getpeppr API to the Peppol network. Pass either a JSON file or the synth flags (--to, --amount, --desc) — they're mutually exclusive.
getpeppr send runs a JSON preflight aligned with POST /v1/invoices.
That endpoint currently ignores invoiceTypeCode and lets the provider generate the UBL,
so the send preflight does not apply P0100, P0101, or P0112 to that inert field.
Structure checks including BR-CL-01, plus every other applicable offline and country check, remain active.
Use getpeppr validate or convert --validate for full local-UBL semantics; both retain those profile checks because they validate or build the UBL locally.
# Send a JSON file (sandbox by default)
getpeppr send invoice.json
# Watch delivery status until terminal (60s timeout)
getpeppr send invoice.json --watch
# Production send — confirmation prompt (skip with -y)
getpeppr send invoice.json --prod
# Quick test — synthesize from flags using the SPF Economie recipient test ID
getpeppr send --to 9925:BE0314595348 --amount 100 --desc "Test invoice"| Flag | Description |
|---|---|
[file] | Path to invoice JSON (mutex with --to/--amount/...) |
--prod | Target production (uses live key + confirmation prompt) |
--local | Target http://localhost:3001 (dev server) |
--key <key> | Override stored API key |
--to <peppol-id> | Recipient Peppol ID (when no file) |
--country <iso> | Recipient ISO 3166-1 alpha-2 country override (e.g. BE) |
--amount <number> | Line amount in major currency units |
--currency <iso> | ISO 4217 code (default EUR) |
--desc <text> | Line description |
--attachment | Attach the bundled test PDF |
--watch | Poll status until terminal (60s timeout, measured to the start of the last poll). Exits 1 on rejected, failed, no_action (not deliverable), and — since CLI 0.7.0 — whenever the polling itself fails, whether the API answered something unreadable or the request never landed at all. A plain timeout still exits 0 |
-y, --yes | Skip the --prod confirmation prompt |
--no-validate | Skip the JSON send preflight |
--idempotency-key <key> | Key that makes a resend safe: with the same API key, the same key and the same invoice are never sent twice. Printable ASCII. Default: a new key for each run (since CLI 0.18.0) |
--api-key-check <fingerprint> | Refuse to send (exit 2) unless the API key matches this fingerprint. Printed in a Resend command (since CLI 0.18.0) |
--json | Machine-readable JSON output |
--quiet | No result and no warnings. Errors still go to stderr (a refused or failed send prints its error, with a Resend or Options line when the invoice may have left), as do --watch polling errors and timeouts. The exit code carries the outcome: a watched delivery that ends rejected, failed or no_action exits 1 without output |
Since CLI 0.18.0, every send carries an Idempotency-Key: the one you pass with --idempotency-key, or a new cli-… key for each run. For one API key, the API never sends the same invoice twice under the same Idempotency-Key, so the bundled SDK retries a retryable failure under that key on its own. When a send still fails and the invoice may have left anyway, send exits 1 and prints a Resend line: the command that sends the same invoice under the same key with the same API key. Run it later, as printed. That is every failure except two: a final refusal (a 4xx other than 408 and 429 that the API does not mark retryable, when no earlier attempt of the same send was in doubt) and an invoice the SDK refuses before sending. For those, correct the invoice, then send it again. Running the original command again is not the same thing: without a file, send draws a new invoice number on each run, and a new key may deliver the invoice twice. See Error handling for provider.unavailable.
- The invoice. The invoice that was sent is saved first, with a file or without: the command resends that copy, so editing your file or running the command from another directory does not change what it sends. It is saved as
getpeppr-send-<8 hex>-<8 hex>.json(from the key and the invoice; never overwritten; mode0600on Unix-like systems) in the current directory, or in a new temporary directory when the current one cannot be written, and the command names it by its absolute path.sendnever modifies your own file. If no copy can be saved, or its path holds a character the terminal cannot show,sendprints anOptionsline instead ofResend, with the options to resend the same invoice under (--api-key-check,--idempotency-keyand the others below). The invoice itself is never printed,--quietor not. - The API key. The line never contains your API key. It contains
--api-key-checkwith a fingerprint of the key (12 hex characters of its SHA-256), and the command exits2, sending nothing, if another API key would send it: the API binds anIdempotency-Keyto the account. If you passed--key, pass it again. - The other options. The line keeps
--prod,--local,--yes,--no-validateand--validate-recipient. When you run the CLI throughnpx, it starts withnpx @getpeppr/cliinstead ofgetpeppr.
--idempotency-key takes printable ASCII only, because it is printed back in that line: a blank key, or one with a control character or a non-ASCII character, exits 2 before anything is sent.
Since CLI 0.16.0, send prints the gateway's notice when the sender's legal entity is in a country getpeppr does not serve yet: the message, the country, the address to write to and the docs page. With a sandbox key it is printed on stderr before the send, from the identity the CLI reads first; with a live key, which reads no identity, it is printed under the result of an accepted send. An invoice file that names a sender (a sub-tenant, sent with a master key) follows the second rule too: your identity describes your own legal entity, not the one that sends. --json adds a senderCountryNotice key to the JSON object (absent when there is nothing to say), and --quiet does not print the notice. It is a notice, not an error: the invoice is still sent and the exit code does not change.
getpeppr whoami — Show your Peppol identity
Shows the Peppol identity of the account behind your API key — the quick sanity check that you are pointing at the right account and environment before sending.
# Which account and environment am I pointing at?
getpeppr whoami
# Machine-readable output (carries the full identity — see the note below)
getpeppr whoami --json| Flag | Description |
|---|---|
--prod | Use the live API key (default: sandbox) |
--local | Target http://localhost:3001 (dev server) |
--key <key> | Override stored API key — for CI/scripted use only; visible in ps and shell history, prefer GETPEPPR_API_KEY |
--json | Output the identity as JSON |
--json prints the full identity, including the legal entity name and address — keep it out of shared CI logs and support tickets.
Since CLI 0.16.0, when your legal entity is in a country getpeppr does not serve yet, whoami prints the gateway's notice under the identity: the message, the country, the address to write to and the docs page. The --json output carries it as senderCountryNotice, null when there is nothing to say. The exit code stays 0.
getpeppr legal-entities — Your customers' legal entities
Since CLI 0.17.0, list, get <id> and create manage the legal entities of your Platform customers. They need a master API key on a platform account, passed with GETPEPPR_API_KEY or --key; any other key gets 403 authz.master_key_required. To get one: in the sandbox, an organisation admin starts the platform sandbox trial from the console overview and creates a sandbox master key at API keys; production platform access is requested from our team at hello@getpeppr.dev.
# Platform accounts, master API key (GETPEPPR_API_KEY or --key)
getpeppr legal-entities list
getpeppr legal-entities list --external-id acme-42
getpeppr legal-entities get <id>
# Send-only: getpeppr sends, the company keeps receiving at its current access point.
# Sandbox: an enterprise number of the sandbox test range (here 0000500044);
# in production (--prod), the company's own enterprise number.
getpeppr legal-entities create \
--external-id brux-7 --company-name "Bruxelles Conseil SRL" --country BE \
--address-line1 "Rue de la Loi 1" --city Brussels --zip 1000 \
--identifier 0208:0000500044 \
--network-role send_only --customer-reference contract-2026-17| Flag | Description |
|---|---|
--external-id <id> | list: only this entity. create: your reference for the customer, required; creating again with the same value returns the existing entity |
--limit, --offset | list: page size and entities to skip |
--company-name, --country, --address-line1, --city, --zip | create: required |
--identifier <scheme:value> | create: required; repeat it for several identifiers, primary first. Symbolic schemes such as GB:VAT:GB123456789 are read as their numeric code |
--network-role <role> | create: send_and_receive (the API default when omitted) or send_only |
--customer-reference <ref> | create: your reference for your contract with this company; required for a production send_only entity |
--idempotency-key <key> | create: lets a failed attempt be retried safely |
--prod, --local, --key <key> | As for whoami |
--json | Print the API response body as JSON, unchanged |
get and create show the network role, the status, and who receives the company's invoices: getpeppr for a send-and-receive customer; for a send-only one, what getpeppr last found on the Peppol network — elsewhere with the SMP host serving it, none or unknown — and that the buyer's responses do not come back to getpeppr. A suspended customer shows since when and why. A value the CLI does not know yet is printed as the API sent it. In the sandbox, send-only is open to every platform account. In production it is enabled per account by getpeppr: until then the API answers 403 legal_entities.send_only_not_enabled.
When the API refuses a request, the first line is its message, as before. When the answer carries getpeppr's result headers (Getpeppr-Result-Code, Getpeppr-Remediation, Getpeppr-Result-Docs, Getpeppr-Request-Id), the lines below give the result code, the next step in CLI terms, the docs page and the request id to quote to support. Each line appears only when the answer supplies it, and the next step only for a result code or remediation the CLI knows. getpeppr send prints a refused send the same way.
✗ getpeppr API error (403): Send-only legal entities are enabled per account by getpeppr in production, …
Code legal_entities.send_only_not_enabled
Next Send-only in production is enabled per account by getpeppr: write to hello@getpeppr.dev, or create the entity with --network-role send_and_receive. In the sandbox it is open to every platform account.
Docs https://getpeppr.dev/docs/platform/legal-entities/
Request req_…getpeppr logout — Remove credentials
Removes the credentials file described under login. No-op if it doesn't exist.
getpeppr logoutNext Steps
Need a programmatic API instead of the terminal? Use the SDK. Sign up at getpeppr.dev to get your API key.