Twilio Routes API

The Twilio Routes API is a powerful tool that allows developers to customize and manage how their Twilio traffic is routed and handled. This API provides a flexible and robust system for controlling the flow of communication between various endpoints, such as phone numbers, messaging services, or voice applications.

OpenAPI Specification

routes-openapi-original.yml Raw ↑
components:
  schemas:
    routes.v2.phone_number:
      type: object
      properties:
        phone_number:
          type: string
          nullable: true
          description: The phone number in E.164 format
        url:
          type: string
          format: uri
          nullable: true
          description: The absolute URL of the resource.
        sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^QQ[0-9a-fA-F]{32}$
          nullable: true
          description: >-
            A 34 character string that uniquely identifies the Inbound
            Processing Region assignments for this phone number.
        account_sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^AC[0-9a-fA-F]{32}$
          nullable: true
          description: The unique SID identifier of the Account.
        friendly_name:
          type: string
          nullable: true
          description: >-
            A human readable description of the Inbound Processing Region
            assignments for this phone number, up to 64 characters.
        voice_region:
          type: string
          nullable: true
          description: The Inbound Processing Region used for this phone number for voice.
        date_created:
          type: string
          format: date-time
          nullable: true
          description: >-
            The date that this phone number was assigned an Inbound Processing
            Region, given in ISO 8601 format.
        date_updated:
          type: string
          format: date-time
          nullable: true
          description: >-
            The date that the Inbound Processing Region was updated for this
            phone number, given in ISO 8601 format.
    routes.v2.sip_domain:
      type: object
      properties:
        sip_domain:
          type: string
          nullable: true
        url:
          type: string
          format: uri
          nullable: true
        sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^QQ[0-9a-fA-F]{32}$
          nullable: true
        account_sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^AC[0-9a-fA-F]{32}$
          nullable: true
        friendly_name:
          type: string
          nullable: true
        voice_region:
          type: string
          nullable: true
        date_created:
          type: string
          format: date-time
          nullable: true
        date_updated:
          type: string
          format: date-time
          nullable: true
    routes.v2.trunks:
      type: object
      properties:
        sip_trunk_domain:
          type: string
          nullable: true
          description: The absolute URL of the SIP Trunk
        url:
          type: string
          format: uri
          nullable: true
          description: The absolute URL of the resource.
        sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^QQ[0-9a-fA-F]{32}$
          nullable: true
          description: >-
            A 34 character string that uniquely identifies the Inbound
            Processing Region assignments for this SIP Trunk.
        account_sid:
          type: string
          minLength: 34
          maxLength: 34
          pattern: ^AC[0-9a-fA-F]{32}$
          nullable: true
          description: The unique SID identifier of the Account.
        friendly_name:
          type: string
          nullable: true
          description: >-
            A human readable description of the Inbound Processing Region
            assignments for this SIP Trunk, up to 64 characters.
        voice_region:
          type: string
          nullable: true
          description: The Inbound Processing Region used for this SIP Trunk for voice.
        date_created:
          type: string
          format: date-time
          nullable: true
          description: >-
            The date that this SIP Trunk was assigned an Inbound Processing
            Region, given in ISO 8601 format.
        date_updated:
          type: string
          format: date-time
          nullable: true
          description: >-
            The date that the Inbound Processing Region was updated for this SIP
            Trunk, given in ISO 8601 format.
    UpdatePhoneNumberRequest:
      type: object
      properties:
        VoiceRegion:
          type: string
          description: The Inbound Processing Region used for this phone number for voice
        FriendlyName:
          type: string
          description: A human readable description of this resource, up to 64 characters.
    UpdateSipDomainRequest:
      type: object
      properties:
        VoiceRegion:
          type: string
          description: ''
        FriendlyName:
          type: string
          description: ''
    UpdateTrunksRequest:
      type: object
      properties:
        VoiceRegion:
          type: string
          description: The Inbound Processing Region used for this SIP Trunk for voice
        FriendlyName:
          type: string
          description: A human readable description of this resource, up to 64 characters.
  securitySchemes:
    accountSid_authToken:
      type: http
      scheme: basic
info:
  title: Twilio - Routes
  description: This is the public Twilio REST API.
  termsOfService: https://www.twilio.com/legal/tos
  contact:
    name: Twilio Support
    url: https://support.twilio.com
    email: [email protected]
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.52.0
openapi: 3.0.1
paths:
  /v2/PhoneNumbers/{PhoneNumber}:
    servers:
      - url: https://routes.twilio.com
    description: 'TODO: Resource-level docs'
    x-twilio:
      defaultOutputProperties:
        - sid
        - friendly_name
        - date_created
      pathType: instance
    post:
      description: Assign an Inbound Processing Region to a phone number.
      tags:
        - PhoneNumbers
      parameters:
        - name: PhoneNumber
          in: path
          description: The phone number in E.164 format
          schema:
            type: string
          required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/routes.v2.phone_number'
          description: OK
      security:
        - accountSid_authToken: []
      operationId: UpdatePhoneNumber
      x-maturity:
        - GA
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/UpdatePhoneNumberRequest'
    get:
      description: Fetch the Inbound Processing Region assigned to a phone number.
      tags:
        - PhoneNumbers
      parameters:
        - name: PhoneNumber
          in: path
          description: The phone number in E.164 format
          schema:
            type: string
          required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/routes.v2.phone_number'
          description: OK
      security:
        - accountSid_authToken: []
      operationId: FetchPhoneNumber
      x-maturity:
        - GA
  /v2/SipDomains/{SipDomain}:
    servers:
      - url: https://routes.twilio.com
    description: 'TODO: Resource-level docs'
    x-twilio:
      defaultOutputProperties:
        - sid
        - friendly_name
        - date_created
      pathType: instance
    post:
      description: ''
      tags:
        - SipDomains
      parameters:
        - name: SipDomain
          in: path
          description: ''
          schema:
            type: string
          required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/routes.v2.sip_domain'
          description: OK
      security:
        - accountSid_authToken: []
      operationId: UpdateSipDomain
      x-maturity:
        - GA
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/UpdateSipDomainRequest'
    get:
      description: ''
      tags:
        - SipDomains
      parameters:
        - name: SipDomain
          in: path
          description: ''
          schema:
            type: string
          required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/routes.v2.sip_domain'
          description: OK
      security:
        - accountSid_authToken: []
      operationId: FetchSipDomain
      x-maturity:
        - GA
  /v2/Trunks/{SipTrunkDomain}:
    servers:
      - url: https://routes.twilio.com
    description: 'TODO: Resource-level docs'
    x-twilio:
      defaultOutputProperties:
        - sid
        - friendly_name
        - date_created
      pathType: instance
    post:
      description: Assign an Inbound Processing Region to a SIP Trunk
      tags:
        - Trunks
      parameters:
        - name: SipTrunkDomain
          in: path
          description: The absolute URL of the SIP Trunk
          schema:
            type: string
          required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/routes.v2.trunks'
          description: OK
      security:
        - accountSid_authToken: []
      operationId: UpdateTrunks
      x-maturity:
        - GA
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/UpdateTrunksRequest'
    get:
      description: Fetch the Inbound Processing Region assigned to a SIP Trunk.
      tags:
        - Trunks
      parameters:
        - name: SipTrunkDomain
          in: path
          description: The absolute URL of the SIP Trunk
          schema:
            type: string
          required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/routes.v2.trunks'
          description: OK
      security:
        - accountSid_authToken: []
      operationId: FetchTrunks
      x-maturity:
        - GA
servers:
  - url: https://routes.twilio.com
tags:
  - name: PhoneNumbers
  - name: SipDomains
  - name: Trunks
x-maturity:
  - name: GA
    description: This product is Generally Available.