Menu

Expand
Rate this page:

PhoneNumber Resource

The Phone Numbers subresource contains the list of Phone Number instances associated with a SIP Trunk.

To purchase a new phone number for your trunk or manage your numbers more generally, you'll need to use the IncomingPhoneNumbers Resource. The SIP Trunking PhoneNumbers Resource is only for adding, removing, and viewing phone numbers associated with a SIP Trunk.

PhoneNumber properties

Resource Properties in REST API format
account_sid
sid<AC> Not PII

The SID of the Account that created the PhoneNumber resource.

address_requirements
enum:address_requirement Not PII

Whether the phone number requires an Address registered with Twilio and, if so, what type. Can be: none, any, local, or foreign.

api_version
string Not PII

The API version used to start a new TwiML session.

beta
boolean Not PII

Whether the phone number is new to the Twilio platform. Can be: true or false.

capabilities
string_map Not PII

The set of Boolean properties that indicate whether a phone number can receive calls or messages. Capabilities are Voice, SMS, and MMS and each capability can be: true or false.

date_created
date_time<iso8601> Not PII

The date and time in GMT when the resource was created specified in RFC 2822 format.

date_updated
date_time<iso8601> Not PII

The date and time in GMT when the resource was last updated specified in RFC 2822 format.

friendly_name

The string that you assigned to describe the resource.

links
uri_map Not PII

The URLs of related resources.

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.

sid
sid<PN> Not PII

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

sms_application_sid
sid<AP> Not PII

The SID of the application that handles SMS messages sent to the phone number. If an sms_application_sid is present, we ignore all sms_*_url values and use those of the application.

sms_fallback_method
http_method Not PII

The HTTP method we use to call sms_fallback_url. Can be: GET or POST.

sms_fallback_url
url Not PII

The URL that we call using the sms_fallback_method when an error occurs while retrieving or executing the TwiML from sms_url.

sms_method
http_method Not PII

The HTTP method we use to call sms_url. Can be: GET or POST.

sms_url
url Not PII

The URL we call using the sms_method when the phone number receives an incoming SMS message.

status_callback
url Not PII

The URL we call using the status_callback_method to send status information to your application.

status_callback_method
http_method Not PII

The HTTP method we use to call status_callback. Can be: GET or POST.

trunk_sid
sid<TK> Not PII

The SID of the Trunk that handles calls to the phone number. If a trunk_sid is present, we ignore all of the voice URLs and voice applications and use those set on the Trunk. Setting a trunk_sid will automatically delete your voice_application_sid and vice versa.

url
url Not PII

The absolute URL of the resource.

voice_application_sid
sid<AP> Not PII

The SID of the application that handles calls to the phone number. If a voice_application_sid is present, we ignore all of the voice URLs and use those set on the application. Setting a voice_application_sid will automatically delete your trunk_sid and vice versa.

voice_caller_id_lookup
boolean Not PII

Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: true or false.

voice_fallback_method
http_method Not PII

The HTTP method that we use to call voice_fallback_url. Can be: GET or POST.

voice_fallback_url
url Not PII

The URL that we call using the voice_fallback_method when an error occurs retrieving or executing the TwiML requested by url.

voice_method
http_method Not PII

The HTTP method we use to call voice_url. Can be: GET or POST.

voice_url
url Not PII

The URL we call using the voice_method when the phone number receives a call. The voice_url is not be used if a voice_application_sid or a trunk_sid is set.

Create a PhoneNumber resource

post
https://trunking.twilio.com/v1/Trunks/{TrunkSid}/PhoneNumbers
Parameters
Parameters in REST API format
trunk_sid
Path
post sid<TK> Not PII

The SID of the Trunk to associate the phone number with.

phone_number_sid
Required
post sid<PN> Not PII

The SID of the Incoming Phone Number that you want to associate with the trunk.

Example 1
Loading Code Sample...
        
        

        Create Phone Number

        Read multiple PhoneNumber resources

        get
        https://trunking.twilio.com/v1/Trunks/{TrunkSid}/PhoneNumbers
        Parameters
        Parameters in REST API format
        trunk_sid
        Path
        get sid<TK> Not PII

        The SID of the Trunk from which to read the PhoneNumber resources.

        Example 1
        Loading Code Sample...
              
              

              Read Phone Number

              Delete a PhoneNumber resource

              delete
              https://trunking.twilio.com/v1/Trunks/{TrunkSid}/PhoneNumbers/{Sid}
              Parameters
              Parameters in REST API format
              trunk_sid
              Path
              delete sid<TK> Not PII

              The SID of the Trunk from which to delete the PhoneNumber resource.

              sid
              Path
              delete sid<PN> Not PII

              The unique string that we created to identify 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