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

# Buy a phone number

> Purchase a phone number in the requested area code.



## OpenAPI

````yaml /api-reference/public/openapi.yaml post /beta/phone-numbers
openapi: 3.0.3
info:
  description: >
    HTTP API for integrating with Atonom.


    **This surface is in beta.** Paths, schemas, and behavior may change without
    a

    stable compatibility guarantee. Current product routes use the **/beta**
    prefix

    (for example **/beta/phone-numbers**).


    ## Authentication


    Send your API key on every secured request using the **X-Api-Key** header.

    To get an API key, visit [the API keys
    page](https://app.atonom.ai/#/settings/v2/api_keys).


    ## Errors


    Failures use [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem
    details

    (**application/problem+json**) with an HTTP status that matches the problem.
  title: Atonom Public API
  version: 1.0.0
servers:
  - description: API server
    url: '{API_URL}'
    variables:
      API_URL:
        default: https://api.atonom.ai
        description: Base URL of the API. Override with the API_URL environment variable.
security: []
paths:
  /beta/phone-numbers:
    post:
      tags:
        - /beta/phone-numbers
      summary: Buy a phone number
      description: Purchase a phone number in the requested area code.
      operationId: Beta_createPhoneNumber
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BetaPhoneNumbersCreatePhoneNumberRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaPhoneNumbersPhoneNumber'
          description: Created
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
        - apiKey: []
components:
  schemas:
    BetaPhoneNumbersCreatePhoneNumberRequest:
      additionalProperties: false
      properties:
        area_code:
          description: NANP area code to search when buying.
          example: '415'
          type: string
        inbound_cloud_employee_id:
          description: Cloud employee handling inbound calls.
          example: 1001
          format: int64
          type: integer
        name:
          description: Display name for the new phone number.
          example: Overflow line
          type: string
        outbound_cloud_employee_id:
          description: Cloud employee handling outbound calls.
          example: 1001
          format: int64
          type: integer
      required:
        - name
        - area_code
      type: object
    BetaPhoneNumbersPhoneNumber:
      additionalProperties: false
      properties:
        area_code:
          description: NANP area code.
          example: '555'
          type: string
        e164:
          description: Phone number in E.164 format.
          example: '+15551234567'
          readOnly: true
          type: string
        id:
          description: Stable identifier of the phone number.
          example: 2001
          format: int64
          readOnly: true
          type: integer
        inbound_cloud_employee_id:
          description: Cloud employee handling inbound calls.
          example: 1001
          format: int64
          type: integer
        name:
          description: Display name of the phone number.
          example: Main line
          type: string
        outbound_cloud_employee_id:
          description: Cloud employee handling outbound calls.
          example: 1001
          format: int64
          type: integer
      required:
        - id
        - name
        - e164
        - area_code
      type: object
    ErrorModel:
      additionalProperties: false
      properties:
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          example: Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          nullable: true
          type: array
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          example: https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          example: 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          example: Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          example: https://example.com/errors/example
          format: uri
          type: string
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
  securitySchemes:
    apiKey:
      description: >-
        API key sent in the X-Api-Key header. Generate an API key from
        https://app.atonom.ai/#/settings/v2/api_keys.
      in: header
      name: X-Api-Key
      type: apiKey

````

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