REST Client
What Is the REST Client?
The RestClient provides a synchronous Python interface to all SignalWire REST APIs. It organizes the platform’s HTTP endpoints into namespaced resource objects with standard CRUD operations.
When to Use REST vs Relay vs Agents
Use the REST client for tasks like purchasing phone numbers, managing fabric resources, querying call logs, or any operation that doesn’t require real-time event handling.
Quick Start
Python
TypeScript
Authentication
Constructor Arguments
Environment Variables
All credentials can be provided via environment variables:
Namespaced Resources
The client exposes all SignalWire APIs through typed namespace properties:
CRUD Pattern
Most resources follow a standard CRUD pattern:
Fabric Namespace
Manage SignalWire Fabric resources — AI agents, SWML scripts, subscribers, and call flows:
Phone Numbers
Search, purchase, and manage phone numbers:
Calling Namespace
REST-based call control with 37+ commands. All commands are dispatched via POST:
Video Namespace
Manage video rooms, conferences, sessions, and recordings:
Datasphere Namespace
Manage documents and run semantic search:
Logs Namespace
Query message, voice, fax, and conference logs:
Registry Namespace (10DLC)
Manage 10DLC brands and campaigns for A2P messaging compliance:
Messages
Send an SMS or MMS and redact a sent message’s body:
To query message history, use client.logs.messages instead.
Other Resources
Pagination
list() returns a single page. Most list resources also expose paginate(),
which follows links.next and yields every item across all pages:
Timeouts and retries
Pass a RequestOptions to the client for a default timeout and retry policy, or
to any method for a one-off override:
In TypeScript, every list resource has a paginate() method that returns an
async iterator over all pages:
Error Handling
REST errors raise SignalWireRestError. A request that never reaches the server
raises SignalWireRestTransportError, a subclass with status_code set to
None, so one except covers both. The error carries the platform
request_id for support correlation.