Skip to content

Latest commit

 

History

History
92 lines (70 loc) · 3.49 KB

README.md

File metadata and controls

92 lines (70 loc) · 3.49 KB

SignalWire REST Client

Synchronous REST client for managing SignalWire resources, controlling live calls, and interacting with every SignalWire API surface from Python. It needs no WebSocket connection, only standard HTTP requests with automatic connection pooling.

Quick Start

Create a client and call any SignalWire API surface directly:

from signalwire.rest import RestClient

client = RestClient(
    project="your-project-id",
    token="your-api-token",
    host="example.signalwire.com",
)

# Create an AI agent
agent = client.fabric.ai_agents.create(
    name="Support Bot",
    prompt={"text": "You are a helpful support agent."},
)

# Search for a phone number
results = client.phone_numbers.search(areacode="512")

# Place a call via REST
client.calling.dial(
    from_="+15559876543",
    to="+15551234567",
    url="https://example.com/call-handler",
)

Features

The REST client provides:

  • Single RestClient with namespaced sub-objects for every API
  • All 37 calling commands: dial, play, record, collect, detect, tap, stream, AI, transcribe, and more
  • Full Fabric API: 13 resource types with CRUD + addresses, tokens, and generic resources
  • Datasphere: document management and semantic search
  • Video: rooms, sessions, recordings, conferences, tokens, streams
  • Phone number management, 10DLC registry, MFA, logs, and more
  • Shared requests.Session for connection pooling across all calls
  • Dict returns: raw JSON, no wrapper objects to learn

Documentation

These pages cover the client in depth:

Examples

These examples are in the repository:

Environment Variables

Variable Description
SIGNALWIRE_PROJECT_ID Project ID for authentication
SIGNALWIRE_API_TOKEN API token for authentication
SIGNALWIRE_SPACE Space hostname (e.g. example.signalwire.com)
SIGNALWIRE_LOG_LEVEL Log level (debug for HTTP request details)

Module Structure

The client's code lives under the installed package:

signalwire/signalwire/rest/
    __init__.py          # Public exports: RestClient, SignalWireRestError
    client.py            # RestClient -- namespace wiring, env var resolution
    _base.py             # HttpClient, BaseResource, CrudResource, CrudWithAddresses
    _pagination.py       # PaginatedIterator for list endpoints
    namespaces/
        fabric.py        # 13 resource types + generic resources + addresses + tokens
        calling.py       # 37 command dispatch methods via single POST
        phone_numbers.py # Search, purchase, update, release
        video.py         # Rooms, sessions, recordings, conferences
        datasphere.py    # Documents, search, chunks
        ... and 15 more