×

Available ExoPhones Beta

This API will list the ExoPhone resources and get the Exophones that are available 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
  • DL - Delhi Circle
  • KA - Karnataka Circle
  • KL - Kerala
  • MH - Maharashtra
  • MP - Madhya Pradesh
  • MU - Mumbai Circle
  • RJ - Rajasthan
  • TN - Tamilnadu
  • 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


Get an ExoPhone Beta

To begin using a new ExoPhone, make an HTTP POST request to:

POST

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

  • 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

The following are the POST parameters:

Parameter Name

Mandatory/Optional

Value

PhoneNumber

Mandatory

The ExoPhone that you wish to get.

VoiceUrl

Optional

The VoiceURL to be associated to this number. The URL is of the form: http://my.exotel.com/{your_sid}/exoml/start_voice/{app_id} where app_id is the identifier of the flow (or applet) that you want to connect to once the From number picks up the call. You can get the app_id from your Exotel Dashboard.

SMSUrl

Optional

The SMSUrl to be associated to this number. The URL is of the form: http://my.exotel.com/{your_sid}/exoml/start_sms/{app_id} where app_id is the identifier of the flow (or applet) that you want to connect to once an incoming SMS is received.

FriendlyName

Optional

A friendly name that can be used to identify this number easily.

curl -X POST https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers \
  -d "PhoneNumber=XXXXX30240"
    
var request = require('request');
var dataString = 'PhoneNumber=XXXXX30240';
var options = {
    url: 'https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers',
    method: 'POST',
    body: dataString
};
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();
$data = array(
    'PhoneNumber' => 'XXXXX30240'
);
$response = Requests::post('https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers', $headers, $data);
    
import requests
data = {
  'PhoneNumber': 'XXXXX30240'
}
requests.post('https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers', data=data)
    
require 'net/http'
require 'uri'
uri = URI.parse("https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers")
request = Net::HTTP::Post.new(uri)
request.set_form_data(
  "PhoneNumber" => "XXXXX30240",
)
req_options = {
  use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
  http.request(request)
end
# response.code
# response.body
    

HTTP Response:

  • On success, the HTTP response status code will be 200
  • The sid is the unique identifier of the number
  • the HTTP body will contain an JSON similar to the one below:
{
  "sid": "9eeafc8ab479a386dc95f854f9d7cd8a",
  "date_created": "2016-11-09 13:48:12",
  "date_updated": "2017-03-30 14:19:02",
  "account_sid": "Exotel",
  "friendly_name": "XXXXX30240",
  "phone_number": "+91XXXX30240",
  "capabilities": {
      "voice": true,
      "sms": true
  },
  "country": "IN",
  "region": "WB",
  "one_time_price": "0.000000",
  "rental_price": "499.000000",
  "incoming_rate": "0.000000",
  "incoming_pulse": "60",
  "currency": "INR",
  "number_type": "Landline",
  "vanity_number": false,
  "voice_url": "https://my.exotel.in/Exotel/exoml/start_voice/12XX48",
  "sms_url": "https://my.exotel.in/Exotel/exoml/start_sms/22XX39",
  "uri": "/v2_beta/Accounts/Exotel/IncomingPhoneNumbers/9eeafc8ab479a386dc95f854f9d7cd8a"
}

Description of IncomingPhoneNumbers Parameters:

Parameter Name

Type & Value

sid

string; an alpha-numeric unique identifier of the number

date_created

Time in format YYYY-MM-DD HH:mm:ss; Date and time at which the number was purchases

date_updated

Time in format YYYY-MM-DD HH:mm:ss; Date and time at which the details of the number was last updated

account_sid

Exotel account SID

phone_number

The phone number that was purchased

friendly_name

A freindly name that can be used to identify the number

capabilities

These are the capabilities that are supported on this number:

  • voice - Boolean that indicates if incoming voice calls are supported on the number
  • sms - Boolean that indicates if incoming SMS is supported on the number

country

ISO Country Code to which this number belongs to

region

The telecom circle this number belongs to

one_time_price

One time cost incurred while purchasing this number

rental_price

Double; Recurring monthly rental associated with this number

incoming_rate

Double; The per pulse cost for incoming calls

incoming_pulse

Double; The duration of one pulse in seconds

currency

Double; The currency in which this number is billed

number_type

Double; The type of the number

vanity_number

Boolean; Indicates if this number is a vanity number

voice_url

string; The Url to the flow to which incoming calls are connected to

sms_url

string; The Url to the flow to which incoming SMS are connected to

uri

string; The URI is the path of the ExoPhone SID.


Assign number to a flow Beta

To assign an ExoPhone to a flow you need to make a HTTP PUT request to:

PUT

https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<exophone_sid>

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

The following are the PUT parameters:

Parameter Name

Mandatory/Optional

Value

VoiceUrl

Optional

The VoiceURL to be associated to this number. The URL is of the form: http://my.exotel.com/{your_sid}/exoml/start_voice/{app_id} where app_id is the identifier of the flow (or applet) that you want to connect to once the From number picks up the call. You can get the app_id from your Exotel Dashboard.

SMSUrl

Optional

The SMSUrl to be associated to this number. The URL is of the form: http://my.exotel.com/{your_sid}/exoml/start_sms/{app_id} where app_id is the identifier of the flow (or applet) that you want to connect to once an incoming SMS is received.

FriendlyName

Optional

A friendly name that can be used to identify this number easily.

curl -X PUT https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<exophone_sid< \
  -d "FriendlyName=Sales"
    
var request = require('request');
var dataString = 'FriendlyName=Sales';
var options = {
    url: 'https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<exophone_sid<',
    method: 'PUT',
    body: dataString
};
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();
$data = array(
    'FriendlyName' => 'Sales'
);
$response = Requests::put('https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<exophone_sid<', $headers, $data);
    
import requests
data = {
  'FriendlyName': 'Sales'
}
requests.put('https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<exophone_sid<', data=data)
    
require 'net/http'
require 'uri'
uri = URI.parse("https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<exophone_sid<")
request = Net::HTTP::Put.new(uri)
request.set_form_data(
  "FriendlyName" => "Sales",
)
req_options = {
  use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
  http.request(request)
end
# response.code
# response.body
    

HTTP Response:

  • On success, the HTTP response status code will be 200
  • The sid is the unique identifier of the number
  • the HTTP body will contain an JSON similar to the one below:
{
  "sid": "9eeafc8ab479a386dc95f854f9d7cd8a",
  "date_created": "2016-11-09 13:48:12",
  "date_updated": "2017-03-30 14:19:02",
  "account_sid": "Exotel",
  "friendly_name": "Sales",
  "phone_number": "+91XXXXXXX40",
  "capabilities": {
      "voice": true,
      "sms": true
  },
  "country": "IN",
  "region": "WB",
  "one_time_price": "0.000000",
  "rental_price": "0.000000",
  "incoming_rate": "0.000000",
  "incoming_pulse": "60",
  "currency": "INR",
  "number_type": "Landline",
  "vanity_number": false,
  "voice_url": "https://my.exotel.in/Exotel/exoml/start_voice/1XXXX8",
  "sms_url": "https://my.exotel.in/Exotel/exoml/start_sms/2XXXX9",
  "uri": "/v2_beta/Accounts/Exotel/IncomingPhoneNumbers/9eeafc8ab479a386dc95f854f9d7cd8a"
}
  

Description of IncomingPhoneNumbers Parameters:

Parameter Name

Type & Value

sid

string; an alpha-numeric unique identifier of the number

date_created

Time in format YYYY-MM-DD HH:mm:ss; Date and time at which the number was purchases

date_updated

Time in format YYYY-MM-DD HH:mm:ss; Date and time at which the details of the number was last updated

account_sid

Exotel account SID

phone_number

The phone number that was purchased

friendly_name

A freindly name that can be used to identify the number

PhoneNumberSid

This is your ExoPhone/Exotel Virtual Number

capabilities

These are the capabilities that are supported on this number:

• voice - Boolean that indicates if incoming voice calls are supported on the number

• sms - Boolean that indicates if incoming SMS is supported on the number

country

ISO Country Code to which this number belongs to

region

The telecom circle this number belongs to

one_time_price

One time cost incurred while purchasing this number

rental_price

Double; Recurring monthly rental associated with this number

incoming_rate

Double; The per pulse cost for incoming calls

incoming_pulse

Double; The duration of one pulse in seconds

currency

Double; The currency in which this number is billed

number_type

Double; The type of the number

vanity_number

Boolean; Indicates if this number is a vanity number

voice_url

string; The Url to the flow to which incoming calls are connected to

sms_url

string; The Url to the flow to which incoming SMS are connected to

uri

string; The Url to the flow to which incoming calls are connected to


ExoPhone Details Beta

List all ExoPhones

To get a list of all the ExoPhone numbers that have been assigned to an account, you will need to make a HTTP GET request to:

GET

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

  • 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>/IncomingPhoneNumbers 
var request = require('request');
var options = {
    url: 'https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers'
};
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>/IncomingPhoneNumbers', $headers);
    
import requests
requests.get('https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers')
    
require 'net/http'
require 'uri'
uri = URI.parse("https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers")
response = Net::HTTP.get_response(uri)
# response.code
# response.body
    

HTTP Response:

  • On success, the HTTP response status code will be 200
  • The sid is the unique identifier of the number
  • the HTTP body will contain an JSON similar to the one below:
{
  "page": 0,
  "page_size": 50,
  "uri": "http://twilix.exotel.com/v2_beta/Accounts/Exotel/IncomingPhoneNumbers?Page=0&PageSize=50",
  "first_page_uri": "http://twilix.exotel.com/v2_beta/Accounts/Exotel/IncomingPhoneNumbers?Page=0&PageSize=50",
  "next_page_uri": "http://twilix.exotel.com/v2_beta/Accounts/Exotel/IncomingPhoneNumbers?Page=1&PageSize=50",
  "previous_page_uri": null,
  "incoming_phone_numbers": [
    {
      "sid": "011XXXXXXX1",
      "date_created": "2016-03-04 17:31:50",
      "date_updated": "2017-09-22 22:47:00",
      "account_sid": "Exotel",
      "friendly_name": "011XXXXXXX6",
      "phone_number": "+9111XXXXXXX6",
      "capabilities": {
        "voice": true,
        "sms": true
      },
      "country": "IN",
      "region": "DL",
      "one_time_price": "0.000000",
      "rental_price": "0.000000",
      "incoming_rate": "0.000000",
      "incoming_pulse": "60",
      "currency": "INR",
      "number_type": "Landline",
      "vanity_number": false,
      "voice_url": null,
      "sms_url": null,
      "uri": "/v2_beta/Accounts/Exotel/IncomingPhoneNumbers/011XXXXXXX6"
    },
    {
      "sid": "011XXXXXXX0",
      "date_created": "2016-04-07 12:13:20",
      "date_updated": "2016-04-07 12:13:30",
      "account_sid": "Exotel",
      "friendly_name": "011XXXXXXX0",
      "phone_number": "+911XXXXXXXX0",
      "capabilities": {
        "voice": true,
        "sms": true
      },
      "country": "IN",
      "region": "DL",
      "one_time_price": "0.000000",
      "rental_price": "0.000000",
      "incoming_rate": "0.000000",
      "incoming_pulse": "60",
      "currency": "INR",
      "number_type": "Landline",
      "vanity_number": false,
      "voice_url": "http://my.exotel.in/Exotel/exoml/start_voice/7XXX1",
      "sms_url": "http://my.exotel.in/Exotel/exoml/start_sms/7XXX1",
      "uri": "/v2_beta/Accounts/Exotel/IncomingPhoneNumbers/011XXXXXXX0"
    }
  ]
}

Description of Parameters:

Parameter Name

Type & Value

sid

string; an alpha-numeric unique identifier of the number

date_created

Time in format YYYY-MM-DD HH:mm:ss; Date and time at which the number was purchases

date_updated

Time in format YYYY-MM-DD HH:mm:ss; Date and time at which the details of the number was last updated

account_sid

Exotel account SID

phone_number

The phone number that was purchased

friendly_name

A freindly name that can be used to identify the number

capabilities

These are the capabilities that are supported on this number:

• voice - Boolean that indicates if incoming voice calls are supported on the number

• sms - Boolean that indicates if incoming SMS is supported on the number

country

ISO Country Code to which this number belongs to

region

The telecom circle this number belongs to

one_time_price

One time cost incurred while purchasing this number

rental_price

Double; Recurring monthly rental associated with this number

incoming_rate

Double; The per pulse cost for incoming calls

incoming_pulse

Double; The duration of one pulse in seconds

currency

Double; The currency in which this number is billed

number_type

Double; The type of the number

vanity_number

Boolean; Indicates if this number is a vanity number

voice_url

string; The Url to the flow to which incoming calls are connected to

sms_url

string; The Url to the flow to which incoming SMS are connected to

uri

string; The Url to the flow to which incoming calls are connected to

Get Details of an ExoPhone

To get the details of a specific ExoPhone number of an account, make an HTTP GET request to:

GET

https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<exophone_sid>

Replace <your_api_key> and <your_api_token> with the API key and token created by you. Similarly, replace <your_sid> with your “Account sid” value. These values are available in the API settings page of your Exotel Dashboard. Replace <exophone_sid> with the ExoPhone sid.

curl -X GET https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<exophone_sid>
var request = require('request');
var options = {
    url: 'https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<exophone_sid>'
};
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>/IncomingPhoneNumbers/<exophone_sid>', $headers);
    
import requests
requests.get('https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<exophone_sid>')
    
require 'net/http'
require 'uri'
uri = URI.parse("https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<exophone_sid>")
response = Net::HTTP.get_response(uri)
# response.code
# response.body
    

HTTP Response:

  • On success, the HTTP response status code will be 200
  • The sid is the unique identifier of the number
  • the HTTP body will contain an JSON similar to the one below:
{
  "sid": "9eeafc8ab479a386dc95f854f9d7cd8a",
  "date_created": "2016-11-09 13:48:12",
  "date_updated": "2017-03-30 14:19:02",
  "account_sid": "Exotel",
  "friendly_name": "XXXXX30240",
  "phone_number": "+91XXXX30240",
  "capabilities": {
      "voice": true,
      "sms": true
  },
  "country": "IN",
  "region": "WB",
  "one_time_price": "0.000000",
  "rental_price": "499.000000",
  "incoming_rate": "0.000000",
  "incoming_pulse": "60",
  "currency": "INR",
  "number_type": "Landline",
  "vanity_number": false,
  "voice_url": "https://my.exotel.in/Exotel/exoml/start_voice/12XX48",
  "sms_url": "https://my.exotel.in/Exotel/exoml/start_sms/22XX39",
  "uri": "/v2_beta/Accounts/Exotel/IncomingPhoneNumbers/9eeafc8ab479a386dc95f854f9d7cd8a"
}

Delete a ExoPhone Number Beta

To release a number from your account, you need to make a HTTP DELETE request to:

DELETE

https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<exophone_sid>

  • 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 DELETE https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<exophone_sid>
var request = require('request');
var options = {
    url: 'https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<exophone_sid>'
};
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>/IncomingPhoneNumbers/<exophone_sid>', $headers);
    
import requests
requests.delete('https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<exophone_sid>')
    
require 'net/http'
require 'uri'
uri = URI.parse("https://<your_api_key>:<your_api_token><subdomain>/v2_beta/Accounts/<your_sid>/IncomingPhoneNumbers/<number_sid>")
response = Net::HTTP.get_response(uri)
# response.code
# response.body
    

HTTP Response:

  • On success, the HTTP response status code will be 202
  • The sid is the unique identifier of the number
  • the HTTP body will contain an JSON similar to the one below:
{
  "Status":202,
  "Message":"Accepted"
}