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.
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.
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
Resource Properties in REST API format | |
---|---|
account_sid
|
The SID of the Account that created this IncomingPhoneNumber resource. |
address_sid
|
The SID of the Address resource associated with the phone number. |
address_requirements
|
Whether the phone number requires an Address registered with Twilio. Can be: |
api_version
|
The API version used to start a new TwiML session. |
beta
|
Whether the phone number is new to the Twilio platform. Can be: |
capabilities
|
The set of Boolean properties that indicate whether a phone number can receive calls or messages. Capabilities are |
date_created
|
The date and time in GMT that the resource was created specified in RFC 2822 format. |
date_updated
|
The date and time in GMT that the resource was last updated specified in RFC 2822 format. |
friendly_name
|
The string that you assigned to describe the resource. |
identity_sid
|
The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. |
phone_number
|
The phone number in E.164 format, which consists of a + followed by the country code and subscriber number. |
origin
|
The phone number's origin. |
sid
|
The unique string that that we created to identify this IncomingPhoneNumber resource. |
sms_application_sid
|
The SID of the application that handles SMS messages sent to the phone number. If an |
sms_fallback_method
|
The HTTP method we use to call |
sms_fallback_url
|
The URL that we call when an error occurs while retrieving or executing the TwiML from |
sms_method
|
The HTTP method we use to call |
sms_url
|
The URL we call when the phone number receives an incoming SMS message. |
status_callback
|
The URL we call using the |
status_callback_method
|
The HTTP method we use to call |
trunk_sid
|
The SID of the Trunk that handles calls to the phone number. If a |
uri
|
The URI of the resource, relative to |
voice_receive_mode
|
|
voice_application_sid
|
The SID of the application that handles calls to the phone number. If a |
voice_caller_id_lookup
|
Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: |
voice_fallback_method
|
The HTTP method we use to call |
voice_fallback_url
|
The URL that we call when an error occurs retrieving or executing the TwiML requested by |
voice_method
|
The HTTP method we use to call |
voice_url
|
The URL we call when the phone number receives a call. The |
emergency_status
|
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. |
emergency_address_sid
|
The SID of the emergency address configuration that we use for emergency calling from this phone number. |
emergency_address_status
|
The status of address registration with emergency services. A registered emergency address will be used during handling of emergency calls from this number. |
bundle_sid
|
The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. |
status
|
|
Create an IncomingPhoneNumber resource
https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers.json
Parameters
Parameters in REST API format | |
---|---|
account_sid
Path
|
The SID of the Account that will create the resource. |
api_version
Optional
|
The API version to use for incoming calls made to the new phone number. The default is |
friendly_name
Optional
|
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. |
sms_application_sid
Optional
|
The SID of the application that should handle SMS messages sent to the new phone number. If an |
sms_fallback_method
Optional
|
The HTTP method that we should use to call |
sms_fallback_url
Optional
|
The URL that we should call when an error occurs while requesting or executing the TwiML defined by |
sms_method
Optional
|
The HTTP method that we should use to call |
sms_url
Optional
|
The URL we should call when the new phone number receives an incoming SMS message. |
status_callback
Optional
|
The URL we should call using the |
status_callback_method
Optional
|
The HTTP method we should use to call |
voice_application_sid
Optional
|
The SID of the application we should use to handle calls to the new phone number. If a |
voice_caller_id_lookup
Optional
|
Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: |
voice_fallback_method
Optional
|
The HTTP method that we should use to call |
voice_fallback_url
Optional
|
The URL that we should call when an error occurs retrieving or executing the TwiML requested by |
voice_method
Optional
|
The HTTP method that we should use to call |
voice_url
Optional
|
The URL that we should call to answer a call to the new phone number. The |
emergency_status
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. |
emergency_address_sid
Optional
|
The SID of the emergency address configuration to use for emergency calling from the new phone number. |
trunk_sid
Optional
|
The SID of the Trunk we should use to handle calls to the new phone number. If a |
identity_sid
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. |
address_sid
Optional
|
The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. |
voice_receive_mode
Optional
|
The configuration parameter for the new phone number to receive incoming voice calls or faxes. Can be: |
bundle_sid
Optional
|
The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. |
phone_number
Required if
area_code
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. |
area_code
Required if
phone_number
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 |
Example 1
Example 2
Example 3
Example 4
Fetch an IncomingPhoneNumber resource
https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{Sid}.json
Parameters
Parameters in REST API format | |
---|---|
account_sid
Path
|
The SID of the Account that created the IncomingPhoneNumber resource to fetch. |
sid
Path
|
The Twilio-provided string that uniquely identifies the IncomingPhoneNumber resource to fetch. |
Example 1
Read multiple IncomingPhoneNumber resources
https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers.json
Parameters
Parameters in REST API format | |
---|---|
account_sid
Path
|
The SID of the Account that created the IncomingPhoneNumber resources to read. |
beta
Optional
|
Whether to include phone numbers new to the Twilio platform. Can be: |
friendly_name
Optional
|
A string that identifies the IncomingPhoneNumber resources to read. |
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. |
origin
Optional
|
Whether to include phone numbers based on their origin. Can be: |
Example 1
Example 2
Example 3
Update an IncomingPhoneNumber resource
https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{Sid}.json
Parameters
Parameters in REST API format | |
---|---|
account_sid
Optional
|
The SID of the Account that created the IncomingPhoneNumber resource to update. For more information, see Exchanging Numbers Between Subaccounts. |
sid
Path
|
The Twilio-provided string that uniquely identifies the IncomingPhoneNumber resource to update. |
api_version
Optional
|
The API version to use for incoming calls made to the phone number. The default is |
friendly_name
Optional
|
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. |
sms_application_sid
Optional
|
The SID of the application that should handle SMS messages sent to the number. If an |
sms_fallback_method
Optional
|
The HTTP method that we should use to call |
sms_fallback_url
Optional
|
The URL that we should call when an error occurs while requesting or executing the TwiML defined by |
sms_method
Optional
|
The HTTP method that we should use to call |
sms_url
Optional
|
The URL we should call when the phone number receives an incoming SMS message. |
status_callback
Optional
|
The URL we should call using the |
status_callback_method
Optional
|
The HTTP method we should use to call |
voice_application_sid
Optional
|
The SID of the application we should use to handle phone calls to the phone number. If a |
voice_caller_id_lookup
Optional
|
Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: |
voice_fallback_method
Optional
|
The HTTP method that we should use to call |
voice_fallback_url
Optional
|
The URL that we should call when an error occurs retrieving or executing the TwiML requested by |
voice_method
Optional
|
The HTTP method that we should use to call |
voice_url
Optional
|
The URL that we should call to answer a call to the phone number. The |
emergency_status
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. |
emergency_address_sid
Optional
|
The SID of the emergency address configuration to use for emergency calling from this phone number. |
trunk_sid
Optional
|
The SID of the Trunk we should use to handle phone calls to the phone number. If a |
voice_receive_mode
Optional
|
The configuration parameter for the phone number to receive incoming voice calls or faxes. Can be: |
identity_sid
Optional
|
The SID of the Identity resource that we should associate with the phone number. Some regions require an identity to meet local regulations. |
address_sid
Optional
|
The SID of the Address resource we should associate with the phone number. Some regions require addresses to meet local regulations. |
bundle_sid
Optional
|
The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. |
Example 1
Example 2
Example 3
Delete an IncomingPhoneNumber resource
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.
Parameters
Parameters in REST API format | |
---|---|
account_sid
Path
|
The SID of the Account that created the IncomingPhoneNumber resources to delete. |
sid
Path
|
The Twilio-provided string that uniquely identifies the IncomingPhoneNumber resource to delete. |
Example 1
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.