Skip to main content
POST
Buy a phone number

Authorizations

Authorization
string
header
required

Enter your API key (Bearer token)

Headers

Idempotency-Key
string
required

Required. Send the same key when you retry this purchase; you get the same number back and are never charged twice.

Query Parameters

wait
integer
default:0

Seconds to wait for the purchase to finish before answering, at most 30.

Required range: 0 <= x <= 30

Body

application/json
accept_monthly_price
number
required

The monthly_price the owner agreed to, exactly as search returned it (0 inside the plan allowance). A different current price returns price_not_accepted.

Required range: x >= 0
phone_number
string
required

A number from search_available_phone_numbers, in E.164 form.

Pattern: ^\+[1-9]\d{6,14}$
agent_id
string<uuid>

Answer calls to the number with this agent as soon as it is bought.

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$

Response

agent_id
string | null
required
created_at
string
required
currency
string | null
required
failure
object | null
required

Why a failed purchase failed. Null unless status is failed.

id
string
required

Stable from the first response: the purchase id becomes the number id.

imported
boolean
required
managed_by_plan
boolean
required

Part of an Agent Phone Plan: give it up by cancelling the plan.

monthly_price
number | null
required
phone_number
string
required
refunded
boolean
required

A failed purchase whose payment was refunded in full.

release_at
string | null
required

When a releasing number goes away. PATCH release_at null to keep it.

revision
string | null
required
status
enum<string>
required

released only answers the release of an imported number, which is removed at once.

Available options:
provisioning,
active,
releasing,
failed,
released
next_action
object
try_it
object

Ways to hear the agent on this number, as on agent writes.

warnings
object[]