REST ClientPhone Numbers

search

View as MarkdownOpen in Claude

Search for available phone numbers that can be purchased.

Query parameters

areacodestringOptional
An areacode to search within.
number_typestringOptional
Search for either local or toll-free numbers. Defaults to local.
starts_withstringOptional
A string of 3 to 7 digits that should be used as the start of a number. Cannot be used in combination with contains or ends_with.
containsstringOptional
A string of 3 to 7 digits that should appear somewhere in the number. Cannot be used in combination with starts_with or ends_with.
ends_withstringOptional
A string of 3 to 7 digits that should be used as the end of a number. Cannot be used in combination with starts_with or contains.
max_resultsintegerOptional
The maximum number of matches to return. Upper limit of 100. Defaults to 50.
regionstringOptional
A region or state to search within. Must be an ISO 3166-2 alpha-2 code, i.e. TX for Texas. Cannot be used in combination with areacode.
citystringOptional
A specific City to search within. Must be used in combination with region. Cannot be used in combination with areacode, starts_with, contains, or ends_with.

Response

datalist of objectsOptional
List of available phone numbers.

Response Example

Response
1{
2 "links": {
3 "self": "string",
4 "first": "string",
5 "next": "string",
6 "prev": "string"
7 },
8 "data": [
9 {
10 "number": "+15551234567",
11 "region": "CA",
12 "city": "Los Angeles",
13 "rate_center": "string",
14 "lata": "string",
15 "capabilities": {
16 "voice": true,
17 "sms": true,
18 "mms": true,
19 "fax": true
20 }
21 }
22 ]
23}

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
9available = client.phone_numbers.search(areacode="503", max_results=5)
10for number in available.get("data", []):
11 print(number["number"], number.get("region"))