Phone Numbers
Search for available phone numbers, purchase them, and manage the numbers in your
SignalWire project. This resource extends the standard CRUD pattern with a search()
method for discovering available numbers, uses PUT for updates, and provides typed
helpers for binding inbound calls to a handler (SWML webhook, cXML webhook, AI agent,
call flow, RELAY application/topic).
Access via client.phoneNumbers on a RestClient instance.
Idiomatic deviation: create() and update() accept an untyped body
object (Record<string, unknown>) rather than narrow per-field types. This
mirrors Python’s **kwargs-style flexibility. Response payloads follow the
same typing.
Methods
Standard CRUD
List phone numbers owned by the project.
Purchase a phone number.
Retrieve details for a specific phone number.
Update configuration for a phone number.
Release a phone number from the project.
Search for available phone numbers to purchase.
Typed Binding Helpers
Each helper is a one-line wrapper over update that sets call_handler
to the right value and populates the handler-specific companion field for you.
Pass extra wire-level fields through the extra argument (or as additional keys
on the params object) for fields the helper doesn’t name explicitly. Setting a
binding auto-materializes the matching Fabric resource on the server.
Route inbound calls to an SWML webhook URL.
Route inbound calls to a cXML (LAML) webhook.
Route inbound calls to an existing cXML application by ID.
Route inbound calls to an AI Agent Fabric resource by ID.
Route inbound calls to a Call Flow by ID.
Route inbound calls to a named RELAY application.
Route inbound calls to a RELAY topic.
PhoneCallHandler
For callers passing call_handler directly to update, the
PhoneCallHandler const provides typed values. It is a const-as-enum
(as const object plus a same-named string-union type), so passing a member
serializes to its wire value with full type-checking on the call site.
LAML_WEBHOOKS (wire value laml_webhooks) produces a cXML handler, not a
generic webhook. For SWML, use RELAY_SCRIPT — or, more conveniently, the
setSwmlWebhook helper.