peppol is the command-line tool for the e-invoice.be API. Use it to send a test invoice without code, to examine received documents, or to automate tasks in a shell script. The source is in the repository e-invoice-be/peppol-cli.
The CLI calls the single API host https://api.e-invoice.be. The API key selects the mode: a key of a sandbox company runs the commands in test mode.
Install
- macOS
- Linux
- Windows
Authenticate
The CLI can get the API key from two sources.- Interactive
- Environment variable
GET /api/me/ to make sure that the key is valid, and then stores the key in a workspace.Workspaces
A workspace is a name for one stored API key. Each company has its own API key, thus you use one workspace for each company. The CLI stores workspaces in~/.config/peppol-cli, or in $XDG_CONFIG_HOME/peppol-cli if that variable is set.
peppol auth also makes a workspace. Its name comes from the company name, or from the --workspace flag if you give it.
Use a sandbox company and a production company together
1
Add a workspace for each company
Paste the API key of the related company when the command asks for it.
2
Make the workspace of the sandbox company the active workspace
3
Use the production company for one command
The global flag
--workspace (short form -w) applies to one command only. The active workspace does not change.Validate, create and send an invoice
This procedure uses a fileinvoice.json with the invoice JSON. The Quickstart shows how to make this file.
Validation is not a separate mandatory call.
POST /api/documents/ rejects a payload that does not pass the same rules. Use POST /api/validate/json while you develop, because it returns all rule failures and the generated UBL.1
Validate the JSON file
Validation: PASSED, or Validation: FAILED with the number of errors and warnings and a table with the columns SEVERITY, RULE ID, MESSAGE and LOCATION. If the document is not valid, the exit code is 3.To read the JSON from standard input, use --file -:2
Create the document
DRAFT state and shows its details. Record the document ID. Add --construct-pdf to let the API make a PDF from the document.3
Send the document
4
Examine the result
--json and get the document ID from the output. This sample uses jq:
Set the Peppol IDs for a send
peppol document send accepts flags that give the sender and the receiver explicitly:
string
Peppol scheme of the sender, for example
0208.string
Peppol ID of the sender.
string
Peppol scheme of the receiver.
string
Peppol ID of the receiver.
string
Email address for the
email parameter of the send call.Other common tasks
Create a document from UBL or PDF
--vendor-tax-id and --customer-tax-id are optional. See Send UBL documents and Create documents from PDF.
Validate
Look up a participant
List documents
--page, --page-size, --from, --to, --search, --type, --sort-by and --sort-order. The inbox commands also accept --sender. peppol outbox list also accepts --receiver.
Download, delete and attach
Usage statistics
--aggregation accepts DAY, WEEK or MONTH. See Usage statistics and credits.
Back up all documents
Automation
Global flags
These flags are available on all commands:Confirmation prompts
peppol document delete and peppol document attachment delete ask for a confirmation. In a script, add --yes to these two commands. --yes is not a global flag.
Exit codes
When a command fails and
--json is set, the CLI writes the error as JSON to standard error:
Sample script
Shell completion
peppol completion bash, peppol completion zsh, peppol completion fish and peppol completion powershell write a completion script for your shell.
Use with AI agents
An AI agent that can run shell commands can use the CLI with--json, --yes and the exit codes. To connect an AI assistant directly to your account without the CLI, use the MCP server. See Model Context Protocol (MCP).
Report a problem
Report a problem with the CLI in the issues of the repository.Next Steps
SDKs
Call the API with a typed client in your language
Test mode and sandbox companies
Learn how a sandbox company runs in test mode
Validation during development
Understand the validation result
Model Context Protocol (MCP)
Connect an AI assistant to your account