List phone number

GET /v1/Trunks/{TrunkSid}/PhoneNumbers

Phone numbers associated with trunks

Path parameters

  • TrunkSid string Required

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

    Minimum length is 34, maximum length is 34. Format should match the following pattern: ^TK[0-9a-fA-F]{32}$.

Query parameters

  • PageSize integer(int64)

    How many resources to return in each list page. The default is 50, and the maximum is 1000.

    Minimum value is 1, maximum value is 1000.

  • Page integer

    The page index. This value is simply for client state.

    Minimum value is 0.

  • PageToken string

    The page token. This is provided by the API.

Responses

  • 200 application/json

    OK

    Hide headers attributes Show headers attributes
    • Access-Control-Allow-Origin string

      Specify the origin(s) allowed to access the resource

    • Access-Control-Allow-Methods string

      Specify the HTTP methods allowed when accessing the resource

    • Access-Control-Allow-Headers string

      Specify the headers allowed when accessing the resource

    • Access-Control-Allow-Credentials boolean

      Indicates whether the browser should include credentials

    • Access-Control-Expose-Headers string

      Headers exposed to the client

    Hide response attributes Show response attributes object
    • phone_numbers array[object]
      Hide phone_numbers attributes Show phone_numbers attributes object
      • account_sid string | null

        The SID of the Account that created the PhoneNumber resource.

        Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

      • address_requirements string

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

        Values are none, any, local, or foreign.

      • api_version string | null

        The API version used to start a new TwiML session.

      • beta boolean | null

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

      • capabilities object(string-map) | null

        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 string(date-time) | null

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

      • date_updated string(date-time) | null

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

      • friendly_name string | null

        The string that you assigned to describe the resource.

      • phone_number string(phone-number) | null

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

      • sid string | null

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

        Minimum length is 34, maximum length is 34. Format should match the following pattern: ^PN[0-9a-fA-F]{32}$.

      • sms_application_sid string | null

        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.

        Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AP[0-9a-fA-F]{32}$.

      • sms_fallback_method string(http-method) | null

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

        Values are GET or POST.

      • sms_fallback_url string(uri) | null

        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 string(http-method) | null

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

        Values are GET or POST.

      • sms_url string(uri) | null

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

      • status_callback string(uri) | null

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

      • status_callback_method string(http-method) | null

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

        Values are GET or POST.

      • trunk_sid string | null

        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.

        Minimum length is 34, maximum length is 34. Format should match the following pattern: ^TK[0-9a-fA-F]{32}$.

      • url string(uri) | null

        The absolute URL of the resource.

      • voice_application_sid string | null

        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.

        Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AP[0-9a-fA-F]{32}$.

      • voice_caller_id_lookup boolean | null

        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 string(http-method) | null

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

        Values are GET or POST.

      • voice_fallback_url string(uri) | null

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

      • voice_method string(http-method) | null

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

        Values are GET or POST.

      • voice_url string(uri) | null

        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.

    • meta object
      Hide meta attributes Show meta attributes object
      • first_page_url string(uri)
      • key string
      • next_page_url string(uri) | null
      • page integer
      • page_size integer
      • previous_page_url string(uri) | null
      • url string(uri)
GET /v1/Trunks/{TrunkSid}/PhoneNumbers
curl \
 --request GET 'https://trunking.twilio.com/v1/Trunks/{TrunkSid}/PhoneNumbers' \
 --user "username:password"
Response examples (200)
{
  "meta": {
    "key": "phone_numbers",
    "url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers?PageSize=1&Page=0",
    "page": 0,
    "page_size": 1,
    "next_page_url": null,
    "first_page_url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers?PageSize=1&Page=0",
    "previous_page_url": null
  },
  "phone_numbers": [
    {
      "sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "beta": false,
      "links": {
        "phone_number": "https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
      },
      "sms_url": "https://webhooks.twilio.com/v1/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Proxy/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks/Message",
      "trunk_sid": "TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "voice_url": "https://webhooks.twilio.com/v1/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Proxy/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks/Call",
      "sms_method": "POST",
      "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "api_version": "2010-04-01",
      "capabilities": {
        "mms": true,
        "sms": true,
        "voice": true
      },
      "date_created": "2010-12-10T17:27:34Z",
      "date_updated": "2015-10-09T11:36:32Z",
      "phone_number": "+14158675309",
      "voice_method": "POST",
      "friendly_name": "(415) 867-5309",
      "status_callback": "",
      "sms_fallback_url": "",
      "voice_fallback_url": null,
      "sms_application_sid": "APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "sms_fallback_method": "POST",
      "address_requirements": "none",
      "voice_application_sid": "",
      "voice_fallback_method": null,
      "status_callback_method": "POST",
      "voice_caller_id_lookup": null
    }
  ]
}
{
  "meta": {
    "key": "phone_numbers",
    "url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers?PageSize=1&Page=0",
    "page": 0,
    "page_size": 1,
    "next_page_url": null,
    "first_page_url": "https://trunking.twilio.com/v1/Trunks/TKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers?PageSize=1&Page=0",
    "previous_page_url": null
  },
  "phone_numbers": []
}