Install, authenticate, and use the CallingBox Python SDK for numbers and calls.
The CallingBox Python SDK wraps the same public /v1 API you see in the API Reference, but gives you a more natural Python interface for managing numbers, creating calls, polling for results, and handling errors.
The SDK uses https://api.callingbox.io by default. If your organization uses a private CallingBox deployment, set the base URL via the environment and optional constructor argument:
available = client.numbers.search_available( country_code="US", area_code="415", number_type="local", limit=10,)for number in available: print(number.phone_number, number.monthly_cost_cents)
Per-call instructions wholly replace the agent’s default for this one execution. Persona, voice, and tools stay the same.
call = client.calls.create( agent_id=agent.id, to="+15551234567", instructions="Follow up on the invoice sent last week. Negotiate a payment plan if needed.",)
# List recent calls (inbound and outbound)calls = client.calls.list()# Retrieve a single call by IDcall = client.calls.retrieve("CALL_ID")print(call.direction, call.agent_id, call.status)print(call.result)
The CLI is a first-class interface, not a demo: it supports the full call flow, cursor-paginated calls list / numbers list, JSON output for scripting, and shell completions.See the CLI reference for the full command catalog, auth resolution order, exit codes, and scripting tips.
Manage endpoints and verify signatures with callingbox.webhooks:
from callingbox import Callingboxcb = Callingbox(api_key="sk_live_...")# Create an endpoint (signing_secret is returned once)endpoint = cb.webhooks.create_endpoint( url="https://your-server.com/callingbox-webhook", description="Production CRM sync", enabled_events=["call.completed", "call.failed"],)print(endpoint.signing_secret) # whsec_...; store somewhere secure# Verify an incoming webhookevent = cb.webhooks.construct_event( payload=request.body, # raw bytes sig_header=request.headers["CallingBox-Signature"], secret=os.environ["CALLINGBOX_WEBHOOK_SECRET"],)# event.type, event.data["call"] are now trustworthy# Replay a failed deliverycb.webhooks.redeliver("9c1d9f9e-21a1-4f6d-8fce-bf4a4b8a9e3f")