Create phone number

POST /v1/Trunks/{TrunkSid}/PhoneNumbers

Phone numbers associated with trunks

Path parameters

  • TrunkSid string Required

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

Body

  • PhoneNumberSid string Required

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

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

Responses

  • Created

    Hide response attributes Show response attributes object
    • account_sid string | null

      The SID of the Account that created the resource

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

    • Whether the phone number requires an Address registered with Twilio

      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

    • capabilities object(string-map) | null

      Indicate if a phone can receive calls or messages

    • date_created string(date-time) | null

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

    • date_updated string(date-time) | null

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

    • 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

    • sid string | null

      The unique string that identifies the 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

      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 used with sms_fallback_url

      Values are HEAD, GET, POST, PATCH, PUT, or DELETE.

    • sms_fallback_url string(uri) | null

      The URL that we call when an error occurs while retrieving or executing the TwiML

    • sms_method string(http-method) | null

      The HTTP method to use with sms_url

      Values are HEAD, GET, POST, PATCH, PUT, or DELETE.

    • trunk_sid string | null

      The SID of the Trunk that handles calls to the phone number

      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

    • The SID of the application that handles calls to the phone number

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

    • Whether to lookup the caller's name

    • voice_fallback_method string(http-method) | null

      The HTTP method that we use to call voice_fallback_url

      Values are HEAD, GET, POST, PATCH, PUT, or DELETE.

    • voice_fallback_url string(uri) | null

      The URL we call when an error occurs in TwiML

    • voice_method string(http-method) | null

      The HTTP method used with the voice_url

      Values are HEAD, GET, POST, PATCH, PUT, or DELETE.

    • voice_url string(uri) | null

      The URL we call when the phone number receives a call

    • sms_url string(uri) | null

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

    • status_callback string(uri) | null

      The URL to send status information to your application

    • status_callback_method string(http-method) | null

      The HTTP method we use to call status_callback

      Values are HEAD, GET, POST, PATCH, PUT, or DELETE.

POST /v1/Trunks/{TrunkSid}/PhoneNumbers
curl \
 -X POST https://trunking.twilio.com/v1/Trunks/{TrunkSid}/PhoneNumbers \
 --user "username:password" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d 'PhoneNumberSid=string'
Request example
{
  "PhoneNumberSid": "string"
}
Request examples
{
  "PhoneNumberSid": "string"
}
Response examples (201)
{
  "account_sid": "string",
  "address_requirements": "none",
  "api_version": "string",
  "beta": true,
  "capabilities": {},
  "date_created": "2023-05-04T09:42:00+00:00",
  "date_updated": "2023-05-04T09:42:00+00:00",
  "friendly_name": "string",
  "links": {},
  "phone_number": "string",
  "sid": "string",
  "sms_application_sid": "string",
  "sms_fallback_method": "HEAD",
  "sms_fallback_url": "https://example.com",
  "sms_method": "HEAD",
  "sms_url": "https://example.com",
  "status_callback": "https://example.com",
  "status_callback_method": "HEAD",
  "trunk_sid": "string",
  "url": "https://example.com",
  "voice_application_sid": "string",
  "voice_caller_id_lookup": true,
  "voice_fallback_method": "HEAD",
  "voice_fallback_url": "https://example.com",
  "voice_method": "HEAD",
  "voice_url": "https://example.com"
}
Response examples (201)
{
  "account_sid": "string",
  "address_requirements": "none",
  "api_version": "string",
  "beta": true,
  "capabilities": {},
  "date_created": "2024-05-04T09:42:00+00:00",
  "date_updated": "2024-05-04T09:42:00+00:00",
  "friendly_name": "string",
  "links": {},
  "phone_number": "string",
  "sid": "string",
  "sms_application_sid": "string",
  "sms_fallback_method": "HEAD",
  "sms_fallback_url": "https://example.com",
  "sms_method": "HEAD",
  "trunk_sid": "string",
  "url": "https://example.com",
  "voice_application_sid": "string",
  "voice_caller_id_lookup": true,
  "voice_fallback_method": "HEAD",
  "voice_fallback_url": "https://example.com",
  "voice_method": "HEAD",
  "voice_url": "https://example.com",
  "sms_url": "https://example.com",
  "status_callback": "https://example.com",
  "status_callback_method": "HEAD"
}