Skip to main content
POST
/
api
/
v1
/
providers
/
twilio
Create Twilio provider
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    accountSid: '<string>',
    authToken: '<string>',
    name: '<string>',
    region: '<string>',
    supportsCallTransfer: true
  })
};

fetch('https://blackbox.dasha.ai/api/v1/providers/twilio', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "name": "<string>",
  "providerType": "twilio",
  "accountSid": "<string>",
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "verificationStatus": "pending",
  "lastVerifiedAt": "2023-11-07T05:31:56Z",
  "phoneNumberCount": 123,
  "verificationDetails": [
    {
      "checkName": "<string>",
      "message": "<string>",
      "status": "passed",
      "timestamp": "2023-11-07T05:31:56Z",
      "details": {}
    }
  ],
  "trunkSid": "<string>",
  "terminationUri": "<string>",
  "region": "<string>",
  "supportsCallTransfer": true
}

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

Body

Twilio provider configuration including Account SID and Auth Token

Request DTO for creating a new Twilio provider integration. Contains required Twilio API credentials and optional configuration settings for the SIP trunk setup.

accountSid
string
required

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).

Minimum string length: 1
authToken
string
required

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}.

Minimum string length: 1
name
string
required

Display name for the provider integration. Used to identify the provider in the UI and API responses.

Required string length: 1 - 100
region
string | null

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.

supportsCallTransfer
boolean

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.

Response

Twilio provider created successfully with SIP trunk configured

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.

name
string | null
required

Display name for the provider integration. Used to identify the provider in the UI and API responses.

providerType
enum<string>
required

Type of VoIP provider. Always returns Twilio for this DTO.

Available options:
twilio
accountSid
string
required

Twilio Account SID. A unique identifier for the Twilio account associated with this provider. Format: AC[a-f0-9]{32} (e.g., ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx).

Minimum string length: 1
id
string<uuid>

Unique identifier for the provider integration.

verificationStatus
enum<string>

Current verification status of the provider credentials. Indicates the health and validity of the integration. Supported values: pending, verified, warning, failed.

Available options:
pending,
verified,
warning,
failed
lastVerifiedAt
string<date-time> | null

Timestamp when the provider credentials were last verified. Null if verification has never been performed.

phoneNumberCount
integer<int32>

Total number of phone numbers currently imported and managed through this provider integration.

verificationDetails
object[] | null

Detailed results of the last verification. Contains individual check results with status, messages, and timestamps. Null if verification has never been performed.

trunkSid
string | null

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).

terminationUri
string | null

SIP trunk termination URI configured for this provider. Used for routing outbound calls through Twilio. Format: sip:.pstn.twilio.com

region
string | null

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.

supportsCallTransfer
boolean

Whether the provider supports call transfers. When enabled, allows warm and cold transfers during calls. Requires proper Twilio account configuration and sufficient permissions.