Skip to main content
POST
JavaScript

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Input for buying a phone number

e164
string

The number to buy, in E.164 format, from a search result. Give this or autoPick.

Pattern: ^\+[1-9]\d{1,14}$
Example:

"+14155550123"

autoPick
object

Let Roark pick a matching number instead of naming one. Give this or e164.

country
enum<string>

The country of the number given by e164 (default: US). An auto-picked number uses autoPick.country.

Available options:
US,
CA
Example:

"US"

name
string

A label for the number

Required string length: 1 - 80
agentId
string<uuid>

The agent to assign the number to

expectFree
boolean

Whether you expect this number to be free (from the allowance). The purchase is refused with 409 if that has changed since you checked.

expectMonthlyRentMicros
integer

The monthly rent you expect for a paid number, in micros (from the allowance). The purchase is refused with 409 if that has changed since you checked.

Required range: x >= 0
Example:

2000000

Response

The purchased phone number

data
object
required

A phone number the project owns