API reference

Phone numbers

Provision and manage Canadian phone numbers.

get/v1/phone-numbers/area-codes

List provinces and their active area codes

Requires phone_numbers:r.

Responses

  • 200Provinces with their active area codes.
    FieldTypeDescription
    data[]requiredobject[]
    provincerequiredstring
    countryrequiredstring
    area_codesrequiredstring[]
  • 401Missing, invalid, revoked or expired API key.The standard error body.
  • 402The account has no balance, or a LIVE key was used before the first top-up.The standard error body.
  • 403The API key lacks the permission this operation requires, or the account is suspended or closed.The standard error body.
  • 429Rate limit reached: 100 requests per second per account, or a route-specific limit (Retry-After set where one applies).The standard error body.
  • 500Unexpected server error.The standard error body.

Example

const { data, error } = await honkio.phoneNumbers.areaCodes()
if (error) throw new Error(error.message)
console.log(data.data)
get/v1/phone-numbers

List account's provisioned phone numbers

Permissionphone_numbers:rNode.js SDKhonkio.phoneNumbers.list()

Requires phone_numbers:r.

Responses

  • 200The account's numbers, excluding released ones, newest first. Not paginated.
    FieldTypeDescription
    data[]requiredobject[]
    idrequiredstring
    phone_numberrequiredstring

    E.164

    area_coderequiredstring
    regionrequiredstring

    Province or territory, when the area code maps to one.

    • Can be null
    capabilitiesrequiredstring[]
    statusrequiredstring
    • One of: ACTIVE | SUSPENDED | RELEASING | RELEASED
    monthly_cost_centsrequiredinteger

    Recurring rent in CAD cents.

    provisioned_atrequiredstring
    • Format: date-time
    released_atrequiredstring
    • Format: date-time
    • Can be null
  • 401Missing, invalid, revoked or expired API key.The standard error body.
  • 402The account has no balance, or a LIVE key was used before the first top-up.The standard error body.
  • 403The API key lacks the permission this operation requires, or the account is suspended or closed.The standard error body.
  • 429Rate limit reached: 100 requests per second per account, or a route-specific limit (Retry-After set where one applies).The standard error body.
  • 500Unexpected server error.The standard error body.

Example

const { data, error } = await honkio.phoneNumbers.list()
if (error) throw new Error(error.message)
for (const n of data.data) console.log(n.phone_number, n.status)
post/v1/phone-numbers

Provision (purchase) a phone number

Provisions a number and debits its first month's rent plus a one-time activation fee, as one purchase (see GET /v1/pricing for both amounts; the activation fee is the same on every tier and is not refunded on release). A balance that cannot cover the total returns 402 INSUFFICIENT_BALANCE before anything is charged or ordered. Accounts are capped on how many phone numbers they may hold at once (counting ACTIVE and SUSPENDED), a per-account limit that falls back to a platform-wide default staff can change at runtime; exceeding it returns 403 NUMBER_LIMIT_REACHED with the limit and current usage in details. Request a higher allowance from the dashboard. May also return 409 PURCHASE_IN_PROGRESS when another purchase for this account is already in flight: this is transient, unlike the terminal 409 CONFLICT returned when the number is already owned; retry PURCHASE_IN_PROGRESS after a short delay rather than treating it as a failed purchase.

Requires phone_numbers:w.

Request body

FieldTypeDescription
phone_numberrequiredstring

E.164 number to provision (from available search)

Responses

  • 201The provisioned number.
    FieldTypeDescription
    idrequiredstring
    phone_numberrequiredstring

    E.164

    area_coderequiredstring
    regionrequiredstring

    Province or territory, when the area code maps to one.

    • Can be null
    capabilitiesrequiredstring[]
    statusrequiredstring
    • One of: ACTIVE | SUSPENDED | RELEASING | RELEASED
    monthly_cost_centsrequiredinteger

    Recurring rent in CAD cents.

    provisioned_atrequiredstring
    • Format: date-time
    released_atrequiredstring
    • Format: date-time
    • Can be null
  • 401Missing, invalid, revoked or expired API key.The standard error body.
  • 402INSUFFICIENT_BALANCE: the balance cannot cover the first month and the activation fee. Nothing was charged or ordered.The standard error body.
  • 403NUMBER_LIMIT_REACHED (details carries limit and used), LIVE_KEY_REQUIRED (test keys cannot provision), or ACCOUNT_NOT_VERIFIED (the account has not verified an owner mobile number).The standard error body.
  • 409CONFLICT (the number is already owned) or PURCHASE_IN_PROGRESS (another purchase for this account is in flight; retry shortly).The standard error body.
  • 422NON_CANADIAN_NUMBER or VALIDATION_ERROR.The standard error body.
  • 429Rate limit reached: 100 requests per second per account, or a route-specific limit (Retry-After set where one applies).The standard error body.
  • 500INTERNAL_ERROR: the charge failed for a reason other than balance.The standard error body.
  • 501TOLLFREE_800_COMING_SOON: 1-800 numbers are not offered yet.The standard error body.
  • 502PROVISIONING_FAILED: the carrier did not provision the number. The charge is refunded.The standard error body.

Example

const { data: number, error } = await honkio.phoneNumbers.provision({ phoneNumber: '+1416XXXXXXX' })
if (error) throw new Error(error.message)
console.log(number.id, number.status)
get/v1/phone-numbers/{id}

Get a phone number by ID

Permissionphone_numbers:rNode.js SDKhonkio.phoneNumbers.get()

Requires phone_numbers:r.

Parameters

ParameterTypeDescription
idrequiredpathstring

Responses

  • 200The number, released ones included.
    FieldTypeDescription
    idrequiredstring
    phone_numberrequiredstring

    E.164

    area_coderequiredstring
    regionrequiredstring

    Province or territory, when the area code maps to one.

    • Can be null
    capabilitiesrequiredstring[]
    statusrequiredstring
    • One of: ACTIVE | SUSPENDED | RELEASING | RELEASED
    monthly_cost_centsrequiredinteger

    Recurring rent in CAD cents.

    provisioned_atrequiredstring
    • Format: date-time
    released_atrequiredstring
    • Format: date-time
    • Can be null
  • 401Missing, invalid, revoked or expired API key.The standard error body.
  • 402The account has no balance, or a LIVE key was used before the first top-up.The standard error body.
  • 403The API key lacks the permission this operation requires, or the account is suspended or closed.The standard error body.
  • 404NOT_FOUND: no such resource on this account.The standard error body.
  • 429Rate limit reached: 100 requests per second per account, or a route-specific limit (Retry-After set where one applies).The standard error body.
  • 500Unexpected server error.The standard error body.

Example

const { data, error } = await honkio.phoneNumbers.get('NUMBER_ID')
if (error) throw new Error(error.message)
console.log(data.phone_number, data.status)
delete/v1/phone-numbers/{id}

Release (cancel) a phone number

Releases the number at the carrier and answers 204, also when the carrier had already let it go. If the carrier does not accept the release, answers 502 RELEASE_FAILED and the number stays yours, unchanged; try again.

Requires phone_numbers:d.

Parameters

ParameterTypeDescription
idrequiredpathstring

Responses

  • 204Released, or already released at the carrier.
  • 401Missing, invalid, revoked or expired API key.The standard error body.
  • 402The account has no balance, or a LIVE key was used before the first top-up.The standard error body.
  • 403LIVE_KEY_REQUIRED: test keys cannot reach live resources here. Also FORBIDDEN when the key lacks the permission this operation requires, or the account is suspended or closed.The standard error body.
  • 404NOT_FOUND: no such number on this account, or it is already released.The standard error body.
  • 429Rate limit reached: 100 requests per second per account, or a route-specific limit (Retry-After set where one applies).The standard error body.
  • 500Unexpected server error.The standard error body.
  • 502RELEASE_FAILED: the carrier did not accept the release. The number stays yours, unchanged; try again.The standard error body.

Example

const { error } = await honkio.phoneNumbers.release('NUMBER_ID')
if (error) throw new Error(error.message)
get/v1/phone-numbers/allowance-requests

List your phone number allowance requests

Permissionphone_numbers:r

Requires phone_numbers:r.

Responses

  • 200The account's allowance requests, newest first.
    FieldTypeDescription
    data[]requiredobject[]
    idrequiredstring
    requested_limitrequiredinteger

    Total numbers asked for, not an increment.

    limit_at_requestrequiredinteger
    held_at_requestrequiredinteger
    reasonrequiredstring
    statusrequiredstring
    • One of: PENDING | APPROVED | DENIED
    granted_limitrequiredinteger
    • Can be null
    staff_noterequiredstring
    • Can be null
    decided_atrequiredstring
    • Format: date-time
    • Can be null
    created_atrequiredstring
    • Format: date-time
  • 401Missing, invalid, revoked or expired API key.The standard error body.
  • 402The account has no balance, or a LIVE key was used before the first top-up.The standard error body.
  • 403The API key lacks the permission this operation requires, or the account is suspended or closed.The standard error body.
  • 429Rate limit reached: 100 requests per second per account, or a route-specific limit (Retry-After set where one applies).The standard error body.
  • 500Unexpected server error.The standard error body.

Example

cURL
curl https://api.honkio.ca/v1/phone-numbers/allowance-requests \
  -H "Authorization: Bearer mk_live_YOUR_KEY"
post/v1/phone-numbers/allowance-requests

Request a higher phone number allowance

Permissionphone_numbers:w

Files a request for HonkIO staff to review. Only one request may be pending at a time. Approval raises the account limit; you are emailed when that happens.

Requires phone_numbers:w.

Request body

FieldTypeDescription
requested_limitrequiredinteger

Total numbers you want to be able to hold (not an increment)

  • Minimum: 2
  • Maximum: 100
reasonrequiredstring

What you need them for. Staff decide on this.

  • At least 10 characters
  • At most 1000 characters

Responses

  • 201The request, pending review.
    FieldTypeDescription
    idrequiredstring
    requested_limitrequiredinteger

    Total numbers asked for, not an increment.

    limit_at_requestrequiredinteger
    held_at_requestrequiredinteger
    reasonrequiredstring
    statusrequiredstring
    • One of: PENDING | APPROVED | DENIED
    granted_limitrequiredinteger
    • Can be null
    staff_noterequiredstring
    • Can be null
    decided_atrequiredstring
    • Format: date-time
    • Can be null
    created_atrequiredstring
    • Format: date-time
  • 401Missing, invalid, revoked or expired API key.The standard error body.
  • 402The account has no balance, or a LIVE key was used before the first top-up.The standard error body.
  • 403LIVE_KEY_REQUIRED: test keys cannot reach live resources here. Also FORBIDDEN when the key lacks the permission this operation requires, or the account is suspended or closed.The standard error body.
  • 409ALLOWANCE_REQUEST_PENDING: a request is already pending.The standard error body.
  • 422VALIDATION_ERROR, or INVALID_ALLOWANCE_REQUEST when requested_limit is not above the current limit.The standard error body.
  • 429RATE_LIMITED: 3 requests per day per account.The standard error body.
  • 500Unexpected server error.The standard error body.

Example

cURL
curl -X POST https://api.honkio.ca/v1/phone-numbers/allowance-requests \
  -H "Authorization: Bearer mk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "requested_limit": 2,
    "reason": "..."
  }'