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

# Purchase a workspace phone number

> Assigns an existing paid rental to a number using country and phoneNumber. New purchases should use owner-session POST /billing/checkout with kind=phone, country=US and phoneNumber. Inventory costs are resolved privately. Poll the operation; an unknown outcome must not be reordered. Required scope: numbers:provision.



## OpenAPI

````yaml /openapi.json post /phone-numbers
openapi: 3.1.0
info:
  title: Papers API
  version: 0.1.0
  description: >-
    Email, SMS, and workspace resources for Papers. Authenticate resource
    requests with a scoped API key or OAuth token. Administrative endpoints
    require a human session.
servers:
  - url: https://www.papers.bot/v1
security:
  - bearerAuth: []
paths:
  /phone-numbers:
    post:
      tags:
        - Phone numbers
      summary: Purchase a workspace phone number
      description: >-
        Assigns an existing paid rental to a number using country and
        phoneNumber. New purchases should use owner-session POST
        /billing/checkout with kind=phone, country=US and phoneNumber. Inventory
        costs are resolved privately. Poll the operation; an unknown outcome
        must not be reordered. Required scope: numbers:provision.
      operationId: provisionPhoneNumber
      parameters:
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 200
          description: >-
            Reuse for the same logical action and identical body; changed input
            returns 409.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $schema: https://json-schema.org/draft/2020-12/schema
              type: object
              properties:
                country:
                  type: string
                  pattern: ^[A-Z]{2}$
                monthlyCost:
                  default: '3.00'
                  type: string
                  pattern: ^\d+(\.\d+)?$
                upfrontCost:
                  default: '0.00'
                  type: string
                  pattern: ^\d+(\.\d+)?$
                currency:
                  default: USD
                  type: string
                  pattern: ^[A-Z]{3}$
                phoneNumber:
                  type: string
                  pattern: ^\+[1-9]\d{6,14}$
                agentId:
                  type: string
                  minLength: 1
              required:
                - country
                - phoneNumber
      responses:
        '200':
          description: Successful JSON response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NumberOperation'
        '202':
          description: >-
            Operation pending or outcome unknown; poll the returned statusUrl.
            Do not submit a new idempotency key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NumberOperation'
        '429':
          description: >-
            Request rate limit or communication quota exceeded. Rate-limit
            responses include Retry-After.
          headers:
            Retry-After:
              description: >-
                Seconds until the request-rate window resets (rate_limited
                errors)
              schema:
                type: integer
                minimum: 1
                maximum: 60
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        default:
          description: Request rejected
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    NumberOperation:
      $schema: https://json-schema.org/draft/2020-12/schema
      type: object
      properties:
        id:
          type: string
          minLength: 1
        status:
          type: string
          enum:
            - pending
            - unknown
            - completed
            - failed
          description: >-
            Operation state. Completed sends mean provider acceptance, not
            recipient delivery. Poll pending or unknown operations; do not
            resend with a new key.
        numberId:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
        error:
          type:
            - string
            - 'null'
        statusUrl:
          type: string
      required:
        - id
        - status
        - numberId
        - error
        - statusUrl
      additionalProperties: false
    Error:
      $schema: https://json-schema.org/draft/2020-12/schema
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            request_id:
              type: string
            retryable:
              type: boolean
            details:
              anyOf:
                - type: object
                  properties:
                    approvalId:
                      type: string
                      minLength: 1
                  required:
                    - approvalId
                  additionalProperties: false
                - type: array
                  items:
                    type: object
                    properties:
                      code:
                        type: string
                      path:
                        type: array
                        items:
                          type:
                            - string
                            - number
                      message:
                        type: string
                    required:
                      - code
                      - path
                      - message
                    additionalProperties: false
          required:
            - code
            - message
            - request_id
            - retryable
          additionalProperties: false
      required:
        - error
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Workspace API key or delegated OAuth access token with /v1 resource
        audience. Administrative routes require the Better Auth browser session
        instead.

````

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