Menu

Expand
Rate this page:

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:

  1. 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.
  2. Ensure that all numbers you plan to add to the Messaging Service are already associated with a Proxy Service.
  3. 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
sid<PN> Not PII

The unique string that we created to identify the PhoneNumber resource.

account_sid
sid<AC> Not PII

The SID of the Account that created the PhoneNumber resource.

service_sid
sid<KS> Not PII

The SID of the PhoneNumber resource's parent Service resource.

date_created
date_time<iso8601> Not PII

The ISO 8601 date and time in GMT when the resource was created.

date_updated
date_time<iso8601> Not PII

The ISO 8601 date and time in GMT when the resource was last updated.

phone_number
phone_number Not PII

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

friendly_name
string Not PII

The string that you assigned to describe the resource.

iso_country
string Not PII

The ISO Country Code for the phone number.

capabilities
phone_number_capabilities Not PII

The capabilities of the phone number.

url
url Not PII

The absolute URL of the PhoneNumber resource.

is_reserved
boolean Not PII

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
integer Not PII

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

post
https://proxy.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers
Parameters
Parameters in REST API format
service_sid
Path
post sid<KS> Not PII

The SID parent Service resource of the new PhoneNumber resource.

sid
Optional
post sid<PN> Not PII

The SID of a Twilio IncomingPhoneNumber resource that represents the Twilio Number you would like to assign to your Proxy Service.

phone_number
Optional
post phone_number Not PII

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
post boolean Not PII

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
Loading Code Sample...
        
        

        Add a Phone Number

        Example 2
        Loading Code Sample...
              
              

              Add a Reserved Phone Number

              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

              get
              https://proxy.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}
              Parameters
              Parameters in REST API format
              service_sid
              Path
              get sid<KS> Not PII

              The SID of the parent Service of the PhoneNumber resource to fetch.

              sid
              Path
              get sid<PN> Not PII

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

              Example 1
              Loading Code Sample...
                    
                    

                    Fetch Phone Number

                    Get the list of Phone Numbers associated with a Proxy Service

                    get
                    https://proxy.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers
                    Parameters
                    Parameters in REST API format
                    service_sid
                    Path
                    get sid<KS> Not PII

                    The SID of the parent Service of the PhoneNumber resources to read.

                    Example 1
                    Loading Code Sample...
                          
                          

                          Read Phone Number

                          Update a PhoneNumber resource

                          post
                          https://proxy.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}
                          Parameters
                          Parameters in REST API format
                          service_sid
                          Path
                          post sid<KS> Not PII

                          The SID of the parent Service of the PhoneNumber resource to update.

                          sid
                          Path
                          post sid<PN> Not PII

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

                          is_reserved
                          Optional
                          post boolean Not PII

                          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
                          Loading Code Sample...
                                
                                

                                Update Phone Number

                                Remove a Phone Number from a Proxy Service

                                delete
                                https://proxy.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}
                                Parameters
                                Parameters in REST API format
                                service_sid
                                Path
                                delete sid<KS> Not PII

                                The SID of the parent Service of the PhoneNumber resource to delete.

                                sid
                                Path
                                delete sid<PN> Not PII

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

                                Example 1
                                Loading Code Sample...
                                      
                                      

                                      Delete Phone Number

                                      Rate this page:

                                      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.

                                      Loading Code Sample...
                                            
                                            
                                            

                                            Thank you for your feedback!

                                            Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                                            Sending your feedback...
                                            🎉 Thank you for your feedback!
                                            Something went wrong. Please try again.

                                            Thanks for your feedback!

                                            thanks-feedback-gif