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

# Import Twilio Phone Number

> Imports a phone number of your own Twilio account. Send in the body its number in E.164 format (for example `+14155550123`) with the same credentials as for listing the numbers: they are checked again, then kept on the imported number, which uses them for its own calls. A verified caller ID is imported for outbound calls only. A number already imported in your account is rejected with a 400 that gives its id.



## OpenAPI

````yaml post /v2/PhoneNumber/Twilio/Import
openapi: 3.0.1
info:
  title: NLPearl Client API
  description: A sample API that demonstrates features in the OpenAPI specification
  version: v2
servers:
  - url: https://api.nlpearl.ai
    description: Production Environement
security:
  - bearer_auth: []
  - oauth2_client_credentials: []
tags:
  - name: Pearl
    description: >-
      Manage your Pearls, the AI agents that handle your inbound and outbound
      calls. Create and configure Pearls, retrieve their details and settings,
      run or pause them, list and bulk-export their calls, monitor calls in
      progress, get analytics, and reset a customer's conversation memory.
paths:
  /v2/PhoneNumber/Twilio/Import:
    post:
      tags:
        - PhoneNumber
      summary: Import Twilio Phone Number
      description: >-
        Imports a phone number of your own Twilio account. Send in the body its
        number in E.164 format (for example `+14155550123`) with the same
        credentials as for listing the numbers: they are checked again, then
        kept on the imported number, which uses them for its own calls. A
        verified caller ID is imported for outbound calls only. A number already
        imported in your account is rejected with a 400 that gives its id.
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/TwilioNumberImportRequestApi'
              description: >-
                The data required to import a phone number of your own Twilio
                account: the credentials of that account and the number to
                import.
          text/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/TwilioNumberImportRequestApi'
              description: >-
                The data required to import a phone number of your own Twilio
                account: the credentials of that account and the number to
                import.
          application/*+json:
            schema:
              allOf:
                - $ref: '#/components/schemas/TwilioNumberImportRequestApi'
              description: >-
                The data required to import a phone number of your own Twilio
                account: the credentials of that account and the number to
                import.
      responses:
        '200':
          description: The imported phone number.
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ClientPhoneNumberViewApi'
            application/json:
              schema:
                $ref: '#/components/schemas/ClientPhoneNumberViewApi'
            text/json:
              schema:
                $ref: '#/components/schemas/ClientPhoneNumberViewApi'
        '400':
          description: Error
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ValidationProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ValidationProblemDetails'
components:
  schemas:
    TwilioNumberImportRequestApi:
      required:
        - accountSid
        - authToken
        - number
      type: object
      properties:
        accountSid:
          minLength: 1
          type: string
          description: The Account SID of your Twilio account (starts with `AC`).
        authToken:
          minLength: 1
          type: string
          description: >-
            The Auth Token of your Twilio account, or the API Key Secret when
            `apiKeySid` is provided. The credentials must have full access: a
            Restricted API Key is rejected.
        apiKeySid:
          type: string
          description: >-
            Optional SID of a Standard API Key of your Twilio account (starts
            with `SK`). Leave it empty to authenticate with the Auth Token.
          nullable: true
        number:
          minLength: 1
          type: string
          description: >-
            The phone number to import, in E.164 format (for example
            `+14155550123`), as returned when listing the numbers of the Twilio
            account.
      additionalProperties: false
      description: >-
        The data required to import a phone number of your own Twilio account:
        the credentials of that account and the number to import.
    ClientPhoneNumberViewApi:
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the phone number.
          nullable: true
        number:
          type: string
          description: >-
            The phone number, in E.164 format (a custom VoIP number is returned
            as it was entered).
          nullable: true
        displayName:
          type: string
          description: >-
            The display name of the phone number. Falls back to the raw number
            when no display name is set.
          nullable: true
        direction:
          allOf:
            - $ref: '#/components/schemas/ePhoneNumberDirection'
          description: |+
            Phone number direction (supported call capabilities).

            - InboundOutbound: Supports both inbound and outbound calls.
            - Inbound: Supports inbound calls only.
            - Outbound: Supports outbound calls only.
            - NotSet: Direction is not set.

            `1 - InboundOutbound`

            `2 - Inbound`

            `3 - Outbound`

            `10 - NotSet`

        type:
          allOf:
            - $ref: '#/components/schemas/ePhoneNumberTypeApi'
          description: >+
            Indicates how the phone number is provisioned and connected to
            NLPearl.


            - NLPearlDefault: a shared default number provided by NLPearl.

            - NLPearl: a number purchased and managed for you by NLPearl.

            - Twilio: a number from your own Twilio account that you connected.

            - CustomVoip: a custom VoIP number you connect over SIP.

            - Undefined: the type could not be determined.


            `1 - NLPearlDefault`


            `2 - NLPearl`


            `3 - Twilio`


            `4 - CustomVoip`


            `99 - Undefined`

        sipConfig:
          allOf:
            - $ref: '#/components/schemas/SIPConfigApiView'
          description: >-
            The inbound SIP configuration. Present only for custom VoIP numbers
            that have inbound configured; passwords are never returned.
          nullable: true
        sipTrunkConfig:
          allOf:
            - $ref: '#/components/schemas/SIPTrunkConfigApiView'
          description: >-
            The outbound SIP trunk configuration. Present only for custom VoIP
            numbers that have outbound configured; passwords are never returned.
          nullable: true
      additionalProperties: false
      description: "A phone number of the account as exposed by the API. For custom VoIP numbers it also carries the\r\nconfigured inbound and/or outbound SIP setup (passwords are never returned)."
    ValidationProblemDetails:
      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
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          nullable: true
      additionalProperties: {}
    ePhoneNumberDirection:
      type: integer
      description: |+
        Phone number direction (supported call capabilities).

        - InboundOutbound: Supports both inbound and outbound calls.
        - Inbound: Supports inbound calls only.
        - Outbound: Supports outbound calls only.
        - NotSet: Direction is not set.

        `1 - InboundOutbound`

        `2 - Inbound`

        `3 - Outbound`

        `10 - NotSet`

      format: int32
    ePhoneNumberTypeApi:
      type: integer
      description: |+
        Indicates how the phone number is provisioned and connected to NLPearl.

        - NLPearlDefault: a shared default number provided by NLPearl.
        - NLPearl: a number purchased and managed for you by NLPearl.
        - Twilio: a number from your own Twilio account that you connected.
        - CustomVoip: a custom VoIP number you connect over SIP.
        - Undefined: the type could not be determined.

        `1 - NLPearlDefault`

        `2 - NLPearl`

        `3 - Twilio`

        `4 - CustomVoip`

        `99 - Undefined`

      format: int32
    SIPConfigApiView:
      type: object
      properties:
        domain:
          type: string
          description: >-
            The SIP domain to which inbound traffic for this number must be sent
            (e.g. `{id}-nlpearl-ai.sip.twilio.com`).
          nullable: true
        isTLS:
          type: boolean
          description: Whether inbound SIP traffic uses TLS.
        authMethod:
          allOf:
            - $ref: '#/components/schemas/SipAuthMethodApiView'
          description: >-
            How incoming calls are authenticated (username or IP allowlist).
            Passwords are never returned.
          nullable: true
      additionalProperties: false
      description: >-
        Inbound SIP configuration as returned by the API for a custom VoIP
        number.
    SIPTrunkConfigApiView:
      type: object
      properties:
        sipTrunk:
          type: string
          description: >-
            The host of your SIP trunk (IP address or domain) where outbound
            calls are sent.
          nullable: true
        edge:
          type: string
          description: >-
            The edge location through which outbound calls are sent to your SIP
            trunk, if set.
          nullable: true
        isTLS:
          type: boolean
          description: Whether outbound SIP traffic uses TLS.
        from:
          type: string
          description: >-
            The user part of the originating SIP URI (the caller identity
            presented on outbound calls).
          nullable: true
        isSipRefer:
          type: boolean
          description: Whether call transfers are performed using SIP REFER.
        authMethod:
          allOf:
            - $ref: '#/components/schemas/SipTrunkAuthMethodApiView'
          description: >-
            The outbound trunk authentication (username or custom headers).
            Passwords are never returned.
          nullable: true
      additionalProperties: false
      description: >-
        Outbound SIP trunk configuration as returned by the API for a custom
        VoIP number.
    SipAuthMethodApiView:
      type: object
      properties:
        userNamePassword:
          allOf:
            - $ref: '#/components/schemas/UserNamePasswordApiView'
          description: >-
            The SIP credentials accepted for inbound calls. Only the username is
            returned.
          nullable: true
        ips:
          type: array
          items:
            type: string
          description: Allowlist of source IP addresses authorized to send inbound calls.
          nullable: true
      additionalProperties: false
      description: >-
        Inbound SIP authentication as returned by the API. Passwords are never
        included.
    SipTrunkAuthMethodApiView:
      type: object
      properties:
        userNamePassword:
          allOf:
            - $ref: '#/components/schemas/UserNamePasswordApiView'
          description: >-
            The SIP credentials sent when placing outbound calls. Only the
            username is returned.
          nullable: true
        headers:
          type: object
          additionalProperties:
            type: string
          description: Custom SIP headers added to the outbound INVITE.
          nullable: true
      additionalProperties: false
      description: >-
        Outbound SIP trunk authentication as returned by the API. Passwords are
        never included.
    UserNamePasswordApiView:
      type: object
      properties:
        username:
          type: string
          description: The SIP username.
          nullable: true
      additionalProperties: false
      description: >-
        A SIP username as returned by the API. The password is write-only and is
        never returned.
  securitySchemes:
    bearer_auth:
      type: http
      description: >-
        Specify the authorization token.


        For more information, check out the [Authorization
        Guide](/api-reference/authorization).
      scheme: bearer
    oauth2_client_credentials:
      type: oauth2
      description: >-
        OAuth2 client_credentials grant. Use the Id of an OAuth API key as
        `client_id` and its one-time secret as `client_secret`.
      flows:
        clientCredentials:
          tokenUrl: /oauth/token
          scopes:
            pearls:read: List and view Pearls
            pearls:write: >-
              Create and update Pearls (settings, conversation flows, voices);
              implies pearls:read
            pearls:moderate: Run/pause Pearls and reset customer memory; implies pearls:read
            pearls:analytics: Read Pearl analytics; implies pearls:read
            pearls:leads: Manage and read outbound leads; implies pearls:read
            pearls:calls: >-
              Read calls and recordings, make and delete calls; implies
              pearls:read
            account:phone_numbers: >-
              Read account phone numbers and text channels, manage custom VoIP
              numbers, import Twilio numbers and delete phone numbers
            account:users: Read account users
            account:advanced: Manage advanced account settings (blacklist)
            account:billing: Read account information and credit balance
            account:audit_log: Read the audit log
            tts: Synthesise speech and clone voices

````

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