Reference Turnkey Applications Tutorials Visual Designer
    • REST API
      • Overview
      • API Endpoint
      • Authentication
      • Requests
      • Responses
      • Paging
      • Reason Codes Dictionary
    • Management APIs
      • Accounts
      • Identity Access Management Early Access
        • Identity Access Management Overview
        • Identity Access Management API
          • User Management
            • Create a User
            • Update a User
            • Retrieve a User
            • Delete a User
          • API Keys Management
            • Create an API Key
            • Update an API Key
            • Retrieve an API Key
            • Delete an API Key
      • Applications
      • Clients
        • Create a Client
        • Delete a Client
        • Change Client’s Password
        • Get a List of Available Clients
      • Incoming Phone Numbers
        • IncomingPhoneNumber Instance Resource
        • IncomingPhoneNumbers List Resource
        • Local IncomingPhoneNumber Factory Resource
        • Toll-Free IncomingPhoneNumber Factory Resource
        • Mobile IncomingPhoneNumber Factory Resource
        • Attach a phone number to an application
        • Delete a phone number
        • List of Phone Numbers
        • Incoming Phone Number Regex Support
      • Notifications
      • Usage Records
    • Voice
      • Calls
        • Call List Resource URI
        • Making a Call
        • Modifying Live Calls
        • Examples
        • List Filter
        • Paging Information
      • Conference Management
        • Supported Operations
        • Conference List Resource URI
      • Conference Participants Management
        • Participants List Resource URI
      • Gather DTMF
      • Gather Speech
      • Say
      • Play
      • Hold
      • Recordings
      • Refers
        • Resource Properties
        • Supported Operations
        • Paging Information
      • Resume
      • SIP Refer Support
    • SMS
      • Messages
        • Send SMS
        • Get SMS List
        • Get single SMS Information
        • SMS Attributes
      • Email
    • RCML
      • Overview
        • Interacting with Your Application
        • RCML Verbs
      • Dial
        • Client
        • Conference
        • Number
        • SIP
      • Email
      • Gather
      • Say
      • Play
      • SMS
      • Hold
      • Resume
      • Hangup
      • Pause
      • Redirect
      • Record
      • Reject
      • Refer
    • Visual Designer API
      • List Application Templates
      • :List a Specific Application Template
      • Create a Visual Designer Application
      • Get Application Details
      • Save Application Changes
      • Create Application Parameters
      • List Application Parameters
      • Delete Application Parameters
      • Upload Application Media Files
      • List Application Media Files
      • Play Application Media Files
      • Delete Application Media Files
      • Get Application Logs
      • Delete Application Logs
      • Get Application Settings
      • Modify Application Settings
      • Rename an Application
      • Delete an Application
      • Get Visual Designer Configuration
    • Turnkey Apps APIs
      • Smart 2FA
        • Sending One-Time Passwords
        • Verifying One-Time Passwords
        • Cancel One-Time Passwords
        • Session Detail Record (SDR)
        • Get list of One-Time Passwords
        • Get a Single One-Time Password
        • Usage Record One-Time Passwords
        • Common Response Error Code
        • Limit
          • Create Limit
          • Update Limit
          • Delete Limit
          • Get List of Limits
      • Call Queuing
      • Auto Attendant
        • Users
        • Announcement
        • Auto Attendant System
        • Menu
        • Schedule
        • Phone Number
        • Usage Records
        • Third Party Integration
      • Number Masking
        • Application
        • Mask Number Pool
        • Context
        • Participants
        • Interactions
        • Usage Records
      • Task Router
docs 1.0
  • docs
    • 1.0
  • docs
  • Available Phone Numbers

Available Phone Numbers

AvailablePhoneNumbers

The AvailablePhoneNumbers subresources lets you search for incoming local and toll-free phone numbers that are available for you to purchase. AvailablePhoneNumbers List Resource URI. /2012-04-24/Accounts/{AccountSid}/AvailablePhoneNumbers/US/Local Searching For Numbers. When using Restcomm the way to search for new phone numbers is by searching the AvailablePhoneNumbers list resource and providing the desired area code as a filter.

Resource Properties

The following properties are available for phone numbers from the US and Canada:

Property Description

FriendlyName

A nicely-formatted version of the phone number.

PhoneNumber

The phone number, in E.164 (i.e. "+1") format.

Lata

The LATA of this phone number.

RateCenter

The rate center of this phone number.

Latitude

The latitude coordinate of this phone number.

Longitude

The longitude coordinate of this phone number.

Region

The two-letter state or province abbreviation of this phone number.

PostalCode

The postal (zip) code of this phone number.

IsoCountry

The ISO country code of this phone number.

Capabilities

This is a set of boolean properties that indicate whether a phone number can receive calls or messages. Possible capabilities are Voice, SMS, and MMS with each having a value of either true or false.

The following properties are available for phone numbers outside the US and Canada:

Property Description

FriendlyName

A nicely-formatted version of the phone number.

PhoneNumber

The phone number, in [E.164] (i.e. "+44") format.

IsoCountry

The ISO country code of this phone number.

Capabilities

This is a set of boolean properties that indicate whether a phone number can receive calls or messages. Possible capabilities are Voice, SMS, and MMS with each having a value of either true or false.

Address Requirement Values

The following are the possible values for the address_required property.

Status Description

none

An Address is not required for this phone number.

any

Your account must have an Address, but it can be anywhere in the world.

local

Your account must have an Address within the phone number’s country.

foreign

Your account must have an Address outside the phone number’s country.

AvailablePhoneNumber Toll-Free Instance Resource

Some DID providers allow toll-free numbers from the US, Canada, and the UK.

Resource URI

An AvailablePhoneNumber toll-free instance resource has no URI. You cannot make requests directly to AvailablePhoneNumber instance resources. Instead, make a request to the toll-free list subresource and then choose a number from the list.

AvailablePhoneNumber Toll-Free Instance Attributes

Property Description

FriendlyName

A nicely-formatted version of the phone number.

PhoneNumber

The phone number, in E.164 (i.e. "+1") format.

IsoCountry

The ISO country code of this phone number.

Capabilities

This is a set of boolean properties that indicate whether a phone number can receive calls or messages. Possible capabilities are Voice, SMS, and MMS with each having a value of either true or false.

AddressRequirements

This indicates whether the phone number requires you or your customer to have an Address registered with Restcomm. Possible values are none, any, local, or foreign.

AvailablePhoneNumber Mobile Instance Resource

Resource URI

An AvailablePhoneNumber mobile instance resource has no URI. You cannot make requests directly to AvailablePhoneNumber instance resources. Instead, make a request to the mobile list subresource and then choose a number from the list.

AvailablePhoneNumber Mobile Instance Attributes

Property Description

FriendlyName

A nicely-formatted version of the phone number.

PhoneNumber

The phone number, in E.164 (i.e. "+1") format.

IsoCountry

The ISO country code of this phone number.

Capabilities

This is a set of boolean properties that indicate whether a phone number can receive calls or messages. Possible capabilities are Voice, SMS, and MMS with each having a value of either true or false.

AddressRequirements

This indicates whether the phone number requires you or your customer to have an Address registered with Restcomm. Possible values are none, any, local, or foreign.

AvailablePhoneNumbers Local List Subresource

Resource URI

/2012-04-24//Accounts/\{AccountSid}/AvailablePhoneNumbers/{IsoCountryCode}/Local

{IsoCountryCode} is a country code in ISO 3166-1 alpha-2 format. For example, the IsoCountryCode for Canada is CA. See Supported Countries for a full list of countries and IsoCountryCodes supported by Restcomm.

HTTP GET

Returns a list of local AvailablePhoneNumber resource representations that match the specified filters, each representing a phone number that is currently available for provisioning within your account.

Basic List Filters

The following basic GET query string parameters allow you to filter the list of numbers returned by Restcomm. Note, parameters are case-sensitive.

Parameter Description

AreaCode

Find phone numbers in the specified area code. (US and Canada only)

Contains

A pattern to match phone numbers on. Valid characters are '' and [0-9a-zA-Z]. The '' character will match any single digit.

SmsEnabled

This indicates whether the phone numbers can receive text messages. Possible values are true or false.

MmsEnabled

This indicates whether the phone numbers can receive MMS messages. Possible values are true or false.

VoiceEnabled

This indicates whether the phone numbers can receive calls. Possible values are true or false.

ExcludeAllAddressRequired

Indicates whether the response includes phone numbers which require any Address. Possible values are true or false. If not specified, the default is false, and results could include phone numbers with an Address required.

ExcludeLocalAddressRequired

Indicates whether the response includes phone numbers which require a local Address. Possible values are true or false. If not specified, the default is false, and results could include phone numbers with a local Address required.

ExcludeForeignAddressRequired

Indicates whether the response includes phone numbers which require a foreign Address. Possible values are true or false. If not specified, the default is false, and results could include phone numbers with a foreign Address required.

Beta

Include phone numbers new to the Restcomm platform. Possible values are either true or false. Default is true.

Supported Operations

HTTP GET.

Returns the representation of an AvailablePhoneNumber resource, including the properties above.

Request Parameters

Property Description

AreaCode

A three digit area code inside the U.S.

Querying Available Phone Numbers

You need to be using Restcomm Cloud or setup the DID Provider in Restcomm in order to be able to use this feature. See the Tutorial section.

Here is an example, the AreaCode is any valid United States Code

curl -X GET https://mycompany.restcomm.com/restcomm/2012-04-24/Accounts/ACCOUNT_SID/AvailablePhoneNumbers/US/Local.json?AreaCode=305  \
   -u 'YourAccountSid:YourAuthToken'
const request = require('request');

// Provide your Account Sid and Auth Token from your Console Account page
const ACCOUNT_SID = 'my_ACCOUNT_SID';
const AUTH_TOKEN = 'my_AUTH_TOKEN';

request({
      method: 'GET',
      url: 'https://mycompany.restcomm.com/restcomm/2012-04-24/Accounts/' + ACCOUNT_SID + '/AvailablePhoneNumbers/US/Local.json?AreaCode=305',
      auth: { 'user': ACCOUNT_SID, 'pass': AUTH_TOKEN }
   },
   function (error, response, body) {
      // Add your business logic below; status can be found at 'response.statusCode' and response body at 'body'
      ...
   }
);
from http.client import HTTPSConnection
from base64 import b64encode

# Provide your Account Sid and Auth Token from your Console Account page
ACCOUNT_SID = 'my_ACCOUNT_SID'
AUTH_TOKEN = 'my_AUTH_TOKEN'

userAndPass = b64encode(bytes(ACCOUNT_SID + ':' + AUTH_TOKEN, 'utf-8')).decode("ascii")
headers = { 'Authorization' : 'Basic %s' %  userAndPass }

conn = HTTPSConnection('mycompany.restcomm.com')
conn.request("GET", '/restcomm/2012-04-24/Accounts/' + ACCOUNT_SID + '/AvailablePhoneNumbers/US/Local.json?AreaCode=305',
      headers=headers)
res = conn.getresponse()

# Add your business logic below; status can be found at 'res.status', reason at 'res.reason' and response body can be retrieved with res.read()
...
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import java.io.*;
import java.util.Base64;

public class JavaSampleClass {
   // Provide your Account Sid and Auth Token from your Console Account page
   public static final String ACCOUNT_SID = "my_ACCOUNT_SID";
   public static final String AUTH_TOKEN = "my_AUTH_TOKEN";


   public static void main(String[] args) throws Exception {
      String userAndPass = ACCOUNT_SID + ':' + AUTH_TOKEN;
      String encoded = Base64.getEncoder().encodeToString(userAndPass.getBytes());

      URL url = new URL("https://mycompany.restcomm.com/restcomm/2012-04-24/Accounts/" + ACCOUNT_SID + "/AvailablePhoneNumbers/US/Local.json?AreaCode=305");
      HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();
      conn.setRequestProperty("Authorization", "Basic " + encoded);
      conn.setRequestMethod("GET");

      // Add your business logic below; response code can be obtained from 'conn.getResponseCode()' and input stream from 'conn.getInputStream()'
      ...
  }
}

The AvailablePhoneNumbers subresources let you search for incoming local and toll-free phone numbers that are available for you to purchase.

  • AvailablePhoneNumbers List Resource URI. /2012-04-24/Accounts/{AccountSid}/AvailablePhoneNumbers/US/Local

Searching For Numbers. When using Restcomm the way to search for new phone numbers is by searching the AvailablePhoneNumbers list resource and providing the desired area code as a filter.

Supported Operations

HTTP GET

Returns the representation of an AvailablePhoneNumber resource, including the properties above.

Request Parameters

Property Description

AreaCode

A three digit area code inside the U.S.

Platform

Programmable Voice

Programmable SMS

Turnkey Applications

Smart 2FA

Call Queue

Auto Attendant

Number Masking

Task Router

Campaign Manager

Learn

Terms And Conditions

About

ABOUT

CONTACT US

© 2020, All rights reserved.