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

# Create Twilio provider

> Creates a new Twilio provider integration with automatic SIP trunk configuration.
Validates credentials with Twilio, creates a SIP trunk, sets up credential lists,
and generates SIP credentials for call routing. All credentials are encrypted before storage.

## Automatic SIP Trunk Setup

When you create a Twilio provider, the following resources are automatically configured:

1. **SIP Trunk**: A new trunk is created in your Twilio account with termination URI
2. **Credential List**: A credential list is created and attached to the trunk
3. **SIP Credentials**: Username/password credentials are generated for call authentication
4. **Local Records**: Provider and SIP credentials are stored securely in your organization

## Credential Requirements

Your Twilio credentials must have the following permissions:

* Read access to account information
* Create/manage SIP trunking resources
* Create/manage credential lists
* Read incoming phone numbers

## Security

* Auth Token is encrypted before storage
* Account SID is stored as plain text (it's a non-sensitive identifier)
* Auth Token is never exposed in API responses
* SIP passwords are randomly generated (32 characters)

## After Creation

Once the provider is created:

1. Use the `/available-numbers` endpoint to see phone numbers in your Twilio account
2. Import desired phone numbers using the `/import-numbers` endpoint
3. Link imported phone numbers to agents for call handling


## OpenAPI

````yaml https://blackbox.dasha.ai/swagger/v1/swagger.json post /api/v1/providers/twilio
openapi: 3.0.4
info:
  title: Dasha BlackBox Agent API
  description: API for managing AI agents and calls
  contact:
    name: DashaAI Team
    email: support@dasha.ai
  version: v1
servers:
  - url: https://blackbox.dasha.ai
    description: Dasha BlackBox Agent API
security:
  - ApiKey: []
  - OAuth: []
tags:
  - name: ActivityLogs
  - name: Agents
  - name: AgentTestCases
  - name: CallResults
  - name: Calls
  - name: Chats
  - name: Copilot
  - name: CustomerData
  - name: Mcp
  - name: Media
  - name: Misc
  - name: PronunciationDictionaries
  - name: Providers
  - name: SipAliases
  - name: SipCredentials
  - name: SipPhoneNumbers
  - name: TextChat
  - name: TwilioProvider
  - name: Voice
  - name: WebhookTest
  - name: WebIntegrations
  - name: WebSocket
    description: WebSocket endpoints for real-time communication
paths:
  /api/v1/providers/twilio:
    post:
      tags:
        - TwilioProvider
      summary: Create Twilio provider
      description: >-
        Creates a new Twilio provider integration with automatic SIP trunk
        configuration.

        Validates credentials with Twilio, creates a SIP trunk, sets up
        credential lists,

        and generates SIP credentials for call routing. All credentials are
        encrypted before storage.
      requestBody:
        description: Twilio provider configuration including Account SID and Auth Token
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/CreateTwilioProviderRequestDto'
              description: >-
                Request DTO for creating a new Twilio provider integration.
                Contains required Twilio API credentials

                and optional configuration settings for the SIP trunk setup.
          text/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/CreateTwilioProviderRequestDto'
              description: >-
                Request DTO for creating a new Twilio provider integration.
                Contains required Twilio API credentials

                and optional configuration settings for the SIP trunk setup.
          application/*+json:
            schema:
              allOf:
                - $ref: '#/components/schemas/CreateTwilioProviderRequestDto'
              description: >-
                Request DTO for creating a new Twilio provider integration.
                Contains required Twilio API credentials

                and optional configuration settings for the SIP trunk setup.
      responses:
        '201':
          description: Twilio provider created successfully with SIP trunk configured
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/TwilioProviderResponseDto'
                description: >-
                  Response DTO for Twilio provider integrations. Contains
                  Twilio-specific configuration details

                  including account identifier, SIP trunk configuration, and
                  regional settings. AuthToken is

                  intentionally excluded from responses for security.
        '400':
          description: >-
            Invalid configuration, validation errors, or Twilio credentials
            rejected
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Authentication failed or API key is missing
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Access denied to the requested resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Server error occurred during provider creation
components:
  schemas:
    CreateTwilioProviderRequestDto:
      required:
        - accountSid
        - authToken
        - name
      type: object
      properties:
        accountSid:
          minLength: 1
          type: string
          description: >-
            Twilio Account SID for API authentication. Must be exactly 34
            characters starting with 'AC'

            followed by 32 lowercase hexadecimal characters. Found in the Twilio
            Console dashboard.

            Format: AC[a-f0-9]{32} (e.g., ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx).
        authToken:
          minLength: 1
          type: string
          description: >-
            Twilio Auth Token for API authentication. Must be exactly 32
            lowercase hexadecimal characters.

            Found in the Twilio Console dashboard under Account Settings.

            Format: [a-f0-9]{32}.
        name:
          maxLength: 100
          minLength: 1
          type: string
          description: >-
            Display name for the provider integration. Used to identify the
            provider in the UI and API responses.
        region:
          type: string
          description: >-
            Twilio region for SIP trunk configuration. Affects call routing
            latency and regional compliance.

            If not specified, defaults to the closest available region.

            Common values: us1, us2, ie1, de1, au1, jp1, br1, sg1.
          nullable: true
        supportsCallTransfer:
          type: boolean
          description: >-
            Whether to enable call transfer support. When enabled, allows warm
            and cold transfers during calls.

            Requires proper Twilio account configuration and sufficient
            permissions. Defaults to false.
      additionalProperties: false
      description: >-
        Request DTO for creating a new Twilio provider integration. Contains
        required Twilio API credentials

        and optional configuration settings for the SIP trunk setup.
    TwilioProviderResponseDto:
      allOf:
        - $ref: '#/components/schemas/ProviderResponseDto'
        - required:
            - accountSid
            - providerType
          type: object
          properties:
            providerType:
              enum:
                - twilio
              type: string
              description: Type of VoIP provider. Always returns Twilio for this DTO.
              readOnly: true
            accountSid:
              minLength: 1
              type: string
              description: >-
                Twilio Account SID. A unique identifier for the Twilio account
                associated with this provider.

                Format: AC[a-f0-9]{32} (e.g.,
                ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx).
            trunkSid:
              type: string
              description: >-
                Twilio SIP Trunk SID. The unique identifier for the SIP trunk
                created in Twilio for this provider.

                Format: TK[a-f0-9]{32} (e.g.,
                TKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx).
              nullable: true
            terminationUri:
              type: string
              description: >-
                SIP trunk termination URI configured for this provider. Used for
                routing outbound calls through Twilio.

                Format: sip:<trunk-name>.pstn.twilio.com
              nullable: true
            region:
              type: string
              description: >-
                Twilio region where the SIP trunk is configured. Affects call
                routing latency and regional compliance.

                Common values: us1, us2, ie1, de1, au1, jp1, br1, sg1.
              nullable: true
            supportsCallTransfer:
              type: boolean
              description: >-
                Whether the provider supports call transfers. When enabled,
                allows warm and cold transfers during calls.

                Requires proper Twilio account configuration and sufficient
                permissions.
          additionalProperties: false
      description: >-
        Response DTO for Twilio provider integrations. Contains Twilio-specific
        configuration details

        including account identifier, SIP trunk configuration, and regional
        settings. AuthToken is

        intentionally excluded from responses for security.
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
      additionalProperties: {}
    ProviderResponseDto:
      required:
        - name
        - providerType
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the provider integration.
          format: uuid
        name:
          type: string
          description: >-
            Display name for the provider integration. Used to identify the
            provider in the UI and API responses.
          nullable: true
        providerType:
          allOf:
            - $ref: '#/components/schemas/ProviderType'
          description: >-
            Type of VoIP provider. Determines the specific provider
            implementation and available features.

            Supported values: twilio, vonage, telnyx.
          readOnly: true
        verificationStatus:
          allOf:
            - $ref: '#/components/schemas/VerificationStatus'
          description: >-
            Current verification status of the provider credentials. Indicates
            the health and validity of the integration.

            Supported values: pending, verified, warning, failed.
        lastVerifiedAt:
          type: string
          description: >-
            Timestamp when the provider credentials were last verified. Null if
            verification has never been performed.
          format: date-time
          nullable: true
        phoneNumberCount:
          type: integer
          description: >-
            Total number of phone numbers currently imported and managed through
            this provider integration.
          format: int32
        verificationDetails:
          type: array
          items:
            $ref: '#/components/schemas/VerificationCheckDto'
          description: >-
            Detailed results of the last verification. Contains individual check
            results with status, messages, and timestamps.

            Null if verification has never been performed.
          nullable: true
      additionalProperties: false
      description: >-
        Base response DTO for VoIP provider integrations. Contains common
        provider information

        shared across all provider types including identification, verification
        status, and phone number counts.

        Uses polymorphic serialization with providerType discriminator to
        support different provider implementations.
    ProviderType:
      enum:
        - twilio
        - vonage
        - telnyx
      type: string
      description: >-
        Type of VoIP provider integration. Determines the specific provider
        implementation and API interactions.
    VerificationStatus:
      enum:
        - pending
        - verified
        - warning
        - failed
      type: string
      description: >-
        Status of provider credential verification. Indicates the current health
        and validity of the provider integration.
    VerificationCheckDto:
      required:
        - checkName
        - message
      type: object
      properties:
        checkName:
          type: string
          description: >-
            Name of the verification check that was performed.

            Common values: credentials, api_connectivity, sip_trunk,
            phone_numbers.
          nullable: true
        status:
          allOf:
            - $ref: '#/components/schemas/CheckStatus'
          description: >-
            Status indicating whether the check passed, failed, or raised a
            warning.

            Supported values: passed, failed, warning.
        message:
          type: string
          description: >-
            Human-readable message describing the check result. Provides context
            about

            what was verified and any issues encountered.
          nullable: true
        timestamp:
          type: string
          description: Timestamp when the check was performed. Recorded in UTC.
          format: date-time
        details:
          type: object
          additionalProperties:
            type: string
          description: >-
            Additional details about the check result as key-value pairs.

            Can contain provider-specific information such as error codes or
            configuration details.
          nullable: true
      additionalProperties: false
      description: >-
        DTO representing the result of an individual verification check for a
        provider.

        Contains details about what was checked, the outcome, and any additional
        context.
    CheckStatus:
      enum:
        - passed
        - failed
        - warning
      type: string
      description: >-
        Status of an individual verification check. Indicates whether a specific
        verification check passed, failed, or raised a warning.
  securitySchemes:
    ApiKey:
      type: http
      description: API Key Authentication (Bearer {key})
      scheme: Bearer
    OAuth:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://auth.dasha.ai/connect/authorize
          scopes:
            platform_api: Platform API

````