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. Only supported for local searches; not supported when `number_type` is toll-free.
citystringOptional
A specific City to search within. Must be used in combination with region. Only supported for local searches; not supported when `number_type` is toll-free.

Response

datalist of objectsOptional
List of available phone numbers.

Response Example

Response
{
"links": {
"self": "string",
"first": "string",
"next": "string",
"prev": "string"
},
"data": [
{
"number": "+15551234567",
"region": "CA",
"city": "Los Angeles",
"rate_center": "string",
"lata": "string",
"capabilities": {
"voice": true,
"sms": true,
"mms": true,
"fax": true
}
}
]
}

Example

import { RestClient } from "@signalwire/sdk";
const client = new RestClient({
project: "your-project-id",
token: "your-api-token",
host: "your-space.signalwire.com"
});
const available = await client.phoneNumbers.search({ areacode: "503", max_results: 5 });
for (const number of available.data ?? []) {
console.log(number.number, number.region);
}