Skip to main content

Quickstart - Advanced Number Search

| cURL | Python | Node | Ruby |


cURL

This quickstart will cover what you need to know about performing advanced number searches for US/CA numbers, or any number that begins with the country code +1. See here to check if that includes the country/territory you desire. For details on how to search any other international numbers follow our International Number Search & Order guide .

When performing your search, * matches any character; TELE matches "8353"; && matches "11", "22", etc. You can also use consecutive to search for numbers in sequence e.g. xxx-xxx-1234, xxx-xxx-1235.

To show all available filters, see the full documentation here

Check out the Development Environment Setup guide to acquire your API Key and set up a Telnyx SDK if applicable.

curl -X GET \
--header "Accept: application/json" \
--header "Authorization: Bearer YOUR_API_KEY" \
--globoff "https://api.telnyx.com/v2/available_phone_numbers?filter[country_code][]=US&filter[locality][]=Chicago&filter[administrative_area][]=IL&filter[features][]=sms&filter[limit][]=2"

Note: After pasting the above content, Kindly check and remove any new line added

Note: Sample results can vary depending on the available numbers at a given moment.

{
"data": [
{
"best_effort": false,
"cost_information": {
"currency": "USD",
"monthly_cost": "1.00000",
"upfront_cost": "1.00000"
},
"features": [
{
"name": "fax"
},
{
"name": "voice"
},
{
"name": "sms"
}
],
"phone_number": "+18728880024",
"record_type": "available_phone_number",
"region_information": [
{
"region_name": "US",
"region_type": "country_code"
},
{
"region_name": "IL",
"region_type": "state"
},
{
"region_name": "CHICAGO ZONE 02",
"region_type": "rate_center"
}
],
"reservable": false,
"vanity_format": null
},
{
"best_effort": false,
"cost_information": {
"currency": "USD",
"monthly_cost": "1.00000",
"upfront_cost": "1.00000"
},
"features": [
{
"name": "fax"
},
{
"name": "voice"
},
{
"name": "sms"
}
],
"phone_number": "+18728880026",
"record_type": "available_phone_number",
"region_information": [
{
"region_name": "US",
"region_type": "country_code"
},
{
"region_name": "IL",
"region_type": "state"
},
{
"region_name": "CHICAGO ZONE 02",
"region_type": "rate_center"
}
],
"reservable": false,
"vanity_format": null
}
],
"metadata": {
"best_effort_results": 0,
"total_results": 2
},
"url": "/v2/available_phone_numbers"
}

Note: After pasting the above content, Kindly check and remove any new line added

[include advanced-number-search-payloads-v2-curl.md]

Python

This quickstart will cover what you need to know about performing advanced number searches.

When performing your search, * matches any character; TELE matches "8353"; && matches "11", "22", etc. You can also use consecutive to search for numbers in sequence e.g. xxx-xxx-1234, xxx-xxx-1235.

To show all available filters, see the full documentation here

Check out the Development Environment Setup guide to set up the Telnyx Python SDK and your development environment for this guide.

import telnyx

telnyx.api_key = "YOUR_API_KEY"

response = telnyx.AvailablePhoneNumber.list(
filter={"coutry_code": "US", "locality": "Chicago", "administrative_area": "IL", "features": ["sms"], "limit": 2}
)

print(response)

Note: After pasting the above content, Kindly check and remove any new line added

Note: Sample result can vary depending on the available numbers at a given moment.

{
"data": [
{
"best_effort": false,
"cost_information": {
"currency": "USD",
"monthly_cost": "1.00000",
"upfront_cost": "1.00000"
},
"features": [
{
"name": "fax"
},
{
"name": "voice"
},
{
"name": "sms"
}
],
"phone_number": "+18728880024",
"record_type": "available_phone_number",
"region_information": [
{
"region_name": "US",
"region_type": "country_code"
},
{
"region_name": "IL",
"region_type": "state"
},
{
"region_name": "CHICAGO ZONE 02",
"region_type": "rate_center"
}
],
"reservable": false,
"vanity_format": null
},
{
"best_effort": false,
"cost_information": {
"currency": "USD",
"monthly_cost": "1.00000",
"upfront_cost": "1.00000"
},
"features": [
{
"name": "fax"
},
{
"name": "voice"
},
{
"name": "sms"
}
],
"phone_number": "+18728880026",
"record_type": "available_phone_number",
"region_information": [
{
"region_name": "US",
"region_type": "country_code"
},
{
"region_name": "IL",
"region_type": "state"
},
{
"region_name": "CHICAGO ZONE 02",
"region_type": "rate_center"
}
],
"reservable": false,
"vanity_format": null
}
],
"metadata": {
"best_effort_results": 0,
"total_results": 2
},
"url": "/v2/available_phone_numbers"
}

Note: After pasting the above content, Kindly check and remove any new line added

[include advanced-number-search-payloads-v2-python.md]

Node

This quickstart will cover what you need to know about performing advanced number searches.

When performing your search, * matches any character; TELE matches "8353"; && matches "11", "22", etc. You can also use consecutive to search for numbers in sequence e.g. xxx-xxx-1234, xxx-xxx-1235.

To show all available filters, see the full documentation here

Check out the Development Environment Setup guide to set up the Telnyx node SDK and your development environment for this guide.

const telnyx = require("telnyx")("YOUR_API_KEY")

const { data : availablePhoneNumbers } = await telnyx.availablePhoneNumbers.list({
filter: {
"country_code": "US",
"locality": "Chicago",
"administrative_area": "IL",
"features": ["sms"],
"limit": 2
}
})

Note: After pasting the above content, Kindly check and remove any new line added

Note: Sample result can vary depending on the available numbers at a given moment.

{
"data": [
{
"best_effort": false,
"cost_information": {
"currency": "USD",
"monthly_cost": "1.00000",
"upfront_cost": "1.00000"
},
"features": [
{
"name": "fax"
},
{
"name": "voice"
},
{
"name": "sms"
}
],
"phone_number": "+18728880024",
"record_type": "available_phone_number",
"region_information": [
{
"region_name": "US",
"region_type": "country_code"
},
{
"region_name": "IL",
"region_type": "state"
},
{
"region_name": "CHICAGO ZONE 02",
"region_type": "rate_center"
}
],
"reservable": false,
"vanity_format": null
},
{
"best_effort": false,
"cost_information": {
"currency": "USD",
"monthly_cost": "1.00000",
"upfront_cost": "1.00000"
},
"features": [
{
"name": "fax"
},
{
"name": "voice"
},
{
"name": "sms"
}
],
"phone_number": "+18728880026",
"record_type": "available_phone_number",
"region_information": [
{
"region_name": "US",
"region_type": "country_code"
},
{
"region_name": "IL",
"region_type": "state"
},
{
"region_name": "CHICAGO ZONE 02",
"region_type": "rate_center"
}
],
"reservable": false,
"vanity_format": null
}
],
"metadata": {
"best_effort_results": 0,
"total_results": 2
},
"url": "/v2/available_phone_numbers"
}

Note: After pasting the above content, Kindly check and remove any new line added

[include advanced-number-search-payloads-v2-node.md]

Ruby

This quickstart will cover what you need to know about performing advanced number searches.

When performing your search, * matches any character; TELE matches "8353"; && matches "11", "22", etc. You can also use consecutive to search for numbers in sequence e.g. xxx-xxx-1234, xxx-xxx-1235.

To show all available filters, see the full documentation here

Check out the Development Environment Setup guide to set up the Telnyx ruby SDK and your development environment for this guide.

require "telnyx"

Telnyx.api_key = "YOUR_API_KEY"

response = Telnyx::AvailablePhoneNumber.list(
filter: {
coutry_code: "US",
locality: "Chicago",
administrative_area: "IL",
features:["sms"], limit: 2
}
)

puts response

Note: After pasting the above content, Kindly check and remove any new line added

Note: Sample result can vary depending on the available numbers at a given moment.

{
"data": [
{
"best_effort": false,
"cost_information": {
"currency": "USD",
"monthly_cost": "1.00000",
"upfront_cost": "1.00000"
},
"features": [
{
"name": "fax"
},
{
"name": "voice"
},
{
"name": "sms"
}
],
"phone_number": "+18728880024",
"record_type": "available_phone_number",
"region_information": [
{
"region_name": "US",
"region_type": "country_code"
},
{
"region_name": "IL",
"region_type": "state"
},
{
"region_name": "CHICAGO ZONE 02",
"region_type": "rate_center"
}
],
"reservable": false,
"vanity_format": null
},
{
"best_effort": false,
"cost_information": {
"currency": "USD",
"monthly_cost": "1.00000",
"upfront_cost": "1.00000"
},
"features": [
{
"name": "fax"
},
{
"name": "voice"
},
{
"name": "sms"
}
],
"phone_number": "+18728880026",
"record_type": "available_phone_number",
"region_information": [
{
"region_name": "US",
"region_type": "country_code"
},
{
"region_name": "IL",
"region_type": "state"
},
{
"region_name": "CHICAGO ZONE 02",
"region_type": "rate_center"
}
],
"reservable": false,
"vanity_format": null
}
],
"metadata": {
"best_effort_results": 0,
"total_results": 2
},
"url": "/v2/available_phone_numbers"
}

Note: After pasting the above content, Kindly check and remove any new line added

[include advanced-number-search-payloads-v2-ruby.md]

On this page