Phone Number

Buy a phone number

Changed on

Buys a number from the carrier for this project: the one named by e164, or one Roark picks to match autoPick (trying the next match if the carrier has just sold one). Free inside the plan allowance; past it, the first month of rent is charged now and monthly after that.

post/v1/phone-number

Request

  • Base URL
    https://api.roark.ai
  • URL
    https://api.roark.ai/v1/phone-number
  • Auth
    HTTP bearer

Request body

e164string

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

country'US' | 'CA'

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

namestring

A label for the number

agentIdstring uuid

The agent to assign the number to

expectFreeboolean

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

expectMonthlyRentMicrosinteger

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.

Example request

{
  "e164": "+14155550123",
  "autoPick": {
    "country": "US",
    "numberType": "LOCAL",
    "areaCode": "415",
    "contains": "555"
  },
  "country": "US",
  "expectMonthlyRentMicros": 2000000
}

Response

The purchased phone number

Example response

{
  "data": {
    "e164": "+14155550123"
  }
}

Changes