Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

PhoneNumber Resource

Public Beta
Twilio's Messaging Services API is currently available as a Public Beta product. Some features are not yet implemented and others may be changed before the product is declared as Generally Available.
Public Beta products are not covered by a Twilio SLA.

The PhoneNumber subresource of a Service instance represents a phone number you have associated to the Service.

When sending a message with your Messaging Service, Copilot will select a phone number from the service for delivery.

Inbound messages received on any phone number associated to a Messaging Service are passed to the inbound request URL of the Service with the TWiML parameters that describe the message.

PhoneNumber properties

Names in PHP format
sid
sid<PN> Not PII

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

accountSid
sid<AC> Not PII

The SID of the Account that created the PhoneNumber resource.

serviceSid
sid<MG> Not PII

The SID of the Service the resource is associated with.

dateCreated
date_time<iso8601> Not PII

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

dateUpdated
date_time<iso8601> Not PII

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

phoneNumber
phone_number Not PII

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

countryCode
string Not PII

The 2-character ISO Country Code of the number.

capabilities
string[] Not PII

An array of values that describe whether the number can receive calls or messages. Can be: Voice, SMS, and MMS.

url
url Not PII

The absolute URL of the PhoneNumber resource.

Create a PhoneNumber resource

post
https://messaging.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers

Each Service can have no more than 400 phone numbers.

Parameters
Names in None format
service_sid
Required
post sid<MG> Not PII

The SID of the Service to create the resource under.

phone_number_sid
Required
post sid<PN> Not PII

The SID of the Phone Number being added to the Service.

Example
        
        
        
        

        Fetch a PhoneNumber resource

        get
        https://messaging.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}
        Parameters
        Names in None format
        service_sid
        Required
        get sid<MG> Not PII

        The SID of the Service to fetch the resource from.

        sid
        Required
        get sid_like<PN> Not PII

        The SID of the PhoneNumber resource to fetch.

        Example
              
              
              
              

              Read multiple PhoneNumber resources

              get
              https://messaging.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers
              Parameters
              Names in None format
              service_sid
              Required
              get sid<MG> Not PII

              The SID of the Service to read the resources from.

              Example
                    
                    
                    
                    

                    Delete a PhoneNumber resource

                    delete
                    https://messaging.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}

                    Removing a phone number from the Service does not release the number from your account. You must release a phone number from your Account to disassociate and delete the phone number from the Service.

                    Returns a "204 NO CONTENT" if the phone number was successfully removed from the service.

                    Parameters
                    Names in None format
                    service_sid
                    Required
                    delete sid<MG> Not PII

                    The SID of the Service to delete the resource from.

                    sid
                    Required
                    delete sid_like<PN> Not PII

                    The SID of the PhoneNumber resource to delete.

                    Example
                          
                          
                          
                          
                          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 browsing the Twilio tag on Stack Overflow.