/v1 API, so anything you can do with the SDK you can do from your terminal — placing calls, listing numbers, inspecting history, and more.
Install
The CLI is packaged with the Python SDK, but its dependencies (typer, rich) are kept behind an [cli] extra so SDK-only users stay lean:
pip install callingbox, the callingbox command will print an install hint rather than crashing with an import error.
Authenticate
The CLI resolves your API key in this order (highest wins):--api-keyflag on the commandCALLINGBOX_API_KEYenvironment variable- Config file written by
callingbox login
Interactive login
Runcallingbox login once and paste your key when prompted. The CLI validates the key against GET /v1/numbers before saving it:
0600 on Unix so other users on the machine cannot read it.
Non-interactive login
For CI or scripted setups, pass the key directly:Environment variable
Skip the config file entirely by exporting the key in your shell:Check the active credentials
whoami does not hit the API — it just tells you how the CLI would resolve your credentials right now.
Log out
Run against a local backend
For local development, point the CLI at your local backend the same way the SDK does:--base-url per invocation, or persist it with callingbox login --base-url http://localhost:3002.
Place a call
The flagship command dispatches a call, polls until it reaches a terminal status, and prints the structuredreturns data:
| Flag | Required | Description |
|---|---|---|
--to | yes | Destination number in E.164 format. |
--prompt | yes | Instruction for the AI agent. |
--context | no | JSON object passed to the agent as context. |
--returns | no | JSON object describing the structured data to extract. |
--from | no | Caller ID. Defaults to your oldest active number. |
--language | no | BCP-47 language code. |
--webhook-url | no | POST call events to this URL. |
--voicemail-action | no | hangup or leave_message. |
--transcript | no | Also fetch and print the call transcript when the call completes. Ignored with --no-wait. |
--no-wait | no | Return immediately after dispatch. |
--timeout | no | Max seconds to wait. Default 600. |
Fire-and-forget
If you don’t want to wait for the call to complete:id) and exits. Poll later with callingbox calls get <id>.
Timeouts
If the call doesn’t reach a terminal status before--timeout expires, the CLI exits with code 6 and prints the call id so you can keep polling manually.
List and retrieve calls
Calls are cursor-paginated (Stripe/OpenAI-style) with stable ordering by creation time.calls list:
| Flag | Description |
|---|---|
--limit N | Max records per page (1–100, default 20). |
--after CALL_ID | Return calls older than this id. |
--before CALL_ID | Return calls newer than this id. |
--all | Fetch every page and print them together. |
has_more=true, the CLI prints a hint at the bottom of the table with the exact --after flag to use next.
Manage phone numbers
numbers buy charges your credit balance. The CLI asks for an interactive confirmation by default; use --yes / -y in scripts.
numbers search is a provider-backed lookup (not paginated); use --limit to control how many candidates are returned.
JSON output for scripts
By default the CLI renders rich tables and panels when stdout is a TTY. Pipe the output, or pass--json, to get machine-readable JSON:
list commands without --all, the JSON envelope matches the API:
--all, the output is a plain JSON array since all pages have been flattened.
Global flags
Every command accepts these top-level flags:| Flag | Description |
|---|---|
--api-key KEY | Override the API key for a single invocation. |
--base-url URL | Override the base URL (self-hosted / local dev). |
--json | Emit raw JSON instead of formatted output. |
--version | Print the CLI version and exit. |
-h, --help | Show help. Available on every subcommand. |
Exit codes
The CLI uses distinct exit codes so scripts can react to specific failure modes:| Code | Meaning |
|---|---|
0 | Success. |
1 | Unexpected error. |
2 | Usage error (bad flags, invalid JSON). |
3 | Authentication error (missing or rejected key). |
4 | Resource not found. |
5 | Bad request from the API. |
6 | Timeout waiting for a call to complete. |
7 | Network error. |
Shell completions
Thanks to Typer, the CLI ships with shell completion support for bash, zsh, fish, and PowerShell:Use python -m callingbox
If the callingbox entry point isn’t on your PATH (common in some sandboxed envs), invoke the CLI via the module:
Next steps
SDK overview
Compare the Python SDK, TypeScript SDK, CLI, and raw HTTP.
Python SDK
The library the CLI is built on — use it for richer programmatic workflows.
Call object
Understand every field printed by
callingbox calls get.Structured results
Design the
--returns schema the CLI prints on completion.