Create incoming phone number toll free
Incoming toll free phone numbers on a Twilio account/project
Path parameters
-
The SID of the Account that will create the resource.
Minimum length is
34
, maximum length is34
. Format should match the following pattern:^AC[0-9a-fA-F]{32}$
.
Body
-
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.
-
The API version to use for incoming calls made to the new phone number. The default is
2010-04-01
. -
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 phone number.
-
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 allsms_*_url
values and use those of the application.Minimum length is
34
, maximum length is34
. Format should match the following pattern:^AP[0-9a-fA-F]{32}$
. -
The HTTP method that we should use to call
sms_fallback_url
. Can be:GET
orPOST
and defaults toPOST
.Values are
GET
orPOST
. -
The URL that we should call when an error occurs while requesting or executing the TwiML defined by
sms_url
. -
The HTTP method that we should use to call
sms_url
. Can be:GET
orPOST
and defaults toPOST
.Values are
GET
orPOST
. -
The URL we should call when the new phone number receives an incoming SMS message.
-
The URL we should call using the
status_callback_method
to send status information to your application. -
The HTTP method we should use to call
status_callback
. Can be:GET
orPOST
and defaults toPOST
.Values are
GET
orPOST
. -
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 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}$
. -
Whether to lookup the caller's name from the CNAM database and post it to your app. Can be:
true
orfalse
and defaults tofalse
. -
The HTTP method that we should use to call
voice_fallback_url
. Can be:GET
orPOST
and defaults toPOST
.Values are
GET
orPOST
. -
The URL that we should call when an error occurs retrieving or executing the TwiML requested by
url
. -
The HTTP method that we should use to call
voice_url
. Can be:GET
orPOST
and defaults toPOST
.Values are
GET
orPOST
. -
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. -
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}$
. -
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}$
. -
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
. -
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}$
. -
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}$
. -
Values are
voice
orfax
. -
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}$
.
curl \
--request POST 'https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/TollFree.json' \
--user "username:password" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data 'SmsUrl=https%3A%2F%2Fexample.com&VoiceUrl=https%3A%2F%2Fexample.com&BundleSid=BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&SmsMethod=GET&AddressSid=ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&ApiVersion=api_version&IdentitySid=RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PhoneNumber=%2B18089255327&VoiceMethod=GET&FriendlyName=friendly_name&SmsFallbackUrl=https%3A%2F%2Fexample.com&StatusCallback=https%3A%2F%2Fexample.com&EmergencyStatus=Active&VoiceFallbackUrl=https%3A%2F%2Fexample.com&SmsApplicationSid=APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&SmsFallbackMethod=GET&EmergencyAddressSid=ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&VoiceApplicationSid=APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&VoiceCallerIdLookup=true&VoiceFallbackMethod=GET&StatusCallbackMethod=GET'
{"SmsUrl"=>"https://example.com", "VoiceUrl"=>"https://example.com", "BundleSid"=>"BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "SmsMethod"=>"GET", "AddressSid"=>"ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "ApiVersion"=>"api_version", "IdentitySid"=>"RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "PhoneNumber"=>"+18089255327", "VoiceMethod"=>"GET", "FriendlyName"=>"friendly_name", "SmsFallbackUrl"=>"https://example.com", "StatusCallback"=>"https://example.com", "EmergencyStatus"=>"Active", "VoiceFallbackUrl"=>"https://example.com", "SmsApplicationSid"=>"APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "SmsFallbackMethod"=>"GET", "EmergencyAddressSid"=>"ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "VoiceApplicationSid"=>"APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "VoiceCallerIdLookup"=>"true", "VoiceFallbackMethod"=>"GET", "StatusCallbackMethod"=>"GET"}
{
"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
"beta": false,
"origin": "origin",
"status": "in-use",
"sms_url": "https://example.com",
"trunk_sid": null,
"voice_url": "https://example.com",
"bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"sms_method": "GET",
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"api_version": "2010-04-01",
"capabilities": {
"fax": false,
"mms": true,
"sms": false,
"voice": true
},
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
"identity_sid": "RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"phone_number": "+18089255327",
"voice_method": "GET",
"friendly_name": "friendly_name",
"status_callback": "https://example.com",
"emergency_status": "Active",
"sms_fallback_url": "https://example.com",
"voice_fallback_url": "https://example.com",
"voice_receive_mode": "voice",
"sms_application_sid": "APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"sms_fallback_method": "GET",
"address_requirements": "none",
"emergency_address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"voice_application_sid": "APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"voice_fallback_method": "GET",
"status_callback_method": "GET",
"voice_caller_id_lookup": true,
"emergency_address_status": "registered"
}