Get Available ExoPhones
Search for available phone numbers by country and type that can be purchased for your account.
HTTP Request
GET /v2_beta/Accounts/<account_sid>/AvailablePhoneNumbers/<iso_country_code>/<number_type>
Path Parameters
| Parameter | Description |
|---|---|
iso_country_code | Two-letter country code (e.g., IN, MY, SG) |
number_type | Landline, Mobile, or TollFree |
Query Parameters
| Parameter | Required | Description |
|---|---|---|
IncomingSMS | No | Filter numbers that support incoming SMS |
InRegion | No | Filter by telecom circle (e.g., IN, AP, DL, KA) |
Contains | No | Filter by substring match in the number |
Code Examples
- cURL
- Python
- Node.js
- PHP
- Go
curl -u '<api_key>:<api_token>' -X GET 'https://api.exotel.com/v2_beta/Accounts/<account_sid>/AvailablePhoneNumbers/IN/Landline?InRegion=KA'
import requests
response = requests.get(
'https://api.exotel.com/v2_beta/Accounts/<account_sid>/AvailablePhoneNumbers/IN/Landline?InRegion=KA',
auth=('<api_key>', '<api_token>')
)
print(response.status_code)
print(response.json())
const apiKey = '<api_key>';
const apiToken = '<api_token>';
const url = 'https://api.exotel.com/v2_beta/Accounts/<account_sid>/AvailablePhoneNumbers/IN/Landline?InRegion=KA';
const response = await fetch(url, {
method: 'GET',
headers: {
'Authorization': 'Basic ' + Buffer.from(`${apiKey}:${apiToken}`).toString('base64'),
},
});
const data = await response.json();
console.log(response.status, data);
<?php
$ch = curl_init('https://api.exotel.com/v2_beta/Accounts/<account_sid>/AvailablePhoneNumbers/IN/Landline?InRegion=KA');
curl_setopt($ch, CURLOPT_USERPWD, "<api_key>:<api_token>");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status . "\n" . $response;
?>
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
endpoint := "https://api.exotel.com/v2_beta/Accounts/<account_sid>/AvailablePhoneNumbers/IN/Landline?InRegion=KA"
req, err := http.NewRequest("GET", endpoint, nil)
if err != nil {
panic(err)
}
req.SetBasicAuth("<api_key>", "<api_token>")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
respBody, _ := io.ReadAll(res.Body)
fmt.Println(res.StatusCode, string(respBody))
}
Response
[
{
"friendly_name": "+60XXXXXXX1",
"phone_number": "+60XXXXXXXX1",
"capabilities": {
"sms": false,
"voice": true
},
"country": "MY",
"region": "MY",
"number_type": "Landline",
"rental_price": "0.000000"
}
]
Response Fields
| Field | Description |
|---|---|
friendly_name | Human-readable phone number |
phone_number | Full phone number in E.164 format |
capabilities | Object with sms and voice boolean flags |
country | Country code |
region | Telecom region/circle |
number_type | Type of number |
rental_price | Monthly rental price |