CLI
Manage records, call any endpoint, receive webhooks locally and talk to the AI agent from your terminal.
Overview
The Corebill CLI (@corebill/cli) works like the Stripe CLI: log in with your browser, list and inspect any record in a table, call any API v1 endpoint, forward events to your local server while you build a webhook endpoint, and ask the AI agent to do the work in plain language. Every command has examples in corebill .
Installation
Log In
corebill login prints a pairing code, opens Corebill in your browser and waits. Check that the code in the browser matches, choose the company and click Authorize. The CLI receives an API key with write access for that company; revoke it anytime in Settings > Developers > API Keys.
| Command | Description |
|---|---|
corebill login | Pairing code + browser |
corebill login --no-browser | Only print the URL. Over SSH, open it in any browser; no local server is needed |
corebill login --token sk_live_... | Use an existing API key instead of the browser flow |
corebill whoami | User, organization, active company and API URL |
corebill logout / corebill logout --all | Disconnect the active company, or every company |
Companies
An API key belongs to one company. Log in once per company; the CLI keeps one profile per company and corebill use switches the active one (by id, slug or name).
Resource Commands
Each resource lists records in a table, newest first. Pass an id to see one record as JSON. All of them accept --limit (max 100, default 25), --starting-after for the next page and --json for the raw API response.
| Command | Module | Filters |
|---|---|---|
customers [id] | Core | --status, --query |
invoices [id] | Core | --status |
quotes [id] | Core | --status |
items [id] | Core | --query |
expenses [id] | Expenses | |
vendors | Expenses | --query |
projects [id] | Projects | --status |
products [id] | Products | --query, --category, --brand, --barcode, --inactive |
product-categories | Products | --query |
warehouses | Inventory | --include-inactive |
stock [product_id] | Inventory | --warehouse, --low-stock |
purchase-orders [id] | Purchases | --status, --vendor |
bills [id] | Purchases | --status, --vendor, --overdue |
cash-registers | Cash | --inactive |
cash-sessions [id] | Cash | --status, --register |
cash-movements | Cash | --session, --register, --direction, --source |
pos-sales [id] | Point of sale | --status, --session, --register, --customer, --since |
work-orders [id] | Work orders | --status, --query, --customer, --assigned-to (id or order_number) |
Commands of optional modules need the module on in Settings > Modules. If it is off, the CLI says so instead of failing with a raw error.
Retrieve one record
JSON output
--json prints the exact API response, so you can pipe it into jq. Output has no colors when it is not a terminal.
Calling Any Endpoint
corebill get, post, patch and delete call any API v1 path (with or without the /v1 prefix). Add fields with -d key=value (repeatable) or send a raw body with --json. On get, fields become query params.
Nested fields and lists
Use bracket notation for objects and arrays: a[b]=x builds { "a": { "b": "x" } } and lines[0][quantity]=2 builds an array of objects. true, false, null and numbers are sent as JSON types.
POST requests get an Idempotency-Key automatically; pass --idempotency-key to set your own so a retry never creates a duplicate.
corebill listen
Follows the events of the active company in real time and, with --forward-to, sends each one to your local server signed like a real webhook. The Events page has the full walkthrough, including how to verify the signature.
| Option | Description |
|---|---|
-f, --forward-to | POST each event to this URL (http:// is added if missing) |
-e, --events | Comma separated types, wildcards allowed (invoice.*,payment.received) |
-j, --print-json | Print the full JSON of each event |
--print-secret | Print the local signing secret (whsec_...) and exit |
-i, --interval | Polling interval (default 2) |
Forwarded requests send the webhook envelope (id, event, created_at, data, metadata, test) with Content-Type: application/json, User-Agent: corebill-cli/ and Corebill-Signature: t=. The whsec_... secret is generated once per company on your computer and does not change.
corebill trigger
Creates a test event with the example payload of the type. Test events are never delivered to your real webhook endpoints; receive them with corebill listen.
corebill events
corebill ask
Talk to the Corebill AI agent: one question, or an interactive chat without arguments. It can create quotes and invoices, record payments and answer questions about your data, and it needs a key with write access.
Utilities
| Command | Description |
|---|---|
corebill open | Open the dashboard |
corebill open docs / corebill open api | Open the docs or the API reference |
corebill config | Print the path of the configuration file (profiles and local secrets) |
corebill --help / corebill | Commands grouped by section, with examples |
CI and Scripts
Set COREBILL_API_KEY and every command uses that key instead of the logged-in company. No corebill login needed.
Environment Variables
| Variable | Description |
|---|---|
COREBILL_API_KEY | Use this key instead of the logged-in company (CI, scripts) |
COREBILL_API_URL | API base, with or without /v1 (default https://api.corebill.io) |
COREBILL_APP_URL | Web app used by login and open (default https://app.corebill.io) |
Troubleshooting
| Message | What to do |
|---|---|
Not authenticated. Run corebill login first. | No profile and no COREBILL_API_KEY. Log in or set the variable |
| Authentication failed (401) | The key was revoked or is invalid. Run corebill login again, or check COREBILL_API_KEY |
Permission denied (403 permission_required) | The key is read only. Writing needs write; deleting and module configuration need admin |
The X module is turned off for this company (403 module_disabled) | An owner or admin enables it in Settings > Modules |
| Rate limited (429) | Wait for the Retry-After seconds; lower the listen frequency with --interval |
| Connection failed | Check your network and COREBILL_API_URL |
<-- [ERR] in listen | Your local server is not running or the --forward-to URL is wrong; the listener keeps running |