Phone Number
With Twilio Proxy, you associate phone numbers (this resource) and short codes directly with a Proxy Service. All added numbers go into the Phone Number Pool associated with a given Proxy Service.
A Twilio number cannot be associated with more than one Proxy Service, but it can be associated with a Messaging Service, for example to complete US A2P 10DLC registration (see below for important details about how to do this).
For more information on managing the phone numbers in your Proxy Phone Number Pool, refer to our Phone Number Management guide.
"Reserved" numbers in Proxy
In a Proxy service, phone numbers can be marked as Reserved. Reserved numbers will not be included in the set of numbers Proxy considers when choosing a number for a participant, but they can be manually assigned as Proxy Numbers for participants (e.g., in a lead tracking use-case).
Proxy Number Pool Size Limit
Phone Number Pools are limited to 5000 reserved phone numbers and 500 unreserved phone numbers per Proxy Service. Numbers can be distributed across multiple Proxy Services if you need more of numbers.
Adding Proxy Phone Numbers to Messaging Services
It is possible to associate Twilio Proxy numbers with a Messaging Service, although there are some limitations to be aware of. This capability is especially important for customers who use US long code numbers to send messages to US recipients, because adding numbers to a Messaging Service is required in order to complete A2P 10DLC registration.
Currently, a number that is already associated with a Messaging Service cannot be added to a Proxy Service via the Proxy Console or API.
However, Twilio numbers that are already associated with a Proxy Service can be associated with a Messaging Service. Before doing this, you must ensure that your Messaging Service is configured correctly. Your Messaging Service must have its Incoming Message handling behavior set to "Defer to sender’s webhook" to ensure that your numbers continue to use Proxy after they are added to the Service.
Step-by-step instructions to associate Proxy numbers with a Messaging Service:
- Set up your Messaging Service, but do not add any phone numbers to it yet. Ensure that the Incoming Message handling is set to "Defer to sender's webhook." This setting can be found in the "Integration" settings for the Messaging Service in the Twilio Console.
- Ensure that all numbers you plan to add to the Messaging Service are already associated with a Proxy Service.
- Add your Proxy numbers to the Messaging Service, either using the Twilio Console or the Messaging Service API PhoneNumber endpoint.
PhoneNumber properties
Resource Properties in REST API format | |
---|---|
sid
|
The unique string that we created to identify the PhoneNumber resource. |
account_sid
|
The SID of the Account that created the PhoneNumber resource. |
service_sid
|
The SID of the PhoneNumber resource's parent Service resource. |
date_created
|
The ISO 8601 date and time in GMT when the resource was created. |
date_updated
|
The ISO 8601 date and time in GMT when the resource was last updated. |
phone_number
|
The phone number in E.164 format, which consists of a + followed by the country code and subscriber number. |
friendly_name
|
The string that you assigned to describe the resource. |
iso_country
|
The ISO Country Code for the phone number. |
capabilities
|
The capabilities of the phone number. |
url
|
The absolute URL of the PhoneNumber resource. |
is_reserved
|
Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See Reserved Phone Numbers for more information. |
in_use
|
The number of open session assigned to the number. See the How many Phone Numbers do I need? guide for more information. |
Add a Phone Number to a Proxy Service
https://proxy.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID parent Service resource of the new PhoneNumber resource. |
sid
Optional
|
The SID of a Twilio IncomingPhoneNumber resource that represents the Twilio Number you would like to assign to your Proxy Service. |
phone_number
Optional
|
The phone number 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. |
is_reserved
Optional
|
Whether the new phone number should be reserved and not be assigned to a participant using proxy pool logic. See Reserved Phone Numbers for more information. |
Example 1
Example 2
Note: You should pass a PhoneNumber
or a Sid
(identifying a phone number on your account). Only one of them is required. Passing both will return an error.
Fetch a PhoneNumber resource
https://proxy.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the parent Service of the PhoneNumber resource to fetch. |
sid
Path
|
The Twilio-provided string that uniquely identifies the PhoneNumber resource to fetch. |
Example 1
Get the list of Phone Numbers associated with a Proxy Service
https://proxy.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the parent Service of the PhoneNumber resources to read. |
Example 1
Update a PhoneNumber resource
https://proxy.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the parent Service of the PhoneNumber resource to update. |
sid
Path
|
The Twilio-provided string that uniquely identifies the PhoneNumber resource to update. |
is_reserved
Optional
|
Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See Reserved Phone Numbers for more information. |
Example 1
Remove a Phone Number from a Proxy Service
https://proxy.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the parent Service of the PhoneNumber resource to delete. |
sid
Path
|
The Twilio-provided string that uniquely identifies the PhoneNumber 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.