REST Client

RestClient

View as MarkdownOpen in Claude

The RestClient is the entry point for all SignalWire REST API operations. It authenticates with your project credentials and exposes every API namespace as a property, giving you typed access to phone numbers, fabric resources, call control, video rooms, datasphere documents, logs, and more.

Constructor Parameters

project
str

SignalWire project ID. Falls back to the SIGNALWIRE_PROJECT_ID environment variable when not provided.

token
str

API token for authentication. Falls back to the SIGNALWIRE_API_TOKEN environment variable when not provided.

host
str

SignalWire space hostname (e.g., your-space.signalwire.com). Falls back to the SIGNALWIRE_SPACE environment variable when not provided.

All three parameters are required. If any is missing from both the constructor arguments and environment variables, a ValueError is raised.

Namespace Properties

fabric
FabricNamespace

AI agents, SWML scripts, subscribers, call flows, SIP gateways, and tokens. See Fabric.

calling
CallingNamespace

REST-based call control with 37+ commands dispatched via POST. See Calling.

phone_numbers
PhoneNumbersResource

Search, purchase, and manage phone numbers. See Phone Numbers.

addresses
AddressesResource

Manage regulatory addresses. See Addresses.

queues
QueuesResource

Manage call queues and queue members. See Queues.

recordings
RecordingsResource

List, retrieve, and delete call recordings. See Recordings.

number_groups
NumberGroupsResource

Manage number groups and their memberships. See Number Groups.

verified_callers
VerifiedCallersResource

Manage and verify caller IDs. See Verified Callers.

sip_profile
SipProfileResource

Get and update the project SIP profile. See SIP Profile.

lookup
LookupResource

Phone number carrier and CNAM lookup. See Lookup.

short_codes
ShortCodesResource

Manage short codes. See Short Codes.

imported_numbers
ImportedNumbersResource

Import externally-hosted phone numbers. See Imported Numbers.

mfa
MfaResource

Multi-factor authentication via SMS and voice. See MFA.

registry
RegistryNamespace

10DLC brand and campaign registration. See Registry.

datasphere
DatasphereNamespace

Document management and semantic search. See Datasphere.

video
VideoNamespace

Video rooms, conferences, sessions, recordings, and streams. See Video.

logs
LogsNamespace

Message, voice, fax, and conference log queries. See Logs.

project
ProjectNamespace

Project-level API token management. See Project.

pubsub
PubSubResource

PubSub token generation. See PubSub.

chat
ChatResource

Chat token generation. See Chat.

compat
CompatNamespace

Twilio-compatible LAML API for migration. See Compatibility.

Examples

Explicit credentials

1from signalwire.rest import RestClient
2
3client = RestClient(
4 project="your-project-id",
5 token="your-api-token",
6 host="your-space.signalwire.com",
7)
8
9numbers = client.phone_numbers.list()

Environment variables

1import os
2from signalwire.rest import RestClient
3
4# With SIGNALWIRE_PROJECT_ID, SIGNALWIRE_API_TOKEN, and SIGNALWIRE_SPACE set
5client = RestClient()
6
7available = client.phone_numbers.search(area_code="512")