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
Property nameTypePIIDescription
account_sidSID<AC>
Not PII

The SID of the Account that created this IncomingPhoneNumber resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

address_sidSID<AD>

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

Pattern: ^AD[0-9a-fA-F]{32}$Min length: 34Max length: 34

address_requirementsenum<string>

Whether the phone number requires an Address registered with Twilio. Can be: none, any, local, or foreign.

Possible values:
noneanylocalforeign

api_versionstring

The API version used to start a new TwiML session.


betaboolean

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


capabilitiesobject<phone-number-capabilities>

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_updatedstring<date-time-rfc-2822>

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_namestring
PII MTL: 30 days

The string that you assigned to describe the resource.


identity_sidSID<RI>

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

Pattern: ^RI[0-9a-fA-F]{32}$Min length: 34Max length: 34

phone_numberstring<phone-number>

The phone number in E.164 format, which consists of a + followed by the country code and subscriber number.


originstring

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


sidSID<PN>

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

Pattern: ^PN[0-9a-fA-F]{32}$Min length: 34Max length: 34

sms_application_sidSID<AP>

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.

Pattern: ^AP[0-9a-fA-F]{32}$Min length: 34Max length: 34

sms_fallback_methodenum<http-method>

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

Possible values:
GETPOST

sms_fallback_urlstring<uri>

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


sms_methodenum<http-method>

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

Possible values:
GETPOST

sms_urlstring<uri>

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


status_callbackstring<uri>

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


status_callback_methodenum<http-method>

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

Possible values:
GETPOST

trunk_sidSID<TK>

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.

Pattern: ^TK[0-9a-fA-F]{32}$Min length: 34Max length: 34

uristring

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


voice_receive_modeenum<string>
Possible values:
voicefax

voice_application_sidSID<AP>

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.

Pattern: ^AP[0-9a-fA-F]{32}$Min length: 34Max length: 34

voice_caller_id_lookupboolean

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_methodenum<http-method>

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

Possible values:
GETPOST

voice_fallback_urlstring<uri>

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


voice_methodenum<http-method>

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

Possible values:
GETPOST

voice_urlstring<uri>

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_statusenum<string>

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_sidSID<AD>

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

Pattern: ^AD[0-9a-fA-F]{32}$Min length: 34Max length: 34

emergency_address_statusenum<string>

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_sidSID<BU>

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

Pattern: ^BU[0-9a-fA-F]{32}$Min length: 34Max length: 34

statusstring

Create an IncomingPhoneNumber resource

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

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that will create the resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34
Property nameTypeRequiredPIIDescription
ApiVersionstringOptional

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


FriendlyNamestringOptional

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.


SmsApplicationSidSID<AP>Optional

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.

Pattern: ^AP[0-9a-fA-F]{32}$Min length: 34Max length: 34

SmsFallbackMethodenum<http-method>Optional

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

Possible values:
GETPOST

SmsFallbackUrlstring<uri>Optional

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


SmsMethodenum<http-method>Optional

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

Possible values:
GETPOST

SmsUrlstring<uri>Optional

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


StatusCallbackstring<uri>Optional

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


StatusCallbackMethodenum<http-method>Optional

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

Possible values:
GETPOST

VoiceApplicationSidSID<AP>Optional

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.

Pattern: ^AP[0-9a-fA-F]{32}$Min length: 34Max length: 34

VoiceCallerIdLookupbooleanOptional

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.


VoiceFallbackMethodenum<http-method>Optional

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

Possible values:
GETPOST

VoiceFallbackUrlstring<uri>Optional

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


VoiceMethodenum<http-method>Optional

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

Possible values:
GETPOST

VoiceUrlstring<uri>Optional

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.


EmergencyStatusenum<string>Optional

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

EmergencyAddressSidSID<AD>Optional

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

Pattern: ^AD[0-9a-fA-F]{32}$Min length: 34Max length: 34

TrunkSidSID<TK>Optional

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.

Pattern: ^TK[0-9a-fA-F]{32}$Min length: 34Max length: 34

IdentitySidSID<RI>Optional

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

Pattern: ^RI[0-9a-fA-F]{32}$Min length: 34Max length: 34

AddressSidSID<AD>Optional

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

Pattern: ^AD[0-9a-fA-F]{32}$Min length: 34Max length: 34

VoiceReceiveModeenum<string>Optional

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

BundleSidSID<BU>Optional

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

Pattern: ^BU[0-9a-fA-F]{32}$Min length: 34Max length: 34

PhoneNumberstring<phone-number>required if AreaCode is not passed

The phone number to purchase specified in E.164 format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234.


AreaCodestringrequired 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

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function createIncomingPhoneNumber() {
_18
const incomingPhoneNumber = await client.incomingPhoneNumbers.create({
_18
phoneNumber: "+14155552344",
_18
});
_18
_18
console.log(incomingPhoneNumber.accountSid);
_18
}
_18
_18
createIncomingPhoneNumber();

Output

_44
{
_44
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"address_requirements": "none",
_44
"address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"api_version": "2010-04-01",
_44
"beta": false,
_44
"capabilities": {
_44
"voice": true,
_44
"sms": false,
_44
"mms": true,
_44
"fax": false
_44
},
_44
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_44
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_44
"emergency_status": "Active",
_44
"emergency_address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"emergency_address_status": "registered",
_44
"friendly_name": "friendly_name",
_44
"identity_sid": "RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"origin": "origin",
_44
"phone_number": "+14155552344",
_44
"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"sms_application_sid": "APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"sms_fallback_method": "GET",
_44
"sms_fallback_url": "https://example.com",
_44
"sms_method": "GET",
_44
"sms_url": "https://example.com",
_44
"status_callback": "https://example.com",
_44
"status_callback_method": "GET",
_44
"trunk_sid": null,
_44
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
_44
"voice_application_sid": "APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"voice_caller_id_lookup": false,
_44
"voice_fallback_method": "GET",
_44
"voice_fallback_url": "https://example.com",
_44
"voice_method": "GET",
_44
"voice_url": "https://example.com",
_44
"bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"voice_receive_mode": "voice",
_44
"status": "in-use",
_44
"subresource_uris": {
_44
"assigned_add_ons": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AssignedAddOns.json"
_44
}
_44
}

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

_20
// Download the helper library from https://www.twilio.com/docs/node/install
_20
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_20
_20
// Find your Account SID and Auth Token at twilio.com/console
_20
// and set the environment variables. See http://twil.io/secure
_20
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_20
const authToken = process.env.TWILIO_AUTH_TOKEN;
_20
const client = twilio(accountSid, authToken);
_20
_20
async function createIncomingPhoneNumber() {
_20
const incomingPhoneNumber = await client.incomingPhoneNumbers.create({
_20
addressSid: "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_20
bundleSid: "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_20
phoneNumber: "+14155552344",
_20
});
_20
_20
console.log(incomingPhoneNumber.accountSid);
_20
}
_20
_20
createIncomingPhoneNumber();

Output

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

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

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function createIncomingPhoneNumber() {
_19
const incomingPhoneNumber = await client.incomingPhoneNumbers.create({
_19
phoneNumber: "+14155552344",
_19
voiceUrl: "https://www.your-voice-url.com/example",
_19
});
_19
_19
console.log(incomingPhoneNumber.accountSid);
_19
}
_19
_19
createIncomingPhoneNumber();

Output

_44
{
_44
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"address_requirements": "none",
_44
"address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"api_version": "2010-04-01",
_44
"beta": false,
_44
"capabilities": {
_44
"voice": true,
_44
"sms": false,
_44
"mms": true,
_44
"fax": false
_44
},
_44
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_44
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_44
"emergency_status": "Active",
_44
"emergency_address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"emergency_address_status": "registered",
_44
"friendly_name": "friendly_name",
_44
"identity_sid": "RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"origin": "origin",
_44
"phone_number": "+14155552344",
_44
"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"sms_application_sid": "APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"sms_fallback_method": "GET",
_44
"sms_fallback_url": "https://example.com",
_44
"sms_method": "GET",
_44
"sms_url": "https://example.com",
_44
"status_callback": "https://example.com",
_44
"status_callback_method": "GET",
_44
"trunk_sid": null,
_44
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
_44
"voice_application_sid": "APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"voice_caller_id_lookup": false,
_44
"voice_fallback_method": "GET",
_44
"voice_fallback_url": "https://example.com",
_44
"voice_method": "GET",
_44
"voice_url": "https://www.your-voice-url.com/example",
_44
"bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"voice_receive_mode": "voice",
_44
"status": "in-use",
_44
"subresource_uris": {
_44
"assigned_add_ons": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AssignedAddOns.json"
_44
}
_44
}

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

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function createIncomingPhoneNumber() {
_19
const incomingPhoneNumber = await client.incomingPhoneNumbers.create({
_19
phoneNumber: "+14155552344",
_19
smsUrl: "https://www.your-sms-url.com/example",
_19
});
_19
_19
console.log(incomingPhoneNumber.accountSid);
_19
}
_19
_19
createIncomingPhoneNumber();

Output

_44
{
_44
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"address_requirements": "none",
_44
"address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"api_version": "2010-04-01",
_44
"beta": false,
_44
"capabilities": {
_44
"voice": true,
_44
"sms": false,
_44
"mms": true,
_44
"fax": false
_44
},
_44
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_44
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_44
"emergency_status": "Active",
_44
"emergency_address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"emergency_address_status": "registered",
_44
"friendly_name": "friendly_name",
_44
"identity_sid": "RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"origin": "origin",
_44
"phone_number": "+14155552344",
_44
"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"sms_application_sid": "APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"sms_fallback_method": "GET",
_44
"sms_fallback_url": "https://example.com",
_44
"sms_method": "GET",
_44
"sms_url": "https://www.your-sms-url.com/example",
_44
"status_callback": "https://example.com",
_44
"status_callback_method": "GET",
_44
"trunk_sid": null,
_44
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
_44
"voice_application_sid": "APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"voice_caller_id_lookup": false,
_44
"voice_fallback_method": "GET",
_44
"voice_fallback_url": "https://example.com",
_44
"voice_method": "GET",
_44
"voice_url": "https://example.com",
_44
"bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44
"voice_receive_mode": "voice",
_44
"status": "in-use",
_44
"subresource_uris": {
_44
"assigned_add_ons": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AssignedAddOns.json"
_44
}
_44
}


Fetch an IncomingPhoneNumber resource

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

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that created the IncomingPhoneNumber resource to fetch.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

SidSID<PN>required

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

Pattern: ^PN[0-9a-fA-F]{32}$Min length: 34Max length: 34

Fetch an IncomingPhoneNumber

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

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function fetchIncomingPhoneNumber() {
_18
const incomingPhoneNumber = await client
_18
.incomingPhoneNumbers("PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.fetch();
_18
_18
console.log(incomingPhoneNumber.accountSid);
_18
}
_18
_18
fetchIncomingPhoneNumber();

Output

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


Read multiple IncomingPhoneNumber resources

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

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that created the IncomingPhoneNumber resources to read.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34
Property nameTypeRequiredPIIDescription
BetabooleanOptional

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


FriendlyNamestringOptional

A string that identifies the IncomingPhoneNumber resources to read.


PhoneNumberstring<phone-number>Optional

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


OriginstringOptional

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


PageSizeintegerOptional

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

Minimum: 1Maximum: 1000

PageintegerOptional

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

Minimum: 0

PageTokenstringOptional

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

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

Output

_56
{
_56
"end": 0,
_56
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=0",
_56
"incoming_phone_numbers": [
_56
{
_56
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"address_requirements": "none",
_56
"address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"emergency_address_status": "registered",
_56
"friendly_name": "(808) 925-5327",
_56
"identity_sid": "RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"origin": "origin",
_56
"phone_number": "+18089255327",
_56
"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.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": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"voice_receive_mode": "voice",
_56
"status": "in-use",
_56
"subresource_uris": {
_56
"assigned_add_ons": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AssignedAddOns.json"
_56
}
_56
}
_56
],
_56
"next_page_uri": null,
_56
"page": 0,
_56
"page_size": 50,
_56
"previous_page_uri": null,
_56
"start": 0,
_56
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/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

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

Output

_56
{
_56
"end": 0,
_56
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=0",
_56
"incoming_phone_numbers": [
_56
{
_56
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"address_requirements": "none",
_56
"address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"emergency_address_status": "registered",
_56
"friendly_name": "(808) 925-5327",
_56
"identity_sid": "RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"origin": "origin",
_56
"phone_number": "+18089255327",
_56
"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.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": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"voice_receive_mode": "voice",
_56
"status": "in-use",
_56
"subresource_uris": {
_56
"assigned_add_ons": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AssignedAddOns.json"
_56
}
_56
}
_56
],
_56
"next_page_uri": null,
_56
"page": 0,
_56
"page_size": 50,
_56
"previous_page_uri": null,
_56
"start": 0,
_56
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/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

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

Output

_56
{
_56
"end": 0,
_56
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=0",
_56
"incoming_phone_numbers": [
_56
{
_56
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"address_requirements": "none",
_56
"address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"emergency_address_status": "registered",
_56
"friendly_name": "(808) 925-5327",
_56
"identity_sid": "RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"origin": "origin",
_56
"phone_number": "+18089255327",
_56
"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.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": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_56
"voice_receive_mode": "voice",
_56
"status": "in-use",
_56
"subresource_uris": {
_56
"assigned_add_ons": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AssignedAddOns.json"
_56
}
_56
}
_56
],
_56
"next_page_uri": null,
_56
"page": 0,
_56
"page_size": 50,
_56
"previous_page_uri": null,
_56
"start": 0,
_56
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/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

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that created the IncomingPhoneNumber resource to update. For more information, see Exchanging Numbers Between Subaccounts.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

SidSID<PN>required

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

Pattern: ^PN[0-9a-fA-F]{32}$Min length: 34Max length: 34
Property nameTypeRequiredPIIDescription
AccountSidSID<AC>Optional

The SID of the Account that created the IncomingPhoneNumber resource to update. For more information, see Exchanging Numbers Between Subaccounts.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

ApiVersionstringOptional

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


FriendlyNamestringOptional

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.


SmsApplicationSidSID<AP>Optional

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.

Pattern: ^AP[0-9a-fA-F]{32}$Min length: 34Max length: 34

SmsFallbackMethodenum<http-method>Optional

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

Possible values:
GETPOST

SmsFallbackUrlstring<uri>Optional

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


SmsMethodenum<http-method>Optional

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

Possible values:
GETPOST

SmsUrlstring<uri>Optional

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


StatusCallbackstring<uri>Optional

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


StatusCallbackMethodenum<http-method>Optional

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

Possible values:
GETPOST

VoiceApplicationSidSID<AP>Optional

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.

Pattern: ^AP[0-9a-fA-F]{32}$Min length: 34Max length: 34

VoiceCallerIdLookupbooleanOptional

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.


VoiceFallbackMethodenum<http-method>Optional

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

Possible values:
GETPOST

VoiceFallbackUrlstring<uri>Optional

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


VoiceMethodenum<http-method>Optional

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

Possible values:
GETPOST

VoiceUrlstring<uri>Optional

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.


EmergencyStatusenum<string>Optional

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

EmergencyAddressSidSID<AD>Optional

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

Pattern: ^AD[0-9a-fA-F]{32}$Min length: 34Max length: 34

TrunkSidSID<TK>Optional

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.

Pattern: ^TK[0-9a-fA-F]{32}$Min length: 34Max length: 34

VoiceReceiveModeenum<string>Optional

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

IdentitySidSID<RI>Optional

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

Pattern: ^RI[0-9a-fA-F]{32}$Min length: 34Max length: 34

AddressSidSID<AD>Optional

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

Pattern: ^AD[0-9a-fA-F]{32}$Min length: 34Max length: 34

BundleSidSID<BU>Optional

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

Pattern: ^BU[0-9a-fA-F]{32}$Min length: 34Max length: 34

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

_21
// Download the helper library from https://www.twilio.com/docs/node/install
_21
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_21
_21
// Find your Account SID and Auth Token at twilio.com/console
_21
// and set the environment variables. See http://twil.io/secure
_21
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_21
const authToken = process.env.TWILIO_AUTH_TOKEN;
_21
const client = twilio(accountSid, authToken);
_21
_21
async function updateIncomingPhoneNumber() {
_21
const incomingPhoneNumber = await client
_21
.incomingPhoneNumbers("PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_21
.update({
_21
addressSid: "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_21
bundleSid: "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_21
});
_21
_21
console.log(incomingPhoneNumber.accountSid);
_21
}
_21
_21
updateIncomingPhoneNumber();

Output

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

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

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function updateIncomingPhoneNumber() {
_18
const incomingPhoneNumber = await client
_18
.incomingPhoneNumbers("PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.update({ voiceUrl: "https://www.your-new-voice-url.com/example" });
_18
_18
console.log(incomingPhoneNumber.accountSid);
_18
}
_18
_18
updateIncomingPhoneNumber();

Output

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

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

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function updateIncomingPhoneNumber() {
_18
const incomingPhoneNumber = await client
_18
.incomingPhoneNumbers("PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.update({ smsUrl: "https://www.your-new-sms-url.com/example" });
_18
_18
console.log(incomingPhoneNumber.accountSid);
_18
}
_18
_18
updateIncomingPhoneNumber();

Output

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


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.

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that created the IncomingPhoneNumber resources to delete.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

SidSID<PN>required

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

Pattern: ^PN[0-9a-fA-F]{32}$Min length: 34Max length: 34

Delete an IncomingPhoneNumber

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

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_16
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = twilio(accountSid, authToken);
_16
_16
async function deleteIncomingPhoneNumber() {
_16
await client
_16
.incomingPhoneNumbers("PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_16
.remove();
_16
}
_16
_16
deleteIncomingPhoneNumber();


Rate this page: