Phone Numbers API

Search, purchase & provision numbers

Acquire phone numbers and wire them to your voice and messaging webhooks entirely from code — no dashboard visit required.

Base URL & auth
Base URL is https://api.callnode.io. Requests are signed with the same X-Api-Key / X-Timestamp / X-Signature HMAC scheme as the Calls and Messaging APIs — one API key works everywhere. See Authentication.

Signing GET / DELETE requests

JavaScript
// GET and DELETE requests sign an EMPTY body: the payload is timestamp + "\n".
const crypto = require('crypto');
const ts  = Math.floor(Date.now() / 1000).toString();
const sig = crypto.createHmac('sha256', apiSecret).update(ts + '\n').digest('hex');
// GET https://api.callnode.io/api/v1/numbers/available?type=local&areaCode=828
// Headers: X-Api-Key: <apiKey>, X-Timestamp: ts, X-Signature: sig
GET/api/v1/numbers/available
Searches live carrier inventory for numbers you can purchase right now. Local searches require an area code; toll-free searches accept an optional prefix or vanity word.

Query parameters

ParameterTypeRequiredDescription
typestringOptionallocal (default) or tollfree.
areaCodestringlocal only3-digit area code, e.g. 828. Required when type=local.
prefixstringOptionalToll-free prefix: 800–888. 800 and 822 inventory is usually exhausted; 833–888 have stock.
vanitystringOptionalToll-free vanity word, 4–7 letters or digits (e.g. NEWCAR). Takes precedence over prefix. Matches are sparse.
quantityintegerOptionalCandidates to return, 1–25. Defaults to 10.

Response — 200 OK

JSON
{
  "numbers": [
    {
      "phoneNumber": "+18282129522",
      "type":        "local",
      "city":        "GRANITE FALLS",
      "region":      "NC",
      "rateCenter":  "GRANITEFLS"
    }
  ],
  "count": 1,
  "pricing": {
    "setupFee":                0,
    "monthlyFee":              1.99,
    "perMinuteRate":           0.02,
    "totalDueNow":             1.99,
    "includedInSubscription":  false
  }
}

The pricing block is account-specific and authoritative: it reflects your plan's current rates and any included-number slots, sototalDueNow is exactly what a purchase would deduct from your wallet right now. The amounts in these examples are those of a Pro Bundle account adding a local number beyond the ones its plan includes; on pay as you go you see the rates on the pricing page. An empty numbers array means no inventory in that area — try a neighboring area code or another toll-free prefix.

Pro Bundle included numbers are assigned in purchase order.The plan's included-number slots are filled by your earliest-purchased active CallNode API numbers (any mix of local and toll-free). A new purchase is included only while a slot is free; releasing an included number hands its slot to the next number you bought. The slots are never chosen at random or picked by you, wholesale numbers never occupy one, and the dashboard marks which numbers are currently included.

Purchase a number

POST/api/v1/numbers
Purchases a number from the search results and bills your wallet for the first month at your plan's rate (there is no setup fee; an included Pro Bundle number costs nothing). Voice handling (a webhook, a realtime WebSocket, or delivery to a SIP trunk) and the messaging webhook can be provisioned in the same call, so the number is fully wired the moment it activates.
This endpoint bills your wallet
The wallet balance check runs before any carrier order is placed — an insufficient balance returns 402 without side effects. A failed carrier order returns 502 and nothing is billed.

Request body

FieldTypeRequiredDescription
phoneNumberstring (E.164)RequiredA number returned by the availability search.
typestringOptionallocal or tollfree. Derived from the number itself when omitted (8NN prefixes are toll-free).
friendlyNamestringOptionalDisplay label, up to 100 characters.
tagsstring[]OptionalYour own labels for the number (up to 10, each 1–24 characters: letters, digits, spaces, dots, underscores, hyphens). Trimmed and de-duplicated case-insensitively; returned on every number and filterable on the dashboard. Replace the whole list with PATCH; send [] to clear.
voiceobjectOptionalVoice config: webhook, realtime WebSocket, or SIP trunk delivery — see Webhook configuration.
messagingobjectOptionalMessaging webhook config — see Webhook configuration.

Example request body

JSON
{
  "phoneNumber":  "+18282129522",
  "friendlyName": "Support line",
  "tags":         ["support", "east-coast"],
  "voice": {
    "webhookUrl": "https://yourcrm.example.com/voice/n8n",
    "webhookAuth": {
      "type":       "header",
      "headerName": "X-API-Key",
      "value":      "your-n8n-secret"
    },
    "webhookTimeout": 30000
  },
  "messaging": {
    "webhookUrl":  "https://yourcrm.example.com/sms/n8n",
    "webhookAuth": { "type": "bearer", "value": "your-token" },
    "enabled":     true
  }
}

Success response — 201 Created

JSON
{
  "number": {
    "id":           "cmcx1a2b30001pp4hexample",
    "phoneNumber":  "+18282129522",
    "type":         "local",
    "friendlyName": "Support line",
    "status":       "active",
    "purchaseSource": "api",
    "tags":         ["support", "east-coast"],
    "voice": {
      "webhookUrl":     "https://yourcrm.example.com/voice/n8n",
      "webhookAuth":    { "type": "header", "headerName": "X-API-Key", "valueSet": true },
      "webhookTimeout": 30000
    },
    "messaging": {
      "webhookUrl":  "https://yourcrm.example.com/sms/n8n",
      "webhookAuth": { "type": "bearer", "valueSet": true },
      "enabled":     true,
      "ready":       false
    },
    "monthlyRate":             1.99,
    "perMinuteRate":           0.02,
    "includedInSubscription":  false,
    "createdAt":               "2026-07-12T22:10:04.000Z",
    "updatedAt":               "2026-07-12T22:10:04.000Z"
  },
  "charged":   1.99,
  "breakdown": { "setupFee": 0, "monthlyFee": 1.99, "total": 1.99 },
  "wallet":    { "previousBalance": 25.00, "newBalance": 23.01 },
  "includedInSubscription": false,
  "idempotencyReplay":      false
}

Purchase semantics

Idempotent on the number. Re-purchasing a number you already own returns200 with the existing record andidempotencyReplay: true — nothing is billed twice. Safe to retry after a timeout.

Released numbers restore automatically.If you previously released the number, purchasing it again restores it from your account's recycle bin (with fresh billing) instead of placing a new carrier order.

Messaging activates asynchronously.Voice is routable on activation; carrier messaging registration (10DLC for local, Toll-Free Verification for toll-free) completes in the background. Poll the number's messaging.ready flag — sends before registration completes return 403 from the Messaging API.

Webhook configuration

The same voice and messaging objects are accepted at purchase time and by PATCH /api/v1/numbers/:id. Send only the fields you want to change.

FieldTypeDescription
voice.webhookUrlstringWhere your AI agent runs. Invoked when an inbound call connects, then once per caller utterance — the same contract as the conversational webhook. Empty string disconnects it. Must be a public address: a loopback, private or internal address is refused with 400 validation_error.
voice.webhookAuthobjectHow CallNode authenticates to your endpoint — see auth types below.
voice.webhookTimeoutintegerHow long each turn of the voice webhook may take on calls to this number (Web Voice and SIP trunk calls to it included), in milliseconds, 1000–120000. Default 30000. Calls you place through the API wait 30 seconds. See timeouts and retries.
voice.realtimeobjectRealtime WebSocket mode: { "url": "wss://…", "auth": { … }, "voice": "…" }. Inbound calls stream over your socket and the webhook stays the fallback. Accepted at purchase and on update; null turns it off. See Realtime WebSocket.
voice.trunkIdstringDeliver inbound calls to one of your SIP trunks instead of an agent. Exclusive with voice.sipUri; setting one clears the other. See SIP trunking.
voice.sipUristringDeliver inbound calls straight to a SIP address, sip:user@host[:port][;transport=udp|tcp|tls]. Exclusive with voice.trunkId.
voice.srtpbooleanEncrypt the audio on that delivery leg (SRTP, AES-CM-128 via SDES). Accepted only beside a voice.sipUri ending in ;transport=tls; cleared when the address changes to UDP/TCP or to a trunk. Default false. See encrypted delivery.
messaging.webhookUrlstringPOSTed for each inbound SMS/MMS to this number. Must be a public address: a loopback, private or internal address is refused with 400 validation_error.
messaging.webhookAuthobjectSame shape as voice.webhookAuth.
messaging.enabledbooleanMaster switch for inbound message forwarding. Default true.

Webhook auth types

TypeFieldsWhat we send
none—No auth header.
basicvalue = user:passAuthorization: Basic <base64>
bearervalue = tokenAuthorization: Bearer <token>
headerheaderName + value<headerName>: <value> (e.g. an n8n header-auth credential)
Secrets are write-only
Webhook auth secrets are never echoed back. Responses describe the stored auth as { "type": "header", "headerName": "X-API-Key", "valueSet": true } — to rotate a secret, just PATCH a new value.

List your numbers

GET/api/v1/numbers
Returns your numbers, newest first, each in the same shape as the purchase response's number object. Optional filters, all applied server-side and combinable: ?status=active, ?type=local|tollfree, ?purchaseSource=web|api, ?tag=<exact tag>, and ?q=<text> (matches the number's digits, the friendly name, or a tag).

Retrieve a number

GET/api/v1/numbers/:id
Fetch one number. :id accepts the record id or the E.164 number itself (URL-encode the plus sign, e.g. %2B18282129522).

Update webhooks & config

PATCH/api/v1/numbers/:id
Provisions or updates the voice webhook, messaging webhook, their auth, the friendly name, and the tags. Only the fields you send change; everything else is left untouched (tags is replaced as a whole list).

Example request body

JSON
{
  "tags": ["support", "after-hours"],
  "voice": {
    "webhookUrl": "https://yourcrm.example.com/voice/n8n",
    "webhookAuth": {
      "type":       "header",
      "headerName": "X-API-Key",
      "value":      "your-n8n-secret"
    }
  },
  "messaging": {
    "enabled": true
  }
}

Returns 200 with the updated number object. Changes take effect for the next inbound call or message.

A number can also receive faxes: the same endpoint takes a fax object (receive mode, notify emails, fax webhook). See Hosted fax.

Release a number

DELETE/api/v1/numbers/:id
Releases the number and stops its billing.
JSON
{
  "id":          "cmcx1a2b30001pp4hexample",
  "phoneNumber": "+18282129522",
  "released":    true,
  "restorable":  true
}

Released numbers are parked in a recycle bin tied to your account rather than discarded — when restorable is true, purchasing the same number again later restores it. Inbound calls and messages stop immediately on release.

SIP trunk ingress (inbound)

Beyond the public phone network, you can send calls into CallNode straight from your own SIP infrastructure — a PBX, SBC, or softswitch — and reach the same AI agents that answer your CallNode numbers. This direction is inbound: your equipment originates the call and CallNode answers it. It is configured on a SIP trunk in the dashboard, not through this API. See SIP Trunking for the full guide covering egress, ingress, and BYOC inbound delivery.

  1. Create a SIP trunk and list the public IPv4 source addresses your PBX/SBC will send from (up to 10; private ranges are rejected). Ingress is IP-authenticated — only calls from these addresses are accepted.
  2. Point your PBX/SBC at sip.callnode.io:5062 over UDP or TCP. Audio is G.711 (PCMU/PCMA) and DTMF is RFC 2833.
  3. Set the dialed numberto one of your CallNode numbers — the call routes to that number's voice webhook agent. If the dialed number isn't one of yours, the trunk's default agent number answers instead.
Same agent contract as the PSTN
An ingress call invokes the number's voice.webhookUrl exactly like a call from the public phone network — the conversational webhook contract is identical. Configure the webhook per number with PATCH /api/v1/numbers/:id above.

HTTP response codes

StatusMeaning
200Success (retrieve/list/update/release), or an idempotent purchase replay.
201Number purchased and billed.
400validation_error — malformed number, bad webhook URL/auth, missing areaCode, etc. The message field says exactly what to fix.
401Auth failed (invalid signature, clock skew, revoked key).
402insufficient_balance — body includes required, current, and needed. Top up and retry.
404No such number on your account.
409number_unavailable — already owned by another account or reserved. Search again and pick another.
429Rate limit exceeded.
502search_failed / provider_error — the carrier operation failed. Nothing was billed; retry or pick another number.