REST Client
The REST namespace provides a synchronous HTTP client for the SignalWire platform APIs. It organizes every HTTP endpoint into namespaced resource objects with standard CRUD operations, letting you manage phone numbers, fabric resources, call logs, video rooms, datasphere documents, and more from Python.
Example
Search for available phone numbers, purchase one, and assign it to a fabric AI agent resource:
All three constructor arguments can also be provided via environment variables:
SIGNALWIRE_PROJECT_ID, SIGNALWIRE_API_TOKEN, and SIGNALWIRE_SPACE.
When those are set, you can instantiate with RestClient() and no arguments.
Pagination
list() returns one page, the server’s first response. To walk every item across
all pages, call paginate() on the same resource. It follows the
response’s links.next until the last page. Most list resources have it; the
few that don’t return a single page only.
Timeouts and retries
Pass a RequestOptions to the constructor to set a default
timeout and retry policy for every request, or to any method’s request_options=
argument to override it for one call.
Error Handling
REST errors raise SignalWireRestError. A request that never reaches the
server (connection refused, DNS failure, timeout) raises
SignalWireRestTransportError, a subclass whose
status_code is None, so one except clause covers both. The error carries the
response headers and the platform request_id for support correlation.
Resources
Constructor, authentication, and all namespace properties.
Search, purchase, and manage phone numbers.
AI agents, SWML scripts, subscribers, call flows, and tokens.
REST-based call control with 37+ commands.
Rooms, conferences, sessions, recordings, and streams.
Document management and semantic search.
Message, voice, fax, and conference log queries.
10DLC brand and campaign registration.
Send SMS and MMS messages and redact sent message bodies.
Create and manage subprojects and rotate signing keys.
Multi-factor authentication via SMS and voice.