Menu

Expand
Rate this page:

Active Numbers Resource

Active Numbers API is currently in closed private Developer Preview. Please use the generally available Incoming Phone Numbers API if you do not have access.

The Global Phone Numbers Catalog - Active Numbers resource has the same search and filtering functions as Available Numbers. You can filter based on the attributes of a phone number and see detailed attributes of your current inventory. Some PhoneNumber instances may be null due to missing data. We are working towards a 100% inventory backed resource.

Resource Properties

Basic Capability Properties

The table below states basic properties of the phone number that associate the number to a unique group within Twilio's inventory system.

Property Description
PhoneNumber The phone number, in E.164 (i.e. "+1") format.
FriendlyName A human readable descriptive text for this resource, up to 64 characters long. By default, the FriendlyName is a nicely formatted version of the phone number.
Type The type of phone number (i.e., local, mobile, tollfree, shortcode, etc.)
Lifecycle The lifecycle the number is in (i.e., developer-preview, beta, generally-available, exhausted).
StatusCallback The URL that Twilio will request to pass status parameters (such as call ended) to your application.
StatusCallbackMethod The HTTP method Twilio will use to make requests to the StatusCallback URL. Either GET or POST.

Voice Capability Properties

Voice calling is provided by utilizing the Public Switch Telephone Network (PSTN) , the aggregate of the world's circuit-switched telephone networks that are operated by national, regional, or local telephony operators, providing infrastructure and services for public telecommunication.

Property Description
Capabilities.Voice.InboundConnectivity Indicates whether a number has inbound voice connectivity in to Twilio
Capabilities.Voice.OutboundConnectivity Indicates whether a number has outbound voice connectivity out of Twilio
Capabilities.Voice.E911 Emergency 911 connectivity capable number
Capabilities.Voice.Fax Fax capable number
Capabilities.Voice.SipTrunking Sip Trunking capable number
Capabilities.Voice.CallsPerSecond Integer stating how many calls can be initiated per second. Please refer to Twilio's CPS Support article for more information.
Capabilities.Voice.ConcurrentCallsLimit Integer stating how many calls can be active at one time
Capabilities.Voice.InboundCalledDtmf Dual-Tone Multi Frequency with inbound called party
Capabilities.Voice.InboundCallerDtmf Dual-Tone Multi Frequency with inbound caller party
Capabilities.Voice.InboundCallerIdPreservation Inbound voice Caller ID (+E.164 format) preservation of a number. Can be - International, Domestic, or None.
Capabilities.Voice.InboundReachability Inbound Voice reachability of a number. Can be - Domestic, Foreign, or Global
Capabilities.Voice.LongRecordLength The length in seconds that a number can record a voicemail

Sms Capability Properties

Short Messaging Service (SMS) is a text messaging service component of most telephone, World Wide Web, and mobile telephony systems.

Property Description
Capabilities.Sms.InboundConnectivity Indicates whether a number has inbound sms connectivity in to Twilio
Capabilities.Sms.OutboundConnectivity Indicates whether a number has outbound sms connectivity out of Twilio
Capabilities.Sms.Gsm7 GSM-7 is a character encoding standard which packs the most commonly used letters and symbols in many languages into 7 bits each for usage on GSM networks. See What is GSM-7 Character Encoding
Capabilities.Sms.Ucs2 UCS-2 is a character encoding standard in which characters are represented by a fixed-length 16 bits (2 bytes). See What is UCS-2 Character Encoding?
Capabilities.Sms.Gsm7Concatenation Concatenated short message service (or concatenated SMS) is used overcome the limitation on the number of characters that can be sent in a single SMS text message transmission (which is usually 160), and split the sms into smaller messages by the sending device and recombined at the receiving end.
Capabilities.Sms.Ucs2Concatenation Concatenated short message service (or concatenated SMS) is used overcome the limitation on the number of characters that can be sent in a single SMS text message transmission (which is usually 160), and split the sms into smaller messages by the sending device and recombined at the receiving end.
Capabilities.Sms.InboundSenderIdPreservation Inbound sms Sender ID (+E.164 format) preservation of a number. Can be - International, Domestic, or None
Capabilities.Sms.InboundReachability Inbound SMS reachability of a number. Can be - Domestic, Foreign, or Global.
Capabilities.Sms.InboundMps Integer showing the SMS inbound message per second limit. Please refer to Twilio's MPS Support article for more information.

Mms Capability Properties

Multimedia Messaging Service (MMS) is is a standard way to send messages that include multimedia content to and from a mobile phone over a cellular network.

Property Description
Capabilities.Mms.Inboundconnectivity Indicates whether a number has inbound MMS connectivity into Twilio
Capabilities.Mms.Outboundconnectivity Indicates whether a number has outbound MMS connectivity into Twilio
Capabilities.Mms.InboundReachability Inbound MMS reachability of a number. Can be - Domestic, Foreign, or Global.
Capabilities.Mms.InboundMps Integer showing the MMS inbound message per second limit. Please refer to Twilio's MPS Support article for more information.

Regulatory Properties

Regulations that pertain to this specific number that may deal with Addresses and/or Identities to be required and completed as a pre-request before purchasing.

Property Description
Regulatory.AddressRequirements This indicates whether the phone number requires you or your customer to have an Address registered with Twilio. Possible values are listed below.
Address Requirement Values

The following are the possible values for the address_required property.

Status Description
none An Address is not required for this phone number.
any Your account must have an Address, but it can be anywhere in the world.
local Your account must have an Address within the phone number's country.
foreign Your account must have an Address outside the phone number's country.

Geography Properties

A phone number's specific geography associated with a number. Some numbers are country level only, and others have specific latitude and longitude associated with them. To understand more, please visit List of Country Codes.

Property Description
Geography.IsoCountry The ISO country code of this phone number.
Geography.Lata The LATA of this phone number. Only available for countries in the North American Numbering Plan (NANPA).
Geography.RateCenter The rate center of this phone number. Only available for countries in the North American Numbering Plan (NANPA).
Geography.Latitude The latitude coordinate of this phone number.
Geography.Longitude The longitude coordinate of this phone number.
Geography.Region The two-letter state or province abbreviation of this phone number.
Geography.Locality The locality/city of this phone number.
Geography.PostalCode The postal (zip) code of this phone number.

Voice Configuration Properties

A number's voice configuration for the capabilities enabled. These attributes are mutable and can be changed based on differing operations.

Property Description
Configurations.Voice.ApplicationSid The 34 character sid of the voice application Twilio should use to handle Voice sent to this number. If an VoiceApplicationSid is present, Twilio will ignore all of the VoiceUrls above and use those set on the application.
Configurations.Voice.TrunkSid The 34 character sid of the Trunk Twilio should use to handle phone calls to this number. If a TrunkSid is present, Twilio will ignore all of the voice urls and voice applications above and use those set on the Trunk. Setting a TrunkSid will automatically delete your VoiceApplicationSid and vice versa.
Configurations.Voice.EmergencyStatus Status determining whether the number is enabled for emergency calling
Configurations.Voice.EmergencyAddressSid EmergencyAddress configuration to leverage emergency calling
Configurations.Voice.ReceiveMode Whether the phone number is configured to receive voice or fax calls. Either voice or fax.
Configurations.Voice.Url The URL Twilio will request when this phone number receives a call. The VoiceURL will no longer be used if a VoiceApplicationSid or a TrunkSid is set.
Configurations.Voice.Method The HTTP method Twilio will use when requesting the above Url. Either GET or POST.The URL that Twilio will request if an error occurs retrieving or executing the TwiML requested by Url.
Configurations.Voice.FallbackUrl The URL that Twilio will request if an error occurs retrieving or executing the TwiML requested by Url.
Configurations.Voice.FallbackMethod The HTTP method Twilio will use when requesting the VoiceFallbackUrl. Either GET or POST.
Configurations.Voice.CallerIdLookup Do a lookup of a caller's name from the CNAM database and post it to your app. Either true or false.

Sms Configuration Properties

A number's sms configuration for the capabilities enabled. These attributes are mutable and can be changed based on differing operations.

Property Description
Configurations.Sms.ApplicationSid The 34 character sid of the application Twilio should use to handle SMSs sent to this number. If an SmsApplicationSid is present, Twilio will ignore all of the SMS urls above and use those set on the application.
Configurations.Sms.Url The URL Twilio will request when this phone number receives a message. The SmsUrl will no longer be used if an SmsApplicationSid is set.
Configurations.Sms.Method The HTTP method Twilio will use when making requests to the SmsUrl. Either GET or POST.
Configurations.Sms.FallbackUrl The URL that Twilio will request if an error occurs retrieving or executing the TwiML from SmsUrl.The HTTP method Twilio will use when requesting the above URL. Either GET or POST.
Configurations.Sms.FallbackMethod The HTTP method Twilio will use when requesting the above URL. Either GET or POST
Loading Code Sample...
        
        

        GET ActiveNumbers Instance

        ActiveNumbers Instance Resource

        An ActiveNumbers instance represents a Twilio phone number purchased from Twilio, ported to Twilio, or hosted on Twilio in your account.

        Resource URI

        https://preview.twilio.com/Numbers/ActiveNumbers/{ActiveNumberSid}
        

        HTTP GET

        Look up the capabilities on a specific number using the PhoneNumberSid in the URI.

        Loading Code Sample...
              
              

              Configure Phone Number Instance

              HTTP POST

              Configure your number using the post method on the phone number instance with the possible optional parameters.

              Basic Configuration Properties
              Property Description
              Configurations.StatusCallback The URL that Twilio will request to pass status parameters (such as call ended) to your application.
              Configurations.StatusCallbackMethod The HTTP method Twilio will use to make requests to the StatusCallback URL. Either GET or POST.
              Voice Configuration Properties
              Property Description
              Configurations.Voice.ApplicationSid The 34 character sid of the voice application Twilio should use to handle Voice sent to this number. If an VoiceApplicationSid is present, Twilio will ignore all of the VoiceUrls above and use those set on the application.
              Configurations.Voice.Url The URL Twilio will request when this phone number receives a call. The VoiceURL will no longer be used if a VoiceApplicationSid or a TrunkSid is set.
              Configurations.Voice.Method The HTTP method Twilio will use when requesting the above Url. Either GET or POST.The URL that Twilio will request if an error occurs retrieving or executing the TwiML requested by Url.
              Configurations.Voice.FallbackUrl The URL that Twilio will request if an error occurs retrieving or executing the TwiML requested by Url.
              Configurations.Voice.FallbackMethod The HTTP method Twilio will use when requesting the VoiceFallbackUrl. Either GET or POST.
              Sms Configuration Properties
              Property Description
              Configurations.Sms.ApplicationSid The 34 character sid of the application Twilio should use to handle SMSs sent to this number. If an SmsApplicationSid is present, Twilio will ignore all of the SMS urls above and use those set on the application.
              Configurations.Sms.Url The URL Twilio will request when this phone number receives a message. The SmsUrl will no longer be used if an SmsApplicationSid is set.
              Configurations.Sms.Method The HTTP method Twilio will use when making requests to the SmsUrl. Either GET or POST.
              Configurations.Sms.FallbackUrl The URL that Twilio will request if an error occurs retrieving or executing the TwiML from SmsUrl.The HTTP method Twilio will use when requesting the above URL. Either GET or POST.
              Configurations.Sms.FallbackMethod The HTTP method Twilio will use when requesting the above URL. Either GET or POST
              Loading Code Sample...
                    
                    

                    Transfer number to subaccount

                    Example: Transfer number to subaccount

                    You can transfer phone numbers between two Twilio accounts if you're using subaccounts. For details, see Exchanging Numbers Between Subaccounts.

                    HTTP DELETE

                    Release this phone number from your account. Twilio will no longer answer calls to this number, and you will stop being billed the monthly phone number fee. The phone number will eventually be recycled and potentially given to another customer, so use with care. If you make a mistake, contact us. We may be able to give you the number back.

                    If successful, returns an HTTP 204 response with no body.

                    Loading Code Sample...
                          
                          

                          List all Active Numbers

                          ActiveNumbers List Resource

                          Resource URI

                          preview.twilio.com/Numbers/ActiveNumbers
                          

                          HTTP GET

                          Returns a list of ActiveNumber resource representations, each representing a phone number given to your account. The list includes paging information.

                          List Filters

                          The following parameters are accessible as GET filters. Note, parameters are case-sensitive:

                          Property Description
                          PhoneNumber The phone number you want to purchase. The number should be formatted starting with a '+' followed by the country code and the number in
                          Type The type of phone number (i.e., local, mobile, tollfree, shortcode, etc.)
                          Capabilities.Voice.InboundCallerIdPreservation Inbound Voice Caller ID [(+E.164 format)][e164] preservation of a number. Can be - International, Domestic, or None
                          Capabilities.Voice.InboundReachability Inbound Voice reachability of a number. Can be - Domestic, Foreign, or Global
                          Capabilities.Sms.InboundSenderIdPreservation Inbound SMS Sender ID [(+E.164 format)][e164] preservation of a number. Can be - International, Domestic, or None
                          Capabilities.Sms.InboundReachability Inbound SMS reachability of a number. Can be - Domestic, Foreign, or Global
                          Capabilities.Mms.InboundReachability Inbound MMS reachability of a number. Can be - Domestic, Foreign, or Global
                          Geography.IsoCountry The [ISO country code][iso-country] of this phone number.
                          Geography.Lata The [LATA][lata] of this phone number. Only available for countries in the [North American Numbering Plan (NANPA)][nanpa].
                          Geography.RateCenter The [rate center][rate-center] of this phone number. Only available for countries in the [North American Numbering Plan (NANPA)][nanpa].
                          Geography.Latitude The latitude coordinate of this phone number.
                          Geography.Longitude The longitude coordinate of this phone number.
                          Geography.Region The two-letter state or province abbreviation of this phone number.
                          Geography.Locality The locality/city of this phone number.
                          Geography.PostalCode The postal (zip) code of this phone number.
                          Example: List all Active Numbers

                          You can manage your numbers by creating a list of all numbers that meet your search criteria filters.

                          HTTP POST

                          Purchases a new phone number for your account. If a phone number is found for your request, Twilio will add it to your account and bill you for the first month's cost of the phone number. If Twilio cannot find a phone number to match your request, you will receive an HTTP 400 with Twilio error code 21452.

                          If the number you are trying to purchase requires an identity document on file and you don’t have a verified identity document associated with your account, you will receive an HTTP 400 with Twilio error code 21650. See this support article for more details.

                          To find an available phone number to POST, use the AvailableNumbers list resource.

                          You cannot request numbers via the API while you are using a Free Trial account. You must upgrade your account to purchase a Twilio phone number programmatically.

                          Required Parameters

                          Your request must include the following parameter:

                          Parameter Description
                          PhoneNumber The phone number you want to purchase. The number should be formatted starting with a '+' followed by the country code and the number in E.164 format e.g., '+15105555555'. You must include this parameter to have your POST succeed.
                          Optional Parameters

                          Your request may include the following parameters that are referenced as resource properties. If successful, Twilio responds with a representation of the new phone number that was assigned to your account.

                          Loading Code Sample...
                                
                                

                                Purchase Phone Number

                                Example: Purchase new phone number

                                The ActiveNumbers list resource represents an account's Twilio phone numbers. You can POST to the list resource to provision a new Twilio number. To find a new number to provision use the resources the AvailableNumbers resource.

                                HTTP PUT

                                Not Supported.

                                HTTP DELETE

                                Not Supported.

                                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