Python SDK for CallingBox – the API for AI phone calls
Project description
CallingBox Python SDK
The official Python SDK for CallingBox – the API for AI phone calls.
Install
pip install callingbox
Quick Start
import callingbox
# Search and purchase a number (one-time setup)
available = callingbox.numbers.search_available(area_code="415")
number = callingbox.numbers.purchase(available[0].phone_number)
# Make a call – uses your oldest purchased number by default
call = callingbox.calls.create(
to="+15551234567",
prompt="Confirm appointment tomorrow 2pm",
context={"patient": "Maria Lopez"},
returns={"confirmed": "boolean"},
)
print(call.status) # "initiated"
print(call.id) # uuid
Example
There's a runnable quickstart in [examples/quickstart.py](examples/quickstart.py) that walks through the full flow — buying a number, making a call, polling for results:
export CALLINGBOX_API_KEY=sk_live_...
python examples/quickstart.py +15551234567
Authentication
Set your API key as an environment variable:
export CALLINGBOX_API_KEY=sk_live_...
Or pass it directly:
from callingbox import Callingbox
client = Callingbox(api_key="sk_live_...")
call = client.calls.create(to="+15551234567", prompt="Hello")
Choosing a Caller ID
By default, calls use your organization's oldest active purchased number. To use a specific number:
call = callingbox.calls.create(
to="+15551234567",
prompt="Confirm appointment tomorrow 2pm",
from_="+15557654321",
)
The from_ parameter accepts any active E.164 number owned by your organization.
Managing Numbers
# List your numbers
numbers = callingbox.numbers.list()
# Search available numbers
available = callingbox.numbers.search_available(
country_code="US",
area_code="415",
number_type="local",
limit=10,
)
# Purchase a number
number = callingbox.numbers.purchase("+14155551234")
Retrieving Calls
# List recent calls
calls = callingbox.calls.list()
# Get a specific call
call = callingbox.calls.retrieve("call-uuid-here")
print(call.result) # structured data extracted from the call
CLI
The SDK ships with an optional command-line interface. Install the extras:
pip install 'callingbox[cli]'
Log in once (the key is stored in ~/.config/callingbox/config.toml with mode 0600):
callingbox login
# or non-interactively:
callingbox login --api-key sk_live_...
Dispatch a call and wait for the structured result:
callingbox call \
--to "+15551234567" \
--prompt "Confirm appointment tomorrow 2pm" \
--returns '{"confirmed": "boolean"}'
Add --transcript to also print what each side said once the call completes:
callingbox call \
--to "+15551234567" \
--prompt "Confirm appointment tomorrow 2pm" \
--transcript
Other useful commands:
callingbox calls list --limit 20 # paginated; add --all to fetch every page
callingbox calls get <call-id>
callingbox numbers list
callingbox numbers search --area-code 415
callingbox numbers buy +14155551234
callingbox whoami # shows the active credentials source
Add --json to any command (or pipe the output) to get machine-readable JSON.
Credential resolution order: --api-key flag > CALLINGBOX_API_KEY env > config
file. Shell completions install with callingbox --install-completion.
Error Handling
from callingbox import AuthenticationError, BadRequestError, NotFoundError, APIError
try:
call = callingbox.calls.create(to="+15551234567")
except BadRequestError as e:
print(f"Invalid request: {e.message}")
except AuthenticationError:
print("Check your API key")
except NotFoundError:
print("Resource not found")
except APIError as e:
print(f"API error [{e.status_code}]: {e.message}")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file callingbox-0.1.0.tar.gz.
File metadata
- Download URL: callingbox-0.1.0.tar.gz
- Upload date:
- Size: 27.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
236fd41ba1addfcaf8b8de7f458a6e8f30780ef838d02a2c52a54b6d3bda5290
|
|
| MD5 |
8477e4ed189ff255530af3414973a268
|
|
| BLAKE2b-256 |
80a1b3b90d36c71de56d98420334fe10e0a01818e2719c096133608270b4fe5d
|
File details
Details for the file callingbox-0.1.0-py3-none-any.whl.
File metadata
- Download URL: callingbox-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98cfea217b4281f91b4563c5d9629e3c3cd3be4f5e2448b6698dd5ea684e3f03
|
|
| MD5 |
474869e3474b2924dd56959eae6cb408
|
|
| BLAKE2b-256 |
96aba154ad6a031766e24257e6714171891d5a68daa4c2861b0cb226b63056dc
|