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.
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.
https://api.numberhub.ai/api/integrationRate 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:
{
"error": "Number not found."
}Numbers
Manage your purchased phone numbers, search available inventory, purchase new numbers, and release numbers you no longer need.
/numbersReturns all phone numbers currently on your account as a flat array.
curl -X GET "https://api.numberhub.ai/api/integration/numbers" \
-H "X-Hub-Api-Key: nh_a1b2c3d4e5f6..."{
"numbers": [
{ "id": "clxxxxxxxxxxxxxxxx", "phoneNumber": "+15551234567" },
{ "id": "clyyyyyyyyyyyyyyyy", "phoneNumber": "+15559876543" }
]
}/numbers/searchSearch for US phone numbers available for purchase by area code. Results reflect real-time carrier inventory.
Parameters
| Name | Type | Description |
|---|---|---|
areaCoderequired | string | Exactly 3 digits, US only (e.g. 415) |
curl -X GET "https://api.numberhub.ai/api/integration/numbers/search?areaCode=415" \
-H "X-Hub-Api-Key: nh_a1b2c3d4e5f6..."{
"numbers": [
{ "phoneNumber": "+14151234567", "monthlyFeeCents": 200 },
{ "phoneNumber": "+14159876543", "monthlyFeeCents": 200 }
]
}/numbers/purchasePurchase a specific number from inventory and provision it on your account. Credits are deducted at the time of purchase.
Parameters
| Name | Type | Description |
|---|---|---|
phoneNumberrequired | string | E.164-formatted number to purchase (e.g. +15551234567) |
forwardToNumber | string | Optional US/Canada number to forward inbound calls to immediately upon provisioning |
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"
}'{
"phoneNumber": "+15551234567",
"monthlyFeeCents": 200
}/numbers/:phoneNumberImmediately 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.
curl -X DELETE "https://api.numberhub.ai/api/integration/numbers/%2B15551234567" \
-H "X-Hub-Api-Key: nh_a1b2c3d4e5f6..."{ "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.
/numbers/:phoneNumber/forwardingSets 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
| Name | Type | Description |
|---|---|---|
forwardToNumberrequired | string | E.164 US/Canada number to forward calls to (e.g. +15559876543) |
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" }'{ "ok": true, "profileId": 12345, "forwardToNumber": "+15559876543" }SMS
Send outbound SMS messages from any phone number on your account.
/sendSend an outbound SMS message from one of your purchased numbers.
Parameters
| Name | Type | Description |
|---|---|---|
fromrequired | string | E.164 number on your account to send from |
torequired | string | E.164 destination number |
bodyrequired | string | Message text |
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!"
}'{
"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.
/balanceReturns the current credit balance for your account.
curl -X GET "https://api.numberhub.ai/api/integration/balance" \
-H "X-Hub-Api-Key: nh_a1b2c3d4e5f6..."{
"balance": 42.50,
"currency": "USD"
}