> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revring.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Twilio

> Connects Twilio numbers in one step: creates an Elastic SIP trunk in your Twilio account with origination to sip.revring.ai and a fresh termination credential, moves the chosen numbers onto it, and creates the matching RevRing trunk. With agentId, the numbers are also assigned to that agent for inbound calls (and the trunk becomes its outbound trunk if it has none). If any step fails, everything created in Twilio is removed and your numbers keep their current routing.



## OpenAPI

````yaml POST /sip-trunks/connect/twilio
openapi: 3.1.0
info:
  title: RevRing Voice AI API
  description: >-
    RevRing Voice AI platform API for managing AI voice agents, phone calls, SIP
    trunks, and analytics. Build intelligent voice applications that can handle
    inbound and outbound phone calls with AI-powered conversational agents.
  version: 1.0.0
  contact:
    name: RevRing Support
    url: https://revring.ai
servers:
  - url: https://api.revring.ai/v1
    description: Production API
security:
  - apiKeyAuth: []
tags:
  - name: Messaging Connections
    description: Connect messaging providers so agents can send text messages
  - name: Messages
    description: Send text messages and read your message log
  - name: Conversations
    description: List and clear managed conversation threads
  - name: SIP Trunks
    description: Manage SIP trunks for connecting agents to the phone network
  - name: Agents
    description: Manage AI voice agents and their configuration
  - name: Agent Folders
    description: Organize agents into folders for dashboard navigation
  - name: Calls
    description: Manage and query phone calls
  - name: Analytics
    description: Get analytics and metrics about your calls
  - name: Knowledge Bases
    description: >-
      Manage knowledge bases and sources for agent retrieval-augmented
      generation
  - name: Test Suites
    description: Manage test suites, test cases, and test runs for agent evaluation
  - name: Voices
    description: Browse the voices available to your organization for agent speech
  - name: Webhooks
    description: Webhook delivery settings for your organization
paths:
  /sip-trunks/connect/twilio:
    post:
      tags:
        - SIP Trunks
      summary: Connect Twilio
      description: >-
        Connects Twilio numbers in one step: creates an Elastic SIP trunk in
        your Twilio account with origination to sip.revring.ai and a fresh
        termination credential, moves the chosen numbers onto it, and creates
        the matching RevRing trunk. With agentId, the numbers are also assigned
        to that agent for inbound calls (and the trunk becomes its outbound
        trunk if it has none). If any step fails, everything created in Twilio
        is removed and your numbers keep their current routing.
      operationId: connectTwilio
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - twilio
                - numbers
              properties:
                twilio:
                  type: object
                  required:
                    - accountSid
                  description: >-
                    Your Twilio account credentials. Used for this request only
                    and never stored. Provide authToken, or apiKeySid with
                    apiKeySecret.
                  properties:
                    accountSid:
                      type: string
                      example: ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                      description: Twilio Account SID (AC...)
                    authToken:
                      type: string
                      description: Twilio Auth Token
                    apiKeySid:
                      type: string
                      description: Twilio API key SID (SK...), instead of the Auth Token
                    apiKeySecret:
                      type: string
                      description: Secret of the API key
                numbers:
                  type: array
                  minItems: 1
                  maxItems: 50
                  items:
                    type: string
                    example: '+14155550123'
                  description: E.164 numbers on the Twilio account to connect
                agentId:
                  type: string
                  description: Agent that answers these numbers
                friendlyName:
                  type: string
                  maxLength: 128
                  default: Twilio (connected)
                  description: Name of the RevRing trunk
      responses:
        '201':
          description: Connected
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      trunk:
                        type: object
                        description: The RevRing SIP trunk, as returned by Get SIP Trunk
                      twilio:
                        type: object
                        properties:
                          trunkSid:
                            type: string
                            example: TKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                          domainName:
                            type: string
                            example: revring-ab12cd34ef.pstn.twilio.com
                          originationUri:
                            type: string
                            example: sip:sip.revring.ai
                      numbers:
                        type: array
                        items:
                          type: object
                          properties:
                            e164:
                              type: string
                            previousRouting:
                              type: string
                              example: voice webhook example.com
                      agent:
                        type: object
                        properties:
                          id:
                            type: string
                          numbers:
                            type: array
                            items:
                              type: string
        '400':
          description: >-
            Invalid body, a number that cannot take voice calls
            (number_not_voice_capable), or rejected credentials
            (invalid_twilio_credentials)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
        '404':
          description: >-
            A number is not on this Twilio account (twilio_number_not_found), or
            agent_not_found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
        '409':
          description: A number is already on a RevRing trunk (number_in_use)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
        '502':
          description: >-
            Twilio could not complete the setup; nothing was left behind in your
            account
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. Generate API keys from the RevRing
        dashboard.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.