purchase

View as MarkdownOpen in Claude

Purchase a new phone number for the account.

Path parameters

AccountSidstringRequiredformat: "uuid"
The unique identifier for the account that is associated with this phone number.

Request

PhoneNumberstringRequiredformat: "^\+\d{5,17}$"6-18 characters
The phone number to purchase in E.164 format. Must start with `+` followed by 5-17 digits.
FriendlyNamestringOptional
A friendly name for the phone number. If not provided, the formatted phone number will be used.
SmsApplicationSidstringOptionalformat: "uuid"
The unique identifier for the application associated with SMS handling on this phone number.
SmsFallbackMethodenumOptionalDefaults to POST
Whether the request to `SmsFallbackUrl` is a `GET` or a `POST`. Default is `POST`.
Allowed values:
SmsFallbackUrlstringOptionalformat: "uri"
The URL to request if errors occur when fetching SmsUrl.
SmsMethodenumOptionalDefaults to POST
Whether the request to SmsUrl is a `GET` or a `POST`. Default is `POST`.
Allowed values:
SmsUrlstringOptionalformat: "uri"
The URL to request when an incoming SMS is received.
StatusCallbackstringOptionalformat: "uri"
The URL to request to pass status updates to. See the [Incoming call status callback](/docs/compatibility-api/rest/incoming-phone-numbers/webhooks/incoming-call-status-callback) webhook for the payload your URL will receive.
StatusCallbackMethodenumOptionalDefaults to POST
Whether the request to StatusCallback is a `GET` or a `POST`. Default is `POST`.
Allowed values:
VoiceApplicationSidstringOptionalformat: "uuid"
The unique identifier for the application associated with call handling on this phone number.
VoiceFallbackMethodenumOptionalDefaults to POST
Whether the request to VoiceFallbackUrl is a `GET` or a `POST`. Default is `POST`.
Allowed values:
VoiceFallbackUrlstringOptionalformat: "uri"
The URL to request if errors occur when fetching VoiceUrl.
VoiceMethodenumOptionalDefaults to POST
Whether the request to VoiceUrl is a `GET` or a `POST`. Default is `POST`.
Allowed values:
VoiceReceiveModeenumOptionalDefaults to voice
Whether this number can receive voice calls or faxes. Default is `voice`.
Allowed values:
VoiceUrlstringOptionalformat: "uri"
The URL to request when an incoming call is received.

Response

account_idstringRequiredformat: "uuid"
The unique identifier for the account that is associated with this phone number.
account_sidstringRequiredformat: "uuid"
The unique identifier for the account that is associated with this phone number.
address_requirementsenumRequired
Whether or not a registered address with SignalWire is required. Always 'none'.
Allowed values:
address_sidstring or nullRequired
The unique identifier for the address associated with this phone number. Always null.
api_versionstringRequired
The version of the SignalWire API.
betabooleanRequired
New numbers on SignalWire are marked as beta. Always false.
capabilitiesobjectRequired
Whether or not a number can receive calls and messages.
country_codestringRequired
The ISO 3166-1 alpha-2 country code for this phone number.
date_createdstringRequired
The date, in RFC 2822 format, this phone number was created.
date_updatedstringRequired
The date, in RFC 2822 format, this phone number was updated.
emergency_address_sidstring or nullRequired
The unique identifier of the address associated with E911 for this phone number, or null if not set.
emergency_statusstringRequired
Whether the phone route has an active E911 address associated. 'Active' or 'Inactive'.
friendly_namestringRequired
A formatted version of the number.
identity_sidstring or nullRequired
The unique identifier for the identity associated with this phone number. Always null.
originenumRequired
The origin of the phone number.
Allowed values:
phone_numberstringRequired
The incoming number in E.164 format.
sidstringRequired
The unique identifier for this phone number.
sms_application_sidstring or nullRequired
The unique identifier for the application associated with SMS handling on this phone number, or null if not set.
sms_fallback_methodstringRequired
Whether the request to `SmsFallbackUrl` is a `GET` or a `POST`.
sms_fallback_urlstring or nullRequired
The URL to request if errors occur when fetching SmsUrl, or null if not set.
sms_methodstringRequired
Whether the request to SmsUrl is a `GET` or a `POST`.
sms_urlstring or nullRequired
The URL to request when an incoming SMS is received, or null if not set.
status_callbackstring or nullRequired
The URL to request to pass status updates to, or null if not set.
status_callback_methodstringRequired
Whether the request to StatusCallback is a `GET` or a `POST`.
trunk_sidstring or nullRequired
The unique identifier for the Trunk associated with this phone number. Always null.
uristringRequired
The URI for this number.
voice_application_sidstring or nullRequired
The unique identifier for the application associated with call handling on this phone number, or null if not set.
voice_caller_id_lookupboolean or nullRequired
Whether or not to look up a caller's name in the database. Always null.
voice_fallback_methodstringRequired
Whether the request to VoiceFallbackUrl is a `GET` or a `POST`.
voice_fallback_urlstring or nullRequired
The URL to request if errors occur when fetching `Url`, or null if not set.
voice_methodstringRequired
Whether the request to Url is a `GET` or a `POST`.
voice_urlstring or nullRequired
The URL to request when an incoming call is received, or null if not set.
verification_statusstringOptional
The verification status for toll-free numbers. Only present for toll-free numbers.

Response Example

Response
1{
2 "account_id": "b3877c40-da60-4998-90ad-b792e98472ac",
3 "account_sid": "b3877c40-da60-4998-90ad-b792e98472ac",
4 "address_requirements": "none",
5 "api_version": "2010-04-01",
6 "beta": false,
7 "capabilities": {
8 "voice": true,
9 "sms": true,
10 "mms": true,
11 "fax": true
12 },
13 "country_code": "US",
14 "date_created": "Tue, 25 Sept 2018 23:00:00 +0000",
15 "date_updated": "Wed, 26 Sept 2018 22:00:00 +0000",
16 "emergency_status": "Inactive",
17 "friendly_name": "(310) 338-6745",
18 "origin": "signalwire",
19 "phone_number": "+13103386745",
20 "sid": "b3877c40-da60-4998-90ad-b792e98472pn",
21 "sms_fallback_method": "POST",
22 "sms_method": "POST",
23 "status_callback_method": "POST",
24 "uri": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472ac/IncomingPhoneNumbers/b3877c40-da60-4998-90ad-b792e98472pn.json",
25 "voice_fallback_method": "POST",
26 "voice_method": "POST",
27 "verification_status": "Unverified"
28}

Example

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
9number = client.compat.phone_numbers.purchase(
10 PhoneNumber="+15551234567",
11 FriendlyName="Main Line"
12)