This API will list the ExoPhone resources and get the Exophones that are avalable to use based on the ISO Country Code and Type. In case the country you are looking for is not available then please contact our sales or support teams.

The ExoPhone types are:

  • Landline
  • Mobile
  • TollFree

ExoPhone Resources By Country & Type

This API will list the ExoPhone resources that are available to use based on ISO Country Code and Type. To get a list, you will need to make an HTTP GET request to:

GET

https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/AvailablePhoneNumbers

  • Replace <your_api_key> and <your_api_token> with the API key and token created by you.
  • Replace <your_sid> with your “Account sid”
  • Replace <subdomain> with the region of your account
    1. <subdomain> of Singapore cluster is @api.exotel.com
    2. <subdomain> of Mumbai cluster is @api.in.exotel.com

<your_api_key> , <your_api_token> and <your_sid> are available in the API settings page of your Exotel Dashboard

curl -X GET https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/AvailablePhoneNumbers 
var request = require('request');
var options = {
    url: 'https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/AvailablePhoneNumbers'
};
function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}
request(options, callback);
    
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array();
$response = Requests::get('https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/AvailablePhoneNumbers', $headers);
    
import requests
requests.get('https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/AvailablePhoneNumbers')
    
require 'net/http'
require 'uri'
uri = URI.parse("https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/AvailablePhoneNumbers")
response = Net::HTTP.get_response(uri)
# response.code
# response.body
    

HTTP Response:

  • On success, the HTTP response status code will be 200
  • the HTTP body will contain an JSON similar to the one below
{
  "uri": "/v2_beta/Accounts/Exotel/AvailablePhoneNumbers",
  "countries": [
    {
      "country_code": "IN",
      "country": "India",
      "uri": "/v2_beta/Accounts/Exotel/AvailablePhoneNumbers/IN",
      "subresource_uris": {
        "Landline": "/v2_beta/Accounts/Exotel/AvailablePhoneNumbers/IN/Landline",
        "Mobile": "/v2_beta/Accounts/Exotel/AvailablePhoneNumbers/IN/Mobile",
        "TollFree": "/v2_beta/Accounts/Exotel/AvailablePhoneNumbers/IN/TollFree"
      }
    }
  ]
}

Description of parameters mentioned in the above response:

Parameter Name

Type & Value

uri

The resource uri

countries

Country subresource list

country_code

ISO Country Code

country

Country name

subresource_uris

List of subresource_uris which can be used to get the numbers list

ExoPhones for a Country & Type

To get a list of all the ExoPhones for a give ISO Country Code & Type, you need to make an HTTP GET request to:

GET

https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/AvailablePhoneNumbers/<ISOCountryCode>/Landline

The following query parameters are supported on the GET request.

Parameter Name

Mandatory/Optional

Value

IncomingSMS

Optional

Get only numbers that support incoming SMS.

InRegion

Optional

Get only numbers in the specified telecom circle. This filter is not applicable in all countries. For India, the currently supported regions are:

  • AP - Andhra Pradesh Circle
  • AS - Assam
  • BR - Bihar
  • DL - Delhi Circle
  • GJ - Gujarat
  • HP - Himachal Pradesh
  • HR - Haryana
  • JK - Jammu and Kashmir
  • KA - Karnataka Circle
  • KL - Kerala
  • KO - Kolkata
  • MH - Maharashtra
  • MP - Madhya Pradesh
  • MU - Mumbai Circle
  • NE - North East
  • OR - Orissa
  • PB - Punjab
  • RJ - Rajasthan
  • TN - Tamilnadu
  • UE - Uttar Pradesh East
  • UW - Uttar Pradesh West
  • WB - West Bengal

Contains

Optional

Get numbers that contains the specified substring.

curl -X GET https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/AvailablePhoneNumbers/<iso_country_code>/<number_type>
var request = require('request');

var options = {
url: 'https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/AvailablePhoneNumbers/<iso_country_code>/<number_type>'
};

function callback(error, response, body) {
if (!error && response.statusCode == 200) {
  console.log(body);
}
}

request(options, callback);
      
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array();
$response = Requests::get('https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/AvailablePhoneNumbers/<iso_country_code>/<number_type>', $headers);
      
import requests

requests.get('https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/AvailablePhoneNumbers/<iso_country_code>/<number_type>')
      
require 'net/http'
require 'uri'

uri = URI.parse("https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/AvailablePhoneNumbers/<iso_country_code>/<number_type>" )
response = Net::HTTP.get_response(uri)

# response.code
# response.body
      

HTTP Response:

  • On success, the HTTP response status code will be 200
  • the HTTP body will contain an JSON similar to the one below
[
  {
    "friendly_name": "+60XXXXXXX1",
    "phone_number": "+60XXXXXXXX1",
    "capabilities": {
      "sms": false,
      "voice": true
    },
    "country": "MY",
    "region": "MY",
    "one_time_price": "0.000000",
    "rental_price": "0.000000",
    "incoming_rate": "0.000000",
    "incoming_pulse": "60",
    "number_type": "Landline",
    "vanity_number": false
  },
  {
    "friendly_name": "+60XXXXXXXX2",
    "phone_number": "+60XXXXXXXX2",
    "capabilities": {
      "sms": false,
      "voice": true
    },
    "country": "MY",
    "region": "MY",
    "one_time_price": "0.000000",
    "rental_price": "0.000000",
    "incoming_rate": "0.000000",
    "incoming_pulse": "60",
    "number_type": "Landline",
    "vanity_number": false
  }
]

Description of parameters mentioned in the above response:

Parameter Name

Type & Value

friendly_name

A user friendly identifier for a number

phone_number

The phone number

capabilities

Supported capabilities on a number

• voice - True if incoming calls are supported on this number

• sms - True if incoming SMS is supporter on this number

country

The ISO 3166-1 alpha-2 country code to which the number belongs to

region

The telecom service area to which the number belongs to.

one_time_price

The one time purchase cost associated with the number.

rental_price

The rental cost associated with the number.

incoming_rate

The rate per pulse for an incoming call.

incoming_pulse

The telephone pulse rate.

number_type

The type of the number.

vanity_number

These are easily memorizable numbers. Eg: 1-800-Flowers