Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

IncomingPhoneNumber resource


An IncomingPhoneNumber instance resource represents a Twilio phone number provisioned from Twilio, ported or hosted to Twilio.

The IncomingPhoneNumbers list resource represents an account's Twilio phone numbers. You can POST to the list resource to provision a new Twilio number. To find a new number to provision use the subresources of the AvailablePhoneNumbers resource.

You can transfer phone numbers between two Twilio accounts if you're using subaccounts. For details, see Exchanging Numbers Between Subaccounts.

(information)

Info

Provisioning a phone number is a two-step process. First, you must find an available phone number to provision using the subresources of the AvailablePhoneNumbers resource. Second, you must POST to the IncomingPhoneNumbers list resource, documented below.

(warning)

Warning

NOTE: The order of the columns in the CSV is not defined and may change when new fields are added to the API response. Your application design should be resilient to changes in the order of the columns in the CSV response.


IncomingPhoneNumber Properties

incomingphonenumber-properties page anchor
Resource properties
account_sidtype: SID<AC>Not PII

address_sidtype: SID<AD>Not PII

The SID of the Address resource associated with the phone number.


address_requirementstype: enum<STRING>Not PII

Whether the phone number requires an Address(link takes you to an external page) registered with Twilio. Can be: none, any, local, or foreign.

Possible values:
noneanylocalforeign

api_versiontype: stringNot PII

The API version used to start a new TwiML session.


betatype: booleanNot PII

Whether the phone number is new to the Twilio platform. Can be: true or false.


capabilitiestype: object<PHONE NUMBER CAPABILITIES>Not PII

The set of Boolean properties that indicate whether a phone number can receive calls or messages. Capabilities are Voice, SMS, and MMS and each capability can be: true or false.


date_createdtype: string<DATE TIME RFC 2822>Not PII

The date and time in GMT that the resource was created specified in RFC 2822(link takes you to an external page) format.


date_updatedtype: string<DATE TIME RFC 2822>Not PII

The date and time in GMT that the resource was last updated specified in RFC 2822(link takes you to an external page) format.


friendly_nametype: stringPII MTL: 30 days

The string that you assigned to describe the resource.


identity_sidtype: SID<RI>Not PII

The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations.


phone_numbertype: string<PHONE NUMBER>Not PII

The phone number in E.164(link takes you to an external page) format, which consists of a + followed by the country code and subscriber number.


origintype: stringNot PII

The phone number's origin. twilio identifies Twilio-owned phone numbers and hosted identifies hosted phone numbers.


sidtype: SID<PN>Not PII

The unique string that that we created to identify this IncomingPhoneNumber resource.


sms_application_sidtype: SID<AP>Not PII

The SID of the application that handles SMS messages sent to the phone number. If an sms_application_sid is present, we ignore all sms_*_url values and use those of the application.


sms_fallback_methodtype: enum<HTTP METHOD>Not PII

The HTTP method we use to call sms_fallback_url. Can be: GET or POST.

Possible values:
HEADGETPOSTPATCHPUTDELETE

sms_fallback_urltype: string<URI>Not PII

The URL that we call when an error occurs while retrieving or executing the TwiML from sms_url.


sms_methodtype: enum<HTTP METHOD>Not PII

The HTTP method we use to call sms_url. Can be: GET or POST.

Possible values:
HEADGETPOSTPATCHPUTDELETE

sms_urltype: string<URI>Not PII

The URL we call when the phone number receives an incoming SMS message.


status_callbacktype: string<URI>Not PII

The URL we call using the status_callback_method to send status information to your application.


status_callback_methodtype: enum<HTTP METHOD>Not PII

The HTTP method we use to call status_callback. Can be: GET or POST.

Possible values:
HEADGETPOSTPATCHPUTDELETE

trunk_sidtype: SID<TK>Not PII

The SID of the Trunk that handles calls to the phone number. If a trunk_sid is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a trunk_sid will automatically delete your voice_application_sid and vice versa.


uritype: stringNot PII

The URI of the resource, relative to https://api.twilio.com.


voice_receive_modetype: enum<STRING>Not PII
Possible values:
voicefax

voice_application_sidtype: SID<AP>Not PII

The SID of the application that handles calls to the phone number. If a voice_application_sid is present, we ignore all of the voice urls and use those set on the application. Setting a voice_application_sid will automatically delete your trunk_sid and vice versa.


voice_caller_id_lookuptype: booleanNot PII

Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: true or false.


voice_fallback_methodtype: enum<HTTP METHOD>Not PII

The HTTP method we use to call voice_fallback_url. Can be: GET or POST.

Possible values:
HEADGETPOSTPATCHPUTDELETE

voice_fallback_urltype: string<URI>Not PII

The URL that we call when an error occurs retrieving or executing the TwiML requested by url.


voice_methodtype: enum<HTTP METHOD>Not PII

The HTTP method we use to call voice_url. Can be: GET or POST.

Possible values:
HEADGETPOSTPATCHPUTDELETE

voice_urltype: string<URI>Not PII

The URL we call when the phone number receives a call. The voice_url will not be used if a voice_application_sid or a trunk_sid is set.


emergency_statustype: enum<STRING>Not PII

The parameter displays if emergency calling is enabled for this number. Active numbers may place emergency calls by dialing valid emergency numbers for the country.

Possible values:
ActiveInactive

emergency_address_sidtype: SID<AD>Not PII

The SID of the emergency address configuration that we use for emergency calling from this phone number.


emergency_address_statustype: enum<STRING>Not PII

The status of address registration with emergency services. A registered emergency address will be used during handling of emergency calls from this number.

Possible values:
registeredunregisteredpending-registrationregistration-failurepending-unregistrationunregistration-failure

bundle_sidtype: SID<BU>Not PII

The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations.


statustype: stringNot PII

Create an IncomingPhoneNumber resource

create-an-incomingphonenumber-resource page anchor
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers.json

Parameters

create-parameters page anchor
URI parameters
AccountSidtype: SID<AC>Not PII
Path Parameter

The SID of the Account(link takes you to an external page) that will create the resource.


Request body parameters
ApiVersiontype: stringNot PII

The API version to use for incoming calls made to the new phone number. The default is 2010-04-01.


FriendlyNametype: stringPII MTL: 30 days

A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, this is a formatted version of the new phone number.


SmsApplicationSidtype: SID<AP>Not PII

The SID of the application that should handle SMS messages sent to the new phone number. If an sms_application_sid is present, we ignore all of the sms_*_url urls and use those set on the application.


SmsFallbackMethodtype: enum<HTTP METHOD>Not PII

The HTTP method that we should use to call sms_fallback_url. Can be: GET or POST and defaults to POST.

Possible values:
HEADGETPOSTPATCHPUTDELETE

SmsFallbackUrltype: string<URI>Not PII

The URL that we should call when an error occurs while requesting or executing the TwiML defined by sms_url.


SmsMethodtype: enum<HTTP METHOD>Not PII

The HTTP method that we should use to call sms_url. Can be: GET or POST and defaults to POST.

Possible values:
HEADGETPOSTPATCHPUTDELETE

SmsUrltype: string<URI>Not PII

The URL we should call when the new phone number receives an incoming SMS message.


StatusCallbacktype: string<URI>Not PII

The URL we should call using the status_callback_method to send status information to your application.


StatusCallbackMethodtype: enum<HTTP METHOD>Not PII

The HTTP method we should use to call status_callback. Can be: GET or POST and defaults to POST.

Possible values:
HEADGETPOSTPATCHPUTDELETE

VoiceApplicationSidtype: SID<AP>Not PII

The SID of the application we should use to handle calls to the new phone number. If a voice_application_sid is present, we ignore all of the voice urls and use only those set on the application. Setting a voice_application_sid will automatically delete your trunk_sid and vice versa.


VoiceCallerIdLookuptype: booleanNot PII

Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: true or false and defaults to false.


VoiceFallbackMethodtype: enum<HTTP METHOD>Not PII

The HTTP method that we should use to call voice_fallback_url. Can be: GET or POST and defaults to POST.

Possible values:
HEADGETPOSTPATCHPUTDELETE

VoiceFallbackUrltype: string<URI>Not PII

The URL that we should call when an error occurs retrieving or executing the TwiML requested by url.


VoiceMethodtype: enum<HTTP METHOD>Not PII

The HTTP method that we should use to call voice_url. Can be: GET or POST and defaults to POST.

Possible values:
HEADGETPOSTPATCHPUTDELETE

VoiceUrltype: string<URI>Not PII

The URL that we should call to answer a call to the new phone number. The voice_url will not be called if a voice_application_sid or a trunk_sid is set.


EmergencyStatustype: enum<STRING>Not PII

The parameter displays if emergency calling is enabled for this number. Active numbers may place emergency calls by dialing valid emergency numbers for the country.

Possible values:
ActiveInactive

EmergencyAddressSidtype: SID<AD>Not PII

The SID of the emergency address configuration to use for emergency calling from the new phone number.


TrunkSidtype: SID<TK>Not PII

The SID of the Trunk we should use to handle calls to the new phone number. If a trunk_sid is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a trunk_sid will automatically delete your voice_application_sid and vice versa.


IdentitySidtype: SID<RI>Not PII

The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations.


AddressSidtype: SID<AD>Not PII

The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations.


VoiceReceiveModetype: enum<STRING>Not PII

The configuration parameter for the new phone number to receive incoming voice calls or faxes. Can be: fax or voice and defaults to voice.

Possible values:
voicefax

BundleSidtype: SID<BU>Not PII

The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations.


PhoneNumbertype: string<PHONE NUMBER>Not PII
Required if AreaCode is not passed

The phone number to purchase specified in E.164(link takes you to an external page) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234.


AreaCodetype: stringNot PII
Required if PhoneNumber is not passed

The desired area code for your new incoming phone number. Can be any three-digit, US or Canada area code. We will provision an available phone number within this area code for you. You must provide an area_code or a phone_number. (US and Canada only).

Provision a Phone Number

provision-a-phone-number page anchor

You will be charged when you provision the number, and the number will appear on the Numbers page in the console.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.incomingPhoneNumbers
_10
.create({phoneNumber: '+15017122661'})
_10
.then(incoming_phone_number => console.log(incoming_phone_number.sid));

Output

_41
{
_41
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"address_requirements": "none",
_41
"address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"api_version": "2010-04-01",
_41
"beta": false,
_41
"capabilities": {
_41
"voice": true,
_41
"sms": false,
_41
"mms": true,
_41
"fax": false
_41
},
_41
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"emergency_status": "Active",
_41
"emergency_address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"emergency_address_status": "registered",
_41
"friendly_name": "friendly_name",
_41
"identity_sid": "RIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"origin": "origin",
_41
"phone_number": "+18089255327",
_41
"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"sms_application_sid": "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"sms_fallback_method": "GET",
_41
"sms_fallback_url": "https://example.com",
_41
"sms_method": "GET",
_41
"sms_url": "https://example.com",
_41
"status_callback": "https://example.com",
_41
"status_callback_method": "GET",
_41
"trunk_sid": null,
_41
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_41
"voice_application_sid": "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"voice_caller_id_lookup": false,
_41
"voice_fallback_method": "GET",
_41
"voice_fallback_url": "https://example.com",
_41
"voice_method": "GET",
_41
"voice_url": "https://example.com",
_41
"bundle_sid": "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"voice_receive_mode": "voice",
_41
"status": "in-use"
_41
}

Provision a Phone Number with an AddressSid and a BundleSid

provision-a-phone-number-with-an-addresssid-and-a-bundlesid page anchor

Provide an AddressSid and a BundleSid for your new IncomingPhoneNumber

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_14
// Download the helper library from https://www.twilio.com/docs/node/install
_14
// Find your Account SID and Auth Token at twilio.com/console
_14
// and set the environment variables. See http://twil.io/secure
_14
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14
const authToken = process.env.TWILIO_AUTH_TOKEN;
_14
const client = require('twilio')(accountSid, authToken);
_14
_14
client.incomingPhoneNumbers
_14
.create({
_14
addressSid: 'ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
_14
bundleSid: 'BUIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
_14
phoneNumber: '+15017122661'
_14
})
_14
.then(incoming_phone_number => console.log(incoming_phone_number.sid));

Output

_41
{
_41
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"address_requirements": "none",
_41
"address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"api_version": "2010-04-01",
_41
"beta": false,
_41
"capabilities": {
_41
"voice": true,
_41
"sms": false,
_41
"mms": true,
_41
"fax": false
_41
},
_41
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"emergency_status": "Active",
_41
"emergency_address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"emergency_address_status": "registered",
_41
"friendly_name": "friendly_name",
_41
"identity_sid": "RIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"origin": "origin",
_41
"phone_number": "+18089255327",
_41
"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"sms_application_sid": "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"sms_fallback_method": "GET",
_41
"sms_fallback_url": "https://example.com",
_41
"sms_method": "GET",
_41
"sms_url": "https://example.com",
_41
"status_callback": "https://example.com",
_41
"status_callback_method": "GET",
_41
"trunk_sid": null,
_41
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_41
"voice_application_sid": "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"voice_caller_id_lookup": false,
_41
"voice_fallback_method": "GET",
_41
"voice_fallback_url": "https://example.com",
_41
"voice_method": "GET",
_41
"voice_url": "https://example.com",
_41
"bundle_sid": "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"voice_receive_mode": "voice",
_41
"status": "in-use"
_41
}

Provision a Phone Number with a Voice URL

provision-a-phone-number-with-a-voice-url page anchor

Twilio will send a HTTP request to this URL when a call comes in to your phone number

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_13
// Download the helper library from https://www.twilio.com/docs/node/install
_13
// Find your Account SID and Auth Token at twilio.com/console
_13
// and set the environment variables. See http://twil.io/secure
_13
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_13
const authToken = process.env.TWILIO_AUTH_TOKEN;
_13
const client = require('twilio')(accountSid, authToken);
_13
_13
client.incomingPhoneNumbers
_13
.create({
_13
voiceUrl: 'https://www.your-voice-url.com/example',
_13
phoneNumber: '+15017122661'
_13
})
_13
.then(incoming_phone_number => console.log(incoming_phone_number.sid));

Output

_41
{
_41
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"address_requirements": "none",
_41
"address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"api_version": "2010-04-01",
_41
"beta": false,
_41
"capabilities": {
_41
"voice": true,
_41
"sms": false,
_41
"mms": true,
_41
"fax": false
_41
},
_41
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"emergency_status": "Active",
_41
"emergency_address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"emergency_address_status": "registered",
_41
"friendly_name": "friendly_name",
_41
"identity_sid": "RIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"origin": "origin",
_41
"phone_number": "+18089255327",
_41
"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"sms_application_sid": "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"sms_fallback_method": "GET",
_41
"sms_fallback_url": "https://example.com",
_41
"sms_method": "GET",
_41
"sms_url": "https://example.com",
_41
"status_callback": "https://example.com",
_41
"status_callback_method": "GET",
_41
"trunk_sid": null,
_41
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_41
"voice_application_sid": "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"voice_caller_id_lookup": false,
_41
"voice_fallback_method": "GET",
_41
"voice_fallback_url": "https://example.com",
_41
"voice_method": "GET",
_41
"voice_url": "https://www.your-voice-url.com/example",
_41
"bundle_sid": "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"voice_receive_mode": "voice",
_41
"status": "in-use"
_41
}

Provision a Phone Number with an SMS URL

provision-a-phone-number-with-an-sms-url page anchor

Twilio will send a HTTP request to this URL when an SMS is sent to your phone number

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_13
// Download the helper library from https://www.twilio.com/docs/node/install
_13
// Find your Account SID and Auth Token at twilio.com/console
_13
// and set the environment variables. See http://twil.io/secure
_13
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_13
const authToken = process.env.TWILIO_AUTH_TOKEN;
_13
const client = require('twilio')(accountSid, authToken);
_13
_13
client.incomingPhoneNumbers
_13
.create({
_13
smsUrl: 'https://www.your-sms-url.com/example',
_13
phoneNumber: '+15017122661'
_13
})
_13
.then(incoming_phone_number => console.log(incoming_phone_number.sid));

Output

_41
{
_41
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"address_requirements": "none",
_41
"address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"api_version": "2010-04-01",
_41
"beta": false,
_41
"capabilities": {
_41
"voice": true,
_41
"sms": false,
_41
"mms": true,
_41
"fax": false
_41
},
_41
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"emergency_status": "Active",
_41
"emergency_address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"emergency_address_status": "registered",
_41
"friendly_name": "friendly_name",
_41
"identity_sid": "RIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"origin": "origin",
_41
"phone_number": "+18089255327",
_41
"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"sms_application_sid": "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"sms_fallback_method": "GET",
_41
"sms_fallback_url": "https://example.com",
_41
"sms_method": "GET",
_41
"sms_url": "https://www.your-sms-url.com/example",
_41
"status_callback": "https://example.com",
_41
"status_callback_method": "GET",
_41
"trunk_sid": null,
_41
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_41
"voice_application_sid": "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"voice_caller_id_lookup": false,
_41
"voice_fallback_method": "GET",
_41
"voice_fallback_url": "https://example.com",
_41
"voice_method": "GET",
_41
"voice_url": "https://example.com",
_41
"bundle_sid": "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"voice_receive_mode": "voice",
_41
"status": "in-use"
_41
}


Fetch an IncomingPhoneNumber resource

fetch-an-incomingphonenumber-resource page anchor
GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{Sid}.json

URI parameters
AccountSidtype: SID<AC>Not PII
Path Parameter

The SID of the Account(link takes you to an external page) that created the IncomingPhoneNumber resource to fetch.


Sidtype: SID<PN>Not PII
Path Parameter

The Twilio-provided string that uniquely identifies the IncomingPhoneNumber resource to fetch.

Fetch an IncomingPhoneNumber

fetch-an-incomingphonenumber page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.incomingPhoneNumbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.fetch()
_10
.then(incoming_phone_number => console.log(incoming_phone_number.friendlyName));

Output

_41
{
_41
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"address_requirements": "none",
_41
"address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"api_version": "2010-04-01",
_41
"beta": false,
_41
"capabilities": {
_41
"voice": true,
_41
"sms": false,
_41
"mms": true,
_41
"fax": false
_41
},
_41
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"emergency_status": "Active",
_41
"emergency_address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"emergency_address_status": "registered",
_41
"friendly_name": "(808) 925-5327",
_41
"identity_sid": "RIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"origin": "origin",
_41
"phone_number": "+18089255327",
_41
"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"sms_application_sid": "",
_41
"sms_fallback_method": "POST",
_41
"sms_fallback_url": "",
_41
"sms_method": "POST",
_41
"sms_url": "",
_41
"status_callback": "",
_41
"status_callback_method": "POST",
_41
"trunk_sid": null,
_41
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_41
"voice_application_sid": "",
_41
"voice_caller_id_lookup": false,
_41
"voice_fallback_method": "POST",
_41
"voice_fallback_url": null,
_41
"voice_method": "POST",
_41
"voice_url": null,
_41
"voice_receive_mode": "voice",
_41
"status": "in-use",
_41
"bundle_sid": "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_41
}


Read multiple IncomingPhoneNumber resources

read-multiple-incomingphonenumber-resources page anchor
GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers.json

URI parameters
AccountSidtype: SID<AC>Not PII
Path Parameter

The SID of the Account(link takes you to an external page) that created the IncomingPhoneNumber resources to read.


Betatype: booleanNot PII
Query Parameter

Whether to include phone numbers new to the Twilio platform. Can be: true or false and the default is true.


FriendlyNametype: stringPII MTL: 30 days
Query Parameter

A string that identifies the IncomingPhoneNumber resources to read.


PhoneNumbertype: string<PHONE NUMBER>Not PII
Query Parameter

The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit.


Origintype: stringNot PII
Query Parameter

Whether to include phone numbers based on their origin. Can be: twilio or hosted. By default, phone numbers of all origin are included.


PageSizetype: integerNot PII
Query Parameter

How many resources to return in each list page. The default is 50, and the maximum is 1000.


Pagetype: integerNot PII
Query Parameter

The page index. This value is simply for client state.


PageTokentype: stringNot PII
Query Parameter

The page token. This is provided by the API.

List all IncomingPhoneNumber resources for your account

list-all-incomingphonenumber-resources-for-your-account page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.incomingPhoneNumbers
_10
.list({limit: 20})
_10
.then(incomingPhoneNumbers => incomingPhoneNumbers.forEach(i => console.log(i.sid)));

Output

_56
{
_56
"end": 0,
_56
"first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=0",
_56
"incoming_phone_numbers": [
_56
{
_56
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"address_requirements": "none",
_56
"address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"api_version": "2010-04-01",
_56
"beta": null,
_56
"capabilities": {
_56
"voice": true,
_56
"sms": false,
_56
"mms": true,
_56
"fax": false
_56
},
_56
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_56
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_56
"emergency_status": "Active",
_56
"emergency_address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"emergency_address_status": "registered",
_56
"friendly_name": "(808) 925-5327",
_56
"identity_sid": "RIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"origin": "origin",
_56
"phone_number": "+18089255327",
_56
"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"sms_application_sid": "",
_56
"sms_fallback_method": "POST",
_56
"sms_fallback_url": "",
_56
"sms_method": "POST",
_56
"sms_url": "",
_56
"status_callback": "",
_56
"status_callback_method": "POST",
_56
"trunk_sid": null,
_56
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_56
"voice_application_sid": "",
_56
"voice_caller_id_lookup": false,
_56
"voice_fallback_method": "POST",
_56
"voice_fallback_url": null,
_56
"voice_method": "POST",
_56
"voice_url": null,
_56
"bundle_sid": "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"voice_receive_mode": "voice",
_56
"status": "in-use",
_56
"subresource_uris": {
_56
"assigned_add_ons": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AssignedAddOns.json"
_56
}
_56
}
_56
],
_56
"next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=50",
_56
"page": 0,
_56
"page_size": 50,
_56
"previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=0",
_56
"start": 0,
_56
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=0"
_56
}

Filter IncomingPhoneNumbers with exact match

filter-incomingphonenumbers-with-exact-match page anchor

Return the set of phone numbers that match exactly (415) 867-5310

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.incomingPhoneNumbers
_10
.list({phoneNumber: '+14158675310', limit: 20})
_10
.then(incomingPhoneNumbers => incomingPhoneNumbers.forEach(i => console.log(i.sid)));

Output

_56
{
_56
"end": 0,
_56
"first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=0",
_56
"incoming_phone_numbers": [
_56
{
_56
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"address_requirements": "none",
_56
"address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"api_version": "2010-04-01",
_56
"beta": null,
_56
"capabilities": {
_56
"voice": true,
_56
"sms": false,
_56
"mms": true,
_56
"fax": false
_56
},
_56
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_56
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_56
"emergency_status": "Active",
_56
"emergency_address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"emergency_address_status": "registered",
_56
"friendly_name": "(808) 925-5327",
_56
"identity_sid": "RIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"origin": "origin",
_56
"phone_number": "+18089255327",
_56
"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"sms_application_sid": "",
_56
"sms_fallback_method": "POST",
_56
"sms_fallback_url": "",
_56
"sms_method": "POST",
_56
"sms_url": "",
_56
"status_callback": "",
_56
"status_callback_method": "POST",
_56
"trunk_sid": null,
_56
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_56
"voice_application_sid": "",
_56
"voice_caller_id_lookup": false,
_56
"voice_fallback_method": "POST",
_56
"voice_fallback_url": null,
_56
"voice_method": "POST",
_56
"voice_url": null,
_56
"bundle_sid": "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"voice_receive_mode": "voice",
_56
"status": "in-use",
_56
"subresource_uris": {
_56
"assigned_add_ons": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AssignedAddOns.json"
_56
}
_56
}
_56
],
_56
"next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=50",
_56
"page": 0,
_56
"page_size": 50,
_56
"previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=0",
_56
"start": 0,
_56
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=0"
_56
}

Filter IncomingPhoneNumbers with partial match

filter-incomingphonenumbers-with-partial-match page anchor

Return the set of all phone numbers containing the digits 867

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.incomingPhoneNumbers
_10
.list({phoneNumber: '867', limit: 20})
_10
.then(incomingPhoneNumbers => incomingPhoneNumbers.forEach(i => console.log(i.sid)));

Output

_56
{
_56
"end": 0,
_56
"first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=0",
_56
"incoming_phone_numbers": [
_56
{
_56
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"address_requirements": "none",
_56
"address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"api_version": "2010-04-01",
_56
"beta": null,
_56
"capabilities": {
_56
"voice": true,
_56
"sms": false,
_56
"mms": true,
_56
"fax": false
_56
},
_56
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_56
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_56
"emergency_status": "Active",
_56
"emergency_address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"emergency_address_status": "registered",
_56
"friendly_name": "(808) 925-5327",
_56
"identity_sid": "RIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"origin": "origin",
_56
"phone_number": "+18089255327",
_56
"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"sms_application_sid": "",
_56
"sms_fallback_method": "POST",
_56
"sms_fallback_url": "",
_56
"sms_method": "POST",
_56
"sms_url": "",
_56
"status_callback": "",
_56
"status_callback_method": "POST",
_56
"trunk_sid": null,
_56
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_56
"voice_application_sid": "",
_56
"voice_caller_id_lookup": false,
_56
"voice_fallback_method": "POST",
_56
"voice_fallback_url": null,
_56
"voice_method": "POST",
_56
"voice_url": null,
_56
"bundle_sid": "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_56
"voice_receive_mode": "voice",
_56
"status": "in-use",
_56
"subresource_uris": {
_56
"assigned_add_ons": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AssignedAddOns.json"
_56
}
_56
}
_56
],
_56
"next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=50",
_56
"page": 0,
_56
"page_size": 50,
_56
"previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=0",
_56
"start": 0,
_56
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=0"
_56
}


Update an IncomingPhoneNumber resource

update-an-incomingphonenumber-resource page anchor
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{Sid}.json

URI parameters
AccountSidtype: SID<AC>Not PII
Path Parameter

The SID of the Account(link takes you to an external page) that created the IncomingPhoneNumber resource to update. For more information, see Exchanging Numbers Between Subaccounts(link takes you to an external page).


Sidtype: SID<PN>Not PII
Path Parameter

The Twilio-provided string that uniquely identifies the IncomingPhoneNumber resource to update.


Request body parameters
AccountSidtype: SID<AC>Not PII

The SID of the Account(link takes you to an external page) that created the IncomingPhoneNumber resource to update. For more information, see Exchanging Numbers Between Subaccounts(link takes you to an external page).


ApiVersiontype: stringNot PII

The API version to use for incoming calls made to the phone number. The default is 2010-04-01.


FriendlyNametype: stringPII MTL: 30 days

A descriptive string that you created to describe this phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number.


SmsApplicationSidtype: SID<AP>Not PII

The SID of the application that should handle SMS messages sent to the number. If an sms_application_sid is present, we ignore all of the sms_*_url urls and use those set on the application.


SmsFallbackMethodtype: enum<HTTP METHOD>Not PII

The HTTP method that we should use to call sms_fallback_url. Can be: GET or POST and defaults to POST.

Possible values:
HEADGETPOSTPATCHPUTDELETE

SmsFallbackUrltype: string<URI>Not PII

The URL that we should call when an error occurs while requesting or executing the TwiML defined by sms_url.


SmsMethodtype: enum<HTTP METHOD>Not PII

The HTTP method that we should use to call sms_url. Can be: GET or POST and defaults to POST.

Possible values:
HEADGETPOSTPATCHPUTDELETE

SmsUrltype: string<URI>Not PII

The URL we should call when the phone number receives an incoming SMS message.


StatusCallbacktype: string<URI>Not PII

The URL we should call using the status_callback_method to send status information to your application.


StatusCallbackMethodtype: enum<HTTP METHOD>Not PII

The HTTP method we should use to call status_callback. Can be: GET or POST and defaults to POST.

Possible values:
HEADGETPOSTPATCHPUTDELETE

VoiceApplicationSidtype: SID<AP>Not PII

The SID of the application we should use to handle phone calls to the phone number. If a voice_application_sid is present, we ignore all of the voice urls and use only those set on the application. Setting a voice_application_sid will automatically delete your trunk_sid and vice versa.


VoiceCallerIdLookuptype: booleanNot PII

Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: true or false and defaults to false.


VoiceFallbackMethodtype: enum<HTTP METHOD>Not PII

The HTTP method that we should use to call voice_fallback_url. Can be: GET or POST and defaults to POST.

Possible values:
HEADGETPOSTPATCHPUTDELETE

VoiceFallbackUrltype: string<URI>Not PII

The URL that we should call when an error occurs retrieving or executing the TwiML requested by url.


VoiceMethodtype: enum<HTTP METHOD>Not PII

The HTTP method that we should use to call voice_url. Can be: GET or POST and defaults to POST.

Possible values:
HEADGETPOSTPATCHPUTDELETE

VoiceUrltype: string<URI>Not PII

The URL that we should call to answer a call to the phone number. The voice_url will not be called if a voice_application_sid or a trunk_sid is set.


EmergencyStatustype: enum<STRING>Not PII

The parameter displays if emergency calling is enabled for this number. Active numbers may place emergency calls by dialing valid emergency numbers for the country.

Possible values:
ActiveInactive

EmergencyAddressSidtype: SID<AD>Not PII

The SID of the emergency address configuration to use for emergency calling from this phone number.


TrunkSidtype: SID<TK>Not PII

The SID of the Trunk we should use to handle phone calls to the phone number. If a trunk_sid is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a trunk_sid will automatically delete your voice_application_sid and vice versa.


VoiceReceiveModetype: enum<STRING>Not PII

The configuration parameter for the phone number to receive incoming voice calls or faxes. Can be: fax or voice and defaults to voice.

Possible values:
voicefax

IdentitySidtype: SID<RI>Not PII

The SID of the Identity resource that we should associate with the phone number. Some regions require an identity to meet local regulations.


AddressSidtype: SID<AD>Not PII

The SID of the Address resource we should associate with the phone number. Some regions require addresses to meet local regulations.


BundleSidtype: SID<BU>Not PII

The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations.

Update IncomingPhoneNumber to include an AddressSid and an BundleSid

update-incomingphonenumber-to-include-an-addresssid-and-an-bundlesid page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_13
// Download the helper library from https://www.twilio.com/docs/node/install
_13
// Find your Account SID and Auth Token at twilio.com/console
_13
// and set the environment variables. See http://twil.io/secure
_13
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_13
const authToken = process.env.TWILIO_AUTH_TOKEN;
_13
const client = require('twilio')(accountSid, authToken);
_13
_13
client.incomingPhoneNumbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_13
.update({
_13
addressSid: 'ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
_13
bundleSid: 'BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
_13
})
_13
.then(incoming_phone_number => console.log(incoming_phone_number.friendlyName));

Output

_41
{
_41
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"address_requirements": "none",
_41
"address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"api_version": "2010-04-01",
_41
"beta": false,
_41
"capabilities": {
_41
"voice": true,
_41
"sms": false,
_41
"mms": true,
_41
"fax": false
_41
},
_41
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"emergency_status": "Inactive",
_41
"emergency_address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"emergency_address_status": "registered",
_41
"friendly_name": "(808) 925-5327",
_41
"identity_sid": "RIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"origin": "origin",
_41
"phone_number": "+18089255327",
_41
"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"sms_application_sid": "",
_41
"sms_fallback_method": "POST",
_41
"sms_fallback_url": "",
_41
"sms_method": "POST",
_41
"sms_url": "",
_41
"status_callback": "",
_41
"status_callback_method": "POST",
_41
"trunk_sid": null,
_41
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_41
"voice_application_sid": "",
_41
"voice_caller_id_lookup": true,
_41
"voice_fallback_method": "POST",
_41
"voice_fallback_url": null,
_41
"voice_method": "POST",
_41
"voice_url": null,
_41
"voice_receive_mode": "voice",
_41
"status": "in-use",
_41
"bundle_sid": "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_41
}

Update IncomingPhoneNumber to use a new Voice URL

update-incomingphonenumber-to-use-a-new-voice-url page anchor

Twilio will send a HTTP request to this URL when a call is received by your phone number

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.incomingPhoneNumbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.update({voiceUrl: 'https://www.your-new-voice-url.com/example'})
_10
.then(incoming_phone_number => console.log(incoming_phone_number.friendlyName));

Output

_41
{
_41
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"address_requirements": "none",
_41
"address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"api_version": "2010-04-01",
_41
"beta": false,
_41
"capabilities": {
_41
"voice": true,
_41
"sms": false,
_41
"mms": true,
_41
"fax": false
_41
},
_41
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"emergency_status": "Inactive",
_41
"emergency_address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"emergency_address_status": "registered",
_41
"friendly_name": "(808) 925-5327",
_41
"identity_sid": "RIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"origin": "origin",
_41
"phone_number": "+18089255327",
_41
"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"sms_application_sid": "",
_41
"sms_fallback_method": "POST",
_41
"sms_fallback_url": "",
_41
"sms_method": "POST",
_41
"sms_url": "",
_41
"status_callback": "",
_41
"status_callback_method": "POST",
_41
"trunk_sid": null,
_41
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_41
"voice_application_sid": "",
_41
"voice_caller_id_lookup": true,
_41
"voice_fallback_method": "POST",
_41
"voice_fallback_url": null,
_41
"voice_method": "POST",
_41
"voice_url": "https://www.your-new-voice-url.com/example",
_41
"voice_receive_mode": "voice",
_41
"status": "in-use",
_41
"bundle_sid": "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_41
}

Update IncomingPhoneNumber to use a new SMS URL

update-incomingphonenumber-to-use-a-new-sms-url page anchor

Twilio will send a HTTP request to this URL when an SMS is sent to your phone number

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.incomingPhoneNumbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.update({smsUrl: 'https://www.your-new-sms-url.com/example'})
_10
.then(incoming_phone_number => console.log(incoming_phone_number.friendlyName));

Output

_41
{
_41
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"address_requirements": "none",
_41
"address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"api_version": "2010-04-01",
_41
"beta": false,
_41
"capabilities": {
_41
"voice": true,
_41
"sms": false,
_41
"mms": true,
_41
"fax": false
_41
},
_41
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"emergency_status": "Inactive",
_41
"emergency_address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"emergency_address_status": "registered",
_41
"friendly_name": "(808) 925-5327",
_41
"identity_sid": "RIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"origin": "origin",
_41
"phone_number": "+18089255327",
_41
"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"sms_application_sid": "",
_41
"sms_fallback_method": "POST",
_41
"sms_fallback_url": "",
_41
"sms_method": "POST",
_41
"sms_url": "https://www.your-new-sms-url.com/example",
_41
"status_callback": "",
_41
"status_callback_method": "POST",
_41
"trunk_sid": null,
_41
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_41
"voice_application_sid": "",
_41
"voice_caller_id_lookup": true,
_41
"voice_fallback_method": "POST",
_41
"voice_fallback_url": null,
_41
"voice_method": "POST",
_41
"voice_url": null,
_41
"voice_receive_mode": "voice",
_41
"status": "in-use",
_41
"bundle_sid": "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_41
}


Delete an IncomingPhoneNumber resource

delete-an-incomingphonenumber-resource page anchor
DELETE https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{Sid}.json

Release this phone number from your account. Twilio will no longer answer calls to this number, and you will stop being billed the monthly phone number fee. The phone number will eventually be recycled and potentially given to another customer, so use with care. If you make a mistake, contact us. We may be able to give you the number back.

URI parameters
AccountSidtype: SID<AC>Not PII
Path Parameter

The SID of the Account(link takes you to an external page) that created the IncomingPhoneNumber resources to delete.


Sidtype: SID<PN>Not PII
Path Parameter

The Twilio-provided string that uniquely identifies the IncomingPhoneNumber resource to delete.

Delete an IncomingPhoneNumber

delete-an-incomingphonenumber page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.incomingPhoneNumbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove();


Rate this page: