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

# Twilio Buy Number

> Buys a Twilio number using provided credentials, phone number and optional friendly name.



## OpenAPI

````yaml POST /twilio/buy/number/
openapi: 3.1.0
info:
  title: CloserX.ai API
  description: >-
    The CloserX.ai API provides programmatic access to manage AI-powered calling
    operations, including agent creation, campaign management, contact handling,
    telephony integration, and more. This API enables seamless automation and
    integration with CRM systems, telephony providers, and other third-party
    services for enhanced client communication and business operations.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://app.closerx.ai/api
security:
  - api_key: []
paths:
  /twilio/buy/number/:
    post:
      summary: Twilio Buy Number
      description: >-
        Buys a Twilio number using provided credentials, phone number and
        optional friendly name.
      parameters:
        - name: Company-Name
          in: header
          required: true
          description: Schema name for multi-tenancy
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TwilioBuyNumberRequest'
      responses:
        '200':
          description: Contact number added successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TwilioBuyNumberResponse'
              example:
                success: true
                message: contact number added
                data: {}
        '400':
          description: Invalid SID, token, or phone number
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    TwilioBuyNumberRequest:
      type: object
      required:
        - twilio_sid
        - auth_token
        - phone_number
        - friendly_name
        - new_number
      properties:
        twilio_sid:
          type: string
          description: Twilio account SID used to authenticate.
        auth_token:
          type: string
          description: Twilio Auth Token for the given SID.
        phone_number:
          type: string
          description: The Twilio phone number to be purchased.
          example: '+12154346029'
        friendly_name:
          type: string
          description: Custom nickname for the phone number.
          example: ttesting
        new_number:
          type: boolean
          description: Flag indicating if a new number is being purchased.
    TwilioBuyNumberResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: contact number added
        data:
          type: object
          description: Contains additional data if any
    Error:
      required:
        - success
        - message
        - data
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
        data:
          type: object
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: api_key

````