For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReference
GuidesReference
    • Core
      • Overview
    • Agents
      • Overview
      • AgentBase
      • AgentServer
      • BedrockAgent
      • CLI Tools
      • Configuration
      • ContextBuilder
      • DataMap
      • FunctionResult
      • Helper Functions
      • LiveWire
      • MCP Gateway
      • PomBuilder
      • Prefabs
      • Search
      • SkillBase
      • Skills
      • SWAIGFunction
      • SWMLBuilder
      • SWMLService
      • WebService
    • RELAY
      • Overview
      • Actions
      • Call
      • Constants
      • Events
      • Message
      • RelayClient
      • RelayError
    • REST Client
      • Overview
      • Addresses
      • Calling
      • Chat
      • Compat
      • Datasphere
      • Fabric
      • Imported Numbers
      • Logs
      • Lookup
      • MFA
      • Number Groups
      • Phone Numbers
      • Project
      • PubSub
      • Queues
      • Recordings
      • Registry
      • RestClient
      • Short Codes
      • SignalWireRestError
      • SIP Profile
      • Verified Callers
      • Video
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Properties
  • Example
REST Client

SignalWireRestError

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

SIP Profile

Next
Built with

Custom exception class for REST API errors. Extends Python’s built-in Exception class. Raised when an HTTP request to the SignalWire REST API returns a non-success status code.

1from signalwire.rest import SignalWireRestError

Properties

status_code
int

HTTP status code returned by the API (e.g., 404, 422, 500).

body
str | dict

Response body from the API (JSON dict if parseable, otherwise raw string).

url
str

The URL path that was requested.

method
str

The HTTP method used ("GET", "POST", "PUT", "PATCH", "DELETE").

Example

1from signalwire.rest import RestClient, SignalWireRestError
2
3client = RestClient(
4 project="your-project-id",
5 token="your-api-token",
6 host="your-space.signalwire.com",
7)
8
9try:
10 client.phone_numbers.get("nonexistent-id")
11except SignalWireRestError as e:
12 print(f"HTTP {e.status_code}: {e.body}")
13 print(f"Request: {e.method} {e.url}")