×

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"
}