CLI
Agent-first command-line interface for the BeeL API — run any endpoint from the terminal, sandbox by default.
The BeeL CLI lets you operate the API from the terminal: create and issue invoices, manage customers and products, validate NIFs, export data — without writing code. It is agent-first by design: JSON output for data commands, semantic exit codes, and sandbox by default, so both humans and AI assistants can use it safely.
Commands are derived from the API spec bundled with the installed CLI version, so each release exposes the API surface as of that version — new endpoints become new commands when you update the CLI. For an endpoint the installed version doesn't know yet, use the generic escape hatch.
Installation
npm install -g @beel_es/cli
beel --helpnpx @beel_es/cli --helpHandy for CI pipelines and AI agents — always runs the latest published version.
Requires Node.js 20 or higher.
Authentication
# Option A (recommended for agents/CI): env var
export BEEL_API_KEY=beel_sk_test_...
# Option B: store keys in ~/.config/beel/config.json (chmod 600)
beel login --api-key beel_sk_test_...
beel login --api-key beel_sk_live_... # both can coexistGet your keys at Settings > API Keys — each environment has its own, separate key. The CLI files each key into its slot by prefix: beel_sk_test_* → sandbox, beel_sk_live_* → production.
Sandbox is the default. Every command uses the test key unless you pass --live. A live key in BEEL_API_KEY without --live is an error, not a silent upgrade — production access is always explicit.
Check what is configured at any time:
beel config # shows config path, base URL and which keys are stored (masked)Common recipes
Commands follow the beel <resource> <action> pattern. These are everyday examples; the full, always-up-to-date list comes from beel commands (see below).
# Invoices
beel invoices list --status PAID --limit 5 # filter + paginate
beel invoices get <invoice_id>
beel invoices create --data @invoice.json # create a draft
beel invoices issue <invoice_id> --wait-for-pdf # emit + wait for the PDF
beel invoices mark-paid <invoice_id> # body optional
beel invoices create-corrective <invoice_id> --data @rectificativa.json
beel invoices generate-pdf <invoice_id> # returns the PDF download URL
beel invoices export-excel --data '{}' --output invoices.xlsx
# Customers & products
beel customers list --search "ACME"
beel customers create --data @customer.json
beel products search --q "consultoría"
beel products delete <product_id>
# Configuration, series & NIF
beel configuration list-series
beel configuration set-default-series <series_id>
beel configuration get-veri-factu # VeriFactu status
beel nif validate --data '{"nif":"B12345678"}' # checks the AEAT censusThere are more groups — recurring-invoices, companies, webhooks — all following the same pattern. The next section shows how to list everything.
Discovering commands
The CLI is agent-first: every command is derived from the API spec, so an assistant can discover the whole surface in one call instead of scraping help text.
beel commands # full command index as JSON — { command, signature, description, method, path }
beel commands --markdown # the same grouped by resource as markdown tablesbeel commands reflects the spec bundled with the installed CLI version — not the live API — so update the CLI to pick up newly added endpoints (or use the escape hatch meanwhile). There's no hand-maintained list to fall out of date. For details of a single command — flags, enums, defaults and body fields, all from the spec — use --help at any level:
beel --help
beel invoices --help
beel invoices create --helpFor commands that take a --data body, --help also lists the top-level body fields (name, type, whether they're required, and any enums), so you know what to send without leaving the terminal:
$ beel invoices create --help
...
Body fields (--data JSON), * = required:
* lines object[]
* recipient object
* type string (STANDARD|CORRECTIVE|SIMPLIFIED)
notes string
series_id string Invoicing series ID (if not specified, uses default)
Full schema (nested fields, formats): beel docs search invoices--dataaccepts inline JSON,@file.json, or-for stdin- Binary responses (PDF, ZIP, Excel) require
--output <path> POSTrequests get an automaticIdempotency-Key
Searching the docs
The CLI can search this documentation locally — useful for AI agents that want the relevant section without fetching whole pages. It downloads the machine-readable docs once (cached 15 minutes) and filters on your machine; search terms never leave your computer. No API key needed.
beel docs list # all documentation pages (JSON)
beel docs search idempotency key # prints only the matching sections
beel docs get glossary # prints a full page as markdownGeneric escape hatch
Any endpoint, even ones this CLI version doesn't know yet:
beel request GET /v1/invoices --query status=PAID --query limit=5
beel request POST /v1/customers --data @customer.jsonOutput contract
Built for scripting and AI agents:
- stdout: for API/data commands, the response JSON pretty-printed — pipe straight into
jq. Two helpers print human-readable markdown instead:docs(list/search/get) andcommands --markdown(plaincommandsis JSON). - stderr: errors as JSON:
{"error": {"code", "message", "status", "details", "request_id"}}
| Exit code | Meaning |
|---|---|
0 | Success |
1 | Unexpected error |
2 | Usage or config error |
3 | Auth (401/403) |
4 | Not found |
5 | Validation (400/409/422) |
6 | Rate limit (429) |
7 | Server error (5xx) |
BEEL_BASE_URL overrides the API host; BEEL_CONFIG_DIR overrides the config location.