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

# Create a phone number

> Creates a phone number of various types (purchase, SIP import, or Vogent SIP).



## OpenAPI

````yaml post /phone_numbers
openapi: 3.0.3
info:
  title: Vogent - OpenAPI 3.0
  description: Test Description
  version: 1.0.11
servers:
  - url: https://api.vogent.ai/api
security:
  - bearerAuth: []
paths:
  /phone_numbers:
    post:
      summary: Create a phone number
      description: >-
        Creates a phone number of various types (purchase, SIP import, or Vogent
        SIP).
      operationId: createPhoneNumber
      requestBody:
        description: Create a new phone number
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePhoneNumberInput'
        required: true
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhoneNumber'
        '400':
          description: Invalid input
        '422':
          description: Validation exception
components:
  schemas:
    CreatePhoneNumberInput:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/CreatePhoneNumberType'
          description: The type of phone number creation operation.
        purchase:
          $ref: '#/components/schemas/CreatePhoneNumberPurchaseInput'
          description: Required when type is 'purchase'.
          nullable: true
        sipImport:
          $ref: '#/components/schemas/CreatePhoneNumberSIPImportInput'
          description: Required when type is 'sip_import'.
          nullable: true
        vogentSip:
          $ref: '#/components/schemas/CreatePhoneNumberVogentSIPInput'
          description: Required when type is 'vogent_sip'.
          nullable: true
      required:
        - type
    PhoneNumber:
      type: object
      properties:
        id:
          type: string
        number:
          type: string
          example: '+18001234567'
          description: >-
            The number in e.164 format, or the SIP username, if the type is
            SIP_USERNAME.
        type:
          $ref: '#/components/schemas/PhoneNumberType'
        agentId:
          type: string
          nullable: true
          description: The ID of the linked agent, if the phone number is linked to one.
      required:
        - id
        - number
        - agentId
        - type
    CreatePhoneNumberType:
      type: string
      enum:
        - purchase
        - sip_import
        - vogent_sip
      description: The type of phone number creation operation.
      nullable: false
    CreatePhoneNumberPurchaseInput:
      type: object
      properties:
        number:
          type: string
          description: The number as returned by the phone number search endpoint.
          nullable: false
      required:
        - number
    CreatePhoneNumberSIPImportInput:
      type: object
      properties:
        phoneNumber:
          type: string
          description: The phone number in E.164 format.
          nullable: false
        terminationUri:
          type: string
          description: The termination URI for the SIP trunk.
          nullable: false
        username:
          type: string
          description: The username for SIP authentication.
          nullable: false
        password:
          type: string
          description: The password for SIP authentication.
          nullable: false
      required:
        - phoneNumber
        - terminationUri
        - username
        - password
    CreatePhoneNumberVogentSIPInput:
      type: object
      properties:
        sipPrefix:
          type: string
          description: The SIP prefix/username.
          nullable: false
        username:
          type: string
          description: The username for SIP authentication (minimum 5 characters).
          nullable: false
        password:
          type: string
          description: The password for SIP authentication (minimum 5 characters).
          nullable: false
      required:
        - sipPrefix
        - username
        - password
    PhoneNumberType:
      type: string
      enum:
        - PSTN
        - SIP_USERNAME
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        In the form `Bearer <api_key_here>`. You can find your api key in your
        dashboard.

````