Purchase a phone-number for the account
Incoming phone numbers on a Twilio account/project
Purchase a phone-number for the account.
Path parameters
-
The SID of the Account that will create the resource.
Body
-
AddressSid string
The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations.
Minimum length is
34
, maximum length is34
. Format should match the following pattern:^AD[0-9a-fA-F]{32}$
. -
ApiVersion string
The API version to use for incoming calls made to the new phone number. The default is
2010-04-01
. -
AreaCode string
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 aphone_number
. (US and Canada only). -
BundleSid string
The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations.
Minimum length is
34
, maximum length is34
. Format should match the following pattern:^BU[0-9a-fA-F]{32}$
. -
EmergencyAddressSid string
The SID of the emergency address configuration to use for emergency calling from the new phone number.
Minimum length is
34
, maximum length is34
. Format should match the following pattern:^AD[0-9a-fA-F]{32}$
. -
EmergencyStatus 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.
Values are
Active
orInactive
. -
FriendlyName string
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.
-
IdentitySid string
The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations.
Minimum length is
34
, maximum length is34
. Format should match the following pattern:^RI[0-9a-fA-F]{32}$
. -
PhoneNumber string(phone-number)
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.
-
SmsApplicationSid string
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 thesms_*_url
urls and use those set on the application.Minimum length is
34
, maximum length is34
. Format should match the following pattern:^AP[0-9a-fA-F]{32}$
. -
SmsFallbackMethod string(http-method)
The HTTP method that we should use to call
sms_fallback_url
. Can be:GET
orPOST
and defaults toPOST
.Values are
HEAD
,GET
,POST
,PATCH
,PUT
, orDELETE
. -
SmsFallbackUrl string(uri)
The URL that we should call when an error occurs while requesting or executing the TwiML defined by
sms_url
. -
SmsMethod string(http-method)
The HTTP method that we should use to call
sms_url
. Can be:GET
orPOST
and defaults toPOST
.Values are
HEAD
,GET
,POST
,PATCH
,PUT
, orDELETE
. -
SmsUrl string(uri)
The URL we should call when the new phone number receives an incoming SMS message.
-
StatusCallback string(uri)
The URL we should call using the
status_callback_method
to send status information to your application. -
StatusCallbackMethod string(http-method)
The HTTP method we should use to call
status_callback
. Can be:GET
orPOST
and defaults toPOST
.Values are
HEAD
,GET
,POST
,PATCH
,PUT
, orDELETE
. -
TrunkSid string
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 atrunk_sid
will automatically delete yourvoice_application_sid
and vice versa.Minimum length is
34
, maximum length is34
. Format should match the following pattern:^TK[0-9a-fA-F]{32}$
. -
VoiceApplicationSid string
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 avoice_application_sid
will automatically delete yourtrunk_sid
and vice versa.Minimum length is
34
, maximum length is34
. Format should match the following pattern:^AP[0-9a-fA-F]{32}$
. -
VoiceCallerIdLookup boolean
Whether to lookup the caller's name from the CNAM database and post it to your app. Can be:
true
orfalse
and defaults tofalse
. -
VoiceFallbackMethod string(http-method)
The HTTP method that we should use to call
voice_fallback_url
. Can be:GET
orPOST
and defaults toPOST
.Values are
HEAD
,GET
,POST
,PATCH
,PUT
, orDELETE
. -
VoiceFallbackUrl string(uri)
The URL that we should call when an error occurs retrieving or executing the TwiML requested by
url
. -
VoiceMethod string(http-method)
The HTTP method that we should use to call
voice_url
. Can be:GET
orPOST
and defaults toPOST
.Values are
HEAD
,GET
,POST
,PATCH
,PUT
, orDELETE
. -
VoiceReceiveMode string
The configuration parameter for the new phone number to receive incoming voice calls or faxes. Can be:
fax
orvoice
and defaults tovoice
.Values are
voice
orfax
. -
VoiceUrl string(uri)
The URL that we should call to answer a call to the new phone number. The
voice_url
will not be called if avoice_application_sid
or atrunk_sid
is set.
curl \
-X POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers.json \
--user "username:password" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d 'AddressSid=string&ApiVersion=string&AreaCode=string&BundleSid=string&EmergencyAddressSid=string&EmergencyStatus=Active&FriendlyName=string&IdentitySid=string&PhoneNumber=string&SmsApplicationSid=string&SmsFallbackMethod=HEAD&SmsFallbackUrl=https%3A%2F%2Fexample.com&SmsMethod=HEAD&SmsUrl=https%3A%2F%2Fexample.com&StatusCallback=https%3A%2F%2Fexample.com&StatusCallbackMethod=HEAD&TrunkSid=string&VoiceApplicationSid=string&VoiceCallerIdLookup=true&VoiceFallbackMethod=HEAD&VoiceFallbackUrl=https%3A%2F%2Fexample.com&VoiceMethod=HEAD&VoiceReceiveMode=voice&VoiceUrl=https%3A%2F%2Fexample.com'
{
"AddressSid": "string",
"ApiVersion": "string",
"AreaCode": "string",
"BundleSid": "string",
"EmergencyAddressSid": "string",
"EmergencyStatus": "Active",
"FriendlyName": "string",
"IdentitySid": "string",
"PhoneNumber": "string",
"SmsApplicationSid": "string",
"SmsFallbackMethod": "HEAD",
"SmsFallbackUrl": "https://example.com",
"SmsMethod": "HEAD",
"SmsUrl": "https://example.com",
"StatusCallback": "https://example.com",
"StatusCallbackMethod": "HEAD",
"TrunkSid": "string",
"VoiceApplicationSid": "string",
"VoiceCallerIdLookup": true,
"VoiceFallbackMethod": "HEAD",
"VoiceFallbackUrl": "https://example.com",
"VoiceMethod": "HEAD",
"VoiceReceiveMode": "voice",
"VoiceUrl": "https://example.com"
}
{
"AddressSid": "string",
"ApiVersion": "string",
"AreaCode": "string",
"BundleSid": "string",
"EmergencyAddressSid": "string",
"EmergencyStatus": "Active",
"FriendlyName": "string",
"IdentitySid": "string",
"PhoneNumber": "string",
"SmsApplicationSid": "string",
"SmsFallbackMethod": "HEAD",
"SmsFallbackUrl": "https://example.com",
"SmsMethod": "HEAD",
"SmsUrl": "https://example.com",
"StatusCallback": "https://example.com",
"StatusCallbackMethod": "HEAD",
"TrunkSid": "string",
"VoiceApplicationSid": "string",
"VoiceCallerIdLookup": true,
"VoiceFallbackMethod": "HEAD",
"VoiceFallbackUrl": "https://example.com",
"VoiceMethod": "HEAD",
"VoiceReceiveMode": "voice",
"VoiceUrl": "https://example.com"
}
{
"account_sid": "string",
"address_requirements": "none",
"address_sid": "string",
"api_version": "string",
"beta": true,
"bundle_sid": "string",
"capabilities": {
"fax": true,
"mms": true,
"sms": true,
"voice": true
},
"date_created": "string",
"date_updated": "string",
"emergency_address_sid": "string",
"emergency_address_status": "registered",
"emergency_status": "Active",
"friendly_name": "string",
"identity_sid": "string",
"origin": "string",
"phone_number": "string",
"sid": "string",
"sms_application_sid": "string",
"sms_fallback_method": "HEAD",
"sms_fallback_url": "https://example.com",
"sms_method": "HEAD",
"sms_url": "https://example.com",
"status": "string",
"status_callback": "https://example.com",
"status_callback_method": "HEAD",
"trunk_sid": "string",
"uri": "https://example.com",
"voice_application_sid": "string",
"voice_caller_id_lookup": true,
"voice_fallback_method": "HEAD",
"voice_fallback_url": "https://example.com",
"voice_method": "HEAD",
"voice_receive_mode": "voice",
"voice_url": "https://example.com"
}
{
"account_sid": "string",
"address_requirements": "none",
"address_sid": "string",
"api_version": "string",
"beta": true,
"bundle_sid": "string",
"capabilities": {
"fax": true,
"mms": true,
"sms": true,
"voice": true
},
"date_created": "string",
"date_updated": "string",
"emergency_address_sid": "string",
"emergency_address_status": "registered",
"emergency_status": "Active",
"friendly_name": "string",
"identity_sid": "string",
"origin": "string",
"phone_number": "string",
"sid": "string",
"sms_application_sid": "string",
"sms_fallback_method": "HEAD",
"sms_fallback_url": "https://example.com",
"sms_method": "HEAD",
"sms_url": "https://example.com",
"status": "string",
"status_callback": "https://example.com",
"status_callback_method": "HEAD",
"trunk_sid": "string",
"uri": "https://example.com",
"voice_application_sid": "string",
"voice_caller_id_lookup": true,
"voice_fallback_method": "HEAD",
"voice_fallback_url": "https://example.com",
"voice_method": "HEAD",
"voice_receive_mode": "voice",
"voice_url": "https://example.com"
}