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

# Import phone numbers

> Imports phone numbers from Twilio into the system for use with agents.
Attaches each number to the provider's SIP trunk and creates local records for call routing.
Supports partial success - continues importing remaining numbers if some fail.

## Import Process

For each phone number SID provided:

1. Validates the SID exists in your Twilio account
2. Checks for duplicate imports (already imported numbers are skipped with error)
3. Attaches the phone number to the provider's SIP trunk in Twilio
4. Creates a local phone number record linked to the provider

## Partial Success

The import operation continues even if some numbers fail. The response includes:

| Field            | Description                                   |
| ---------------- | --------------------------------------------- |
| **successCount** | Number of successfully imported phone numbers |
| **failedCount**  | Number of phone numbers that failed to import |
| **errors**       | Detailed error information for each failure   |

## Common Errors

| Error                       | Cause                                                  |
| --------------------------- | ------------------------------------------------------ |
| **Not found**               | Phone number SID doesn't exist in Twilio account       |
| **Already imported**        | Phone number was previously imported for this provider |
| **Trunk attachment failed** | Twilio API error when attaching to trunk               |

## After Import

Imported phone numbers can be:

* Listed via the phone numbers API
* Linked to agents for inbound call handling
* Used for outbound call caller ID


## OpenAPI

````yaml https://blackbox.dasha.ai/swagger/v1/swagger.json post /api/v1/providers/twilio/{id}/import-numbers
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/{id}/import-numbers:
    post:
      tags:
        - TwilioProvider
      summary: Import phone numbers
      description: >-
        Imports phone numbers from Twilio into the system for use with agents.

        Attaches each number to the provider's SIP trunk and creates local
        records for call routing.

        Supports partial success - continues importing remaining numbers if some
        fail.
      parameters:
        - name: id
          in: path
          description: Provider identifier
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: Phone number SIDs to import
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/ImportPhoneNumbersRequestDto'
              description: >-
                Request DTO for importing phone numbers from a Twilio account
                into the system.

                Specifies which phone numbers to import by their Twilio Phone
                Number SIDs.
          text/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/ImportPhoneNumbersRequestDto'
              description: >-
                Request DTO for importing phone numbers from a Twilio account
                into the system.

                Specifies which phone numbers to import by their Twilio Phone
                Number SIDs.
          application/*+json:
            schema:
              allOf:
                - $ref: '#/components/schemas/ImportPhoneNumbersRequestDto'
              description: >-
                Request DTO for importing phone numbers from a Twilio account
                into the system.

                Specifies which phone numbers to import by their Twilio Phone
                Number SIDs.
      responses:
        '200':
          description: >-
            Import completed with detailed results (may include partial
            failures)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportResultDto'
        '400':
          description: Invalid request or validation errors
          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'
        '404':
          description: Provider with specified ID does not exist in your organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Server error occurred during import
components:
  schemas:
    ImportPhoneNumbersRequestDto:
      required:
        - phoneNumberSids
      type: object
      properties:
        phoneNumberSids:
          type: array
          items:
            type: string
          description: >-
            List of Twilio Phone Number SIDs to import. Each SID must be a valid
            Twilio Phone Number SID

            starting with 'PN' followed by 32 lowercase hexadecimal characters.

            Format: PN[a-f0-9]{32} (e.g., PNxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx).
      additionalProperties: false
      description: >-
        Request DTO for importing phone numbers from a Twilio account into the
        system.

        Specifies which phone numbers to import by their Twilio Phone Number
        SIDs.
    ImportResultDto:
      type: object
      properties:
        successCount:
          type: integer
          description: Number of phone numbers successfully imported into the system.
          format: int32
        failedCount:
          type: integer
          description: Number of phone numbers that failed to import.
          format: int32
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ImportErrorDto'
          description: >-
            Detailed error information for each phone number that failed to
            import.

            Empty if all phone numbers were imported successfully.
          nullable: true
      additionalProperties: false
      description: >-
        Result of a phone number import operation. Contains counts of
        successfully imported

        and failed phone numbers, along with detailed error information for any
        failures.
    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: {}
    ImportErrorDto:
      required:
        - errorMessage
        - phoneNumberSid
      type: object
      properties:
        phoneNumberSid:
          type: string
          description: |-
            Twilio Phone Number SID that failed to import.
            Format: PN[a-f0-9]{32} (e.g., PNxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx).
          nullable: true
        errorMessage:
          type: string
          description: >-
            Human-readable error message describing why the phone number failed
            to import.

            May include details about API errors, validation failures, or
            configuration issues.
          nullable: true
      additionalProperties: false
      description: >-
        Error details for a phone number that failed to import. Contains the
        phone number SID

        that failed and a human-readable error message describing why the import
        failed.
  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

````