Skip to main content
POST
Purchase Phone Number

Authorizations

Authorization
string
header
required

Your API key sent as a Bearer credential — Authorization: Bearer <api_key>, where <api_key> starts with oi_sk_ (create one via POST /v1/api-keys). Although the field is labelled 'token', paste your API key here. A dashboard JWT is also accepted on this header for the same endpoints.

Body

application/json

Buy a number through OneInbox. The carrier (Twilio today) is an internal implementation detail — the caller never supplies provider creds or trunk config; the number is bought on OneInbox's own account and wired automatically.

Either pass a specific phone_number from GET /phone-numbers/search, or leave it out and give search filters (country / area_code / contains) to auto-pick the first available match.

agent_id
string<uuid>
required
phone_number
string | null

A specific number from /phone-numbers/search. Omit to auto-pick.

Pattern: ^\+[1-9]\d{1,14}$
country
string
default:US
Required string length: 2
area_code
string | null

Area code (US/CA only)

contains
string | null

Digits/letters to match

friendly_name
string | null
inbound_routing
InboundRouting · object | null

Per-number routing override. Stored as JSONB so we can extend with business-hours and caller-id rules later without a schema change.

Response

Successful Response

id
string
required
phone_number
string
required
friendly_name
string | null
required
provider
string
required
agent_id
string
required
status
string
required
inbound_trunk_id
string | null
required
outbound_trunk_id
string | null
required
dispatch_rule_id
string | null
required
created_at
string<date-time>
required
updated_at
string<date-time>
required
inbound_routing
InboundRouting · object | null

Per-number routing override. Stored as JSONB so we can extend with business-hours and caller-id rules later without a schema change.

sms_capable
boolean | null