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

# Purchase a phone number

> Starts a Mobilerun Phone purchase for the authenticated owner. Accepted requests always return the same asynchronous envelope; poll GET /numbers/phones/{id} for its business state. `purpose` and `country` are mutually exclusive.



## OpenAPI

````yaml /api-reference/mobilerun-numbers.yaml post /numbers/phones
openapi: 3.1.0
info:
  title: Mobilerun Numbers
  version: v1
servers:
  - url: https://api.mobilerun.ai
    description: Droidrun Cloud API
security:
  - bearerAuth: []
paths:
  /numbers/phones:
    post:
      tags:
        - Numbers
      summary: Purchase a phone number
      description: >-
        Starts a Mobilerun Phone purchase for the authenticated owner. Accepted
        requests always return the same asynchronous envelope; poll GET
        /numbers/phones/{id} for its business state. `purpose` and `country` are
        mutually exclusive.
      operationId: purchaseNumber
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 128
            description: Optional request idempotency key.
          required: false
          description: Optional request idempotency key.
          name: Idempotency-Key
          in: header
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublicPhonePurchaseInput'
      responses:
        '202':
          description: Number purchase accepted — poll GET /numbers/phones/{id}
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/PurchaseAcceptedResponse'
                required:
                  - data
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
        '409':
          description: Purchase in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicPhonePurchaseError'
        '422':
          description: Unsupported purpose or country
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicPhonePurchaseError'
        '500':
          description: Internal Server Error
        '503':
          description: Purchase unavailable
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/PublicPhonePurchaseError'
                  - $ref: '#/components/schemas/NumberErrorResponse'
components:
  schemas:
    PublicPhonePurchaseInput:
      type: object
      properties:
        purpose:
          type: string
          minLength: 1
          maxLength: 96
          example: telegram
          description: Optional Mobilerun Phone purpose slug from GET /numbers/purposes.
        country:
          type: string
          minLength: 2
          maxLength: 2
          pattern: ^[a-z]{2}$
          example: de
          description: >-
            Optional ISO 3166-1 alpha-2 country code from GET
            /numbers/countries. Cannot be combined with `purpose`.
        billingPreference:
          type: string
          enum:
            - included
            - rent
          description: >-
            Prefer a free package seat ('included', default) or force the paid
            checkout ('rent')
      additionalProperties: false
    PurchaseAcceptedResponse:
      type: object
      properties:
        numberId:
          type: string
          format: uuid
        state:
          type: string
          enum:
            - awaiting_payment
            - provisioning
        checkoutUrl:
          type:
            - string
            - 'null'
      required:
        - numberId
        - state
        - checkoutUrl
    PublicPhonePurchaseError:
      type: object
      properties:
        reason:
          type: string
          enum:
            - purchase_in_progress
            - unsupported_purpose
            - unsupported_country
            - unavailable
        message:
          type: string
      required:
        - reason
        - message
    NumberErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        reason:
          type: string
          enum:
            - product_disabled
            - not_cancellable
        message:
          type: string
      required:
        - success
        - reason
        - message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Opaque
      description: Bearer token via Authorization header

````