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.

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.

request_options
RequestOptions | NoneDefaults to None

Client-wide defaults for request timeout, retries, and cancellation. Every method also accepts its own request_options= argument, which overrides these defaults for that one call. See RequestOptions.

project, token, and host 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
Calling

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

phone_numbers
PhoneNumbers

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

addresses
Addresses

Manage regulatory addresses. See Addresses.

queues
Queues

Manage call queues and queue members. See Queues.

recordings
Recordings

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

number_groups
NumberGroups

Manage number groups and their memberships. See Number Groups.

verified_callers
VerifiedCallers

Manage and verify caller IDs. See Verified Callers.

sip_profile
SipProfile

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

lookup
Lookup

Phone number carrier and CNAM lookup. See Lookup.

short_codes
ShortCodes

Manage short codes. See Short Codes.

imported_numbers
ImportedNumbers

Import externally-hosted phone numbers. See Imported Numbers.

mfa
Mfa

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
PubSub

PubSub token generation. See PubSub.

chat
Chat

Chat token generation. See Chat.

messages
Messages

Send SMS and MMS messages and redact the body of a sent message. See Messages.

projects
Projects

Create and manage subprojects and rotate a project’s signing key. See Projects.

Examples

Explicit credentials

from signalwire.rest import RestClient
client = RestClient(
project="your-project-id",
token="your-api-token",
host="your-space.signalwire.com",
)
numbers = client.phone_numbers.list()

Environment variables

import os
from signalwire.rest import RestClient
# With SIGNALWIRE_PROJECT_ID, SIGNALWIRE_API_TOKEN, and SIGNALWIRE_SPACE set
client = RestClient()
available = client.phone_numbers.search(areacode="512")