NumberHub
HomeResourcesAPI Reference

API Reference

Detailed documentation on our REST endpoints, request schemas, and authentication.

Authentication

All API requests must include your API key in the X-Hub-Api-Key header. You can generate API keys in your Dashboard under Settings → API Keys. Keep your keys secret — never expose them in client-side code or public repositories.

API keys follow the format nh_ followed by 48 hex characters (e.g. nh_a1b2c3d4e5f6...). The key identifies your account — no separate sub-account ID is needed.

Authentication Header
X-Hub-Api-Key: nh_a1b2c3d4e5f6...

Base URL

All endpoints are relative to the following base URL. Every request and response uses JSON; set Content-Type: application/json on all write operations.

http
https://api.numberhub.ai/api/integration

Rate Limits

The API enforces a limit of 100 requests per second per account. Exceeding this limit returns a 429 Too Many Requests response with a Retry-After header indicating how many seconds to wait before retrying. Implement exponential backoff in your client to handle transient throttling gracefully.

Response Format

Responses are simple, flat JSON objects — there is no wrapping envelope. Each endpoint returns the relevant fields directly. For example, GET /numbers returns { "numbers": [...] } and GET /balance returns { "balance": 42.50, "currency": "USD" }.

The only exception is POST /send, which always includes a success: true field alongside messageId and costUsd.

Error responses return the appropriate HTTP status code (e.g. 400, 404, 422) with a flat JSON body:

json
{
  "error": "Number not found."
}

Numbers

Manage your purchased phone numbers, search available inventory, purchase new numbers, and release numbers you no longer need.

GET/numbers

Returns all phone numbers currently on your account as a flat array.

Request
curl -X GET "https://api.numberhub.ai/api/integration/numbers" \
  -H "X-Hub-Api-Key: nh_a1b2c3d4e5f6..."
Response
{
  "numbers": [
    { "id": "clxxxxxxxxxxxxxxxx", "phoneNumber": "+15551234567" },
    { "id": "clyyyyyyyyyyyyyyyy", "phoneNumber": "+15559876543" }
  ]
}
GET/numbers/search

Search for US phone numbers available for purchase by area code. Results reflect real-time carrier inventory.

Parameters

NameTypeDescription
areaCoderequiredstringExactly 3 digits, US only (e.g. 415)
Request
curl -X GET "https://api.numberhub.ai/api/integration/numbers/search?areaCode=415" \
  -H "X-Hub-Api-Key: nh_a1b2c3d4e5f6..."
Response
{
  "numbers": [
    { "phoneNumber": "+14151234567", "monthlyFeeCents": 200 },
    { "phoneNumber": "+14159876543", "monthlyFeeCents": 200 }
  ]
}
POST/numbers/purchase

Purchase a specific number from inventory and provision it on your account. Credits are deducted at the time of purchase.

Parameters

NameTypeDescription
phoneNumberrequiredstringE.164-formatted number to purchase (e.g. +15551234567)
forwardToNumberstringOptional US/Canada number to forward inbound calls to immediately upon provisioning
Request
curl -X POST "https://api.numberhub.ai/api/integration/numbers/purchase" \
  -H "X-Hub-Api-Key: nh_a1b2c3d4e5f6..." \
  -H "Content-Type: application/json" \
  -d '{
    "phoneNumber": "+15551234567",
    "forwardToNumber": "+15559876543"
  }'
Response
{
  "phoneNumber": "+15551234567",
  "monthlyFeeCents": 200
}
DELETE/numbers/:phoneNumber

Immediately deactivates the number and stops billing. Pass the E.164-formatted phone number URL-encoded in the path (e.g. %2B15551234567 for +15551234567). This action is irreversible — the number is returned to the carrier pool and may be reassigned to another customer.

Request
curl -X DELETE "https://api.numberhub.ai/api/integration/numbers/%2B15551234567" \
  -H "X-Hub-Api-Key: nh_a1b2c3d4e5f6..."
Response
{ "ok": true }

Forwarding

Configure inbound call forwarding for a specific phone number. When a call is received on the number, it will be forwarded to the destination number you specify.

PUT/numbers/:phoneNumber/forwarding

Sets or updates the inbound call forwarding destination for a purchased number. The destination must be a US or Canada number in E.164 format. Pass the source phone number URL-encoded in the path.

Parameters

NameTypeDescription
forwardToNumberrequiredstringE.164 US/Canada number to forward calls to (e.g. +15559876543)
Request
curl -X PUT "https://api.numberhub.ai/api/integration/numbers/%2B15551234567/forwarding" \
  -H "X-Hub-Api-Key: nh_a1b2c3d4e5f6..." \
  -H "Content-Type: application/json" \
  -d '{ "forwardToNumber": "+15559876543" }'
Response
{ "ok": true, "profileId": 12345, "forwardToNumber": "+15559876543" }

SMS

Send outbound SMS messages from any phone number on your account.

POST/send

Send an outbound SMS message from one of your purchased numbers.

Parameters

NameTypeDescription
fromrequiredstringE.164 number on your account to send from
torequiredstringE.164 destination number
bodyrequiredstringMessage text
Request
curl -X POST "https://api.numberhub.ai/api/integration/send" \
  -H "X-Hub-Api-Key: nh_a1b2c3d4e5f6..." \
  -H "Content-Type: application/json" \
  -d '{
    "from": "+15551234567",
    "to": "+15559876543",
    "body": "Hello from NumberHub!"
  }'
Response
{
  "success": true,
  "messageId": "msg_xxxxxxxxxxxxxxxx",
  "costUsd": 0.0075
}

Account Balance

Retrieve the current credit balance for your account. The balance is decremented when you purchase phone numbers or send messages.

GET/balance

Returns the current credit balance for your account.

Request
curl -X GET "https://api.numberhub.ai/api/integration/balance" \
  -H "X-Hub-Api-Key: nh_a1b2c3d4e5f6..."
Response
{
  "balance": 42.50,
  "currency": "USD"
}

Ready to transform your communication?

Join the leading marketing agencies and developers utilizing NumberHub's powerful middleware.