Developer API
Virtual numbers from your own server
Order one-time numbers, read SMS and call codes, and get signed webhooks. The API is available to reseller accounts and charges your Numsify communication balance.
Not a reseller yet? Contact support to request API access. Base URL: https://api.numsify.com/api
Quick start
From zero to a received code in five calls. Every response uses the same envelope: { "success", "data", "timestamp", "pagination"? } on success and { "success": false, "error": { "code", "message" } } on failure. Branch on error.code.
1. Create a key
In API keys, create a key with the scopes your integration needs. Copy it into your server's secrets manager or environment; it is shown once.
Shell# On your server, never in a browser or app export NUMSIFY_API_KEY="nsk_live_…"2. Check your balance
Orders are charged to your communication balance in US cents. Top it up on the website.
Shellcurl https://api.numsify.com/api/v1/balance \ -H "Authorization: Bearer $NUMSIFY_API_KEY" # {"success":true,"data":{"balance_cents":1250,"currency":"USD"},"timestamp":"…"}3. Pick a service and country
Find the service, then read price and stock per country.
Shellcurl "https://api.numsify.com/api/v1/services?search=whatsapp&verification_type=sms" \ -H "Authorization: Bearer $NUMSIFY_API_KEY" curl https://api.numsify.com/api/v1/services/SERVICE_ID/countries \ -H "Authorization: Bearer $NUMSIFY_API_KEY"4. Order a number
Send a unique Idempotency-Key per order. If the request times out, retry with the same key: you get the same number, not a second charge.
Shellcurl -X POST https://api.numsify.com/api/v1/numbers \ -H "Authorization: Bearer $NUMSIFY_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: 2b6f0cc9-4a0e-4f63-9d3c-6a8f1e2d7b10" \ -d '{"service_id":"SERVICE_ID","country_id":"COUNTRY_ID","verification_type":"sms"}'5. Get the code
Poll the number's SMS every few seconds while it is active, or skip polling and receive the sms.received webhook. Cancel unused numbers after cancelable_after for a refund.
Shellcurl https://api.numsify.com/api/v1/numbers/NUMBER_ID/sms \ -H "Authorization: Bearer $NUMSIFY_API_KEY" # Cancel (allowed from cancelable_after, 2 minutes after the order) curl -X POST https://api.numsify.com/api/v1/numbers/NUMBER_ID/cancel \ -H "Authorization: Bearer $NUMSIFY_API_KEY"
Endpoints
All nine endpoints, grouped by what they do. Open one to copy a working request and see the response it returns. Replace SERVICE_ID, COUNTRY_ID and NUMBER_ID with IDs from earlier calls.
Balance
Request
curlcurl "https://api.numsify.com/api/v1/balance" \ -H "Authorization: Bearer $NUMSIFY_API_KEY"All parameters, fields and error responses for GET /v1/balanceResponse
200 · JSON{ "success": true, "data": { "balance_cents": 1250, "currency": "USD" }, "timestamp": "2026-11-22T10:00:00Z" }
Services
Numbers
Responses & errors
Every response uses the same envelope. Check success, then read data or error. pagination is only on list endpoints.
// Success
{ "success": true, "data": { }, "timestamp": "2026-11-22T10:00:00Z", "pagination": { } }
// Failure
{ "success": false, "error": { "code": "INSUFFICIENT_BALANCE", "message": "..." }, "timestamp": "..." }Branch on error.code, not on the HTTP status or error.message (the message is for people and may change). The status below is the usual one for each code.
24 of 24 codes
| Code | HTTP | Meaning and what to do |
|---|---|---|
UNAUTHORIZED | 401 | Missing or unknown API key. |
API_KEY_REVOKED | 401 | The key was revoked. |
API_KEY_EXPIRED | 401 | The key passed its expiry. |
IP_NOT_ALLOWED | 403 | The request IP is not in the key's allowlist. |
INSUFFICIENT_SCOPE | 403 | The key lacks the scope this endpoint needs. |
API_ACCESS_DISABLED | 403 | API access is not enabled for this account. |
BROWSER_REQUESTS_NOT_ALLOWED | 403 | The request carried an Origin header. Call the API from your server only. |
SERVICE_RESTRICTED | 403 | This service cannot be ordered through the API. |
VALIDATION_FAILED | 400 | A parameter or body field is invalid. |
IDEMPOTENCY_KEY_REQUIRED | 400 | POST /v1/numbers was sent without an Idempotency-Key header. |
INSUFFICIENT_BALANCE | 402 | Top up your communication balance, then retry with the same Idempotency-Key. |
NUMBER_NOT_FOUND | 404 | No number with this ID on your account. |
CONCURRENT_ORDER | 409 | Another order with this spend-capped key is in flight. Retry shortly. |
CANCELLATION_TOO_EARLY | 409 | Numbers can be canceled 2 minutes after the order. See cancelable_after and the Retry-After header. |
NUMBER_CANCELLED | 409 | The number is already canceled. |
NUMBER_EXPIRED | 409 | The number already expired. |
IDEMPOTENCY_IN_PROGRESS | 409 | The same Idempotency-Key is still being processed. |
DAILY_SPEND_LIMIT_REACHED | 422 | The key's daily spend cap is used up. |
SERVICE_UNAVAILABLE | 422 | This service is not offered in that country. |
IDEMPOTENCY_KEY_REUSED | 422 | The same Idempotency-Key was sent with a different body. |
ACTIVE_NUMBER_LIMIT | 429 | Too many active numbers. Cancel some or wait for them to finish. |
RATE_LIMIT_EXCEEDED | 429 | Slow down and retry with backoff. |
INTERNAL_ERROR | 500 | Something failed on our side. Retry with backoff. |
TEMPORARILY_UNAVAILABLE | 503 | Ordering is paused. Retry later. |
Authentication & scopes
Send your key as Authorization: Bearer nsk_live_…. Keys are created in API keys and shown once; Numsify stores only a hash and a short prefix. You can have up to 5 active keys, so use one per server or environment and revoke them independently.
| Scope | Endpoints |
|---|---|
numbers:read | GET /v1/services, /v1/services/{id}/countries, /v1/numbers, /v1/numbers/{id}, /v1/numbers/{id}/sms |
numbers:write | POST /v1/numbers, /v1/numbers/{id}/cancel, /v1/numbers/{id}/retry |
balance:read | GET /v1/balance |
A key can also carry an IP allowlist (IPs or CIDRs, up to 20), an expiry, and a daily spend cap in USD. Failures return UNAUTHORIZED, API_KEY_REVOKED, API_KEY_EXPIRED, IP_NOT_ALLOWED, INSUFFICIENT_SCOPE or API_ACCESS_DISABLED. API keys can never manage keys, webhooks, payments or your account: that stays in the signed-in dashboard.
Requests that carry an Origin header are rejected with BROWSER_REQUESTS_NOT_ALLOWED. Call the API from your backend only; this is also why the reference below has no “try it” button.
Idempotency
POST /v1/numbers requires an Idempotency-Key header of 8–64 characters. For 24 hours, sending the same key with the same body returns the stored successful (201) response with Idempotent-Replayed: true, so a retry after a timeout never buys a second number. Failed orders are not stored, so you can retry them with the same key.
- Same key, different body:
422 IDEMPOTENCY_KEY_REUSED. - Same key while the first request is still running:
409 IDEMPOTENCY_IN_PROGRESS. Wait and retry. - No key:
IDEMPOTENCY_KEY_REQUIRED. - A failed order, for example
INSUFFICIENT_BALANCE, is not stored: top up and retry with the same key.
import { randomUUID } from "node:crypto";
// Create the key once per order and store it with the order before sending,
// so a retry after a crash or timeout reuses it.
const idempotencyKey = order.idempotencyKey ?? (order.idempotencyKey = randomUUID());
const res = await fetch("https://api.numsify.com/api/v1/numbers", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.NUMSIFY_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": idempotencyKey,
},
body: JSON.stringify({ service_id: order.serviceId, country_id: order.countryId }),
});
const body = await res.json();
if (!body.success) throw new Error(`${body.error.code}: ${body.error.message}`);
// res.headers.get("Idempotent-Replayed") === "true" on a replayRate limits
Each key may make 120 requests per minute and 20 orders per minute. Over the limit you get 429 RATE_LIMIT_EXCEEDED: back off exponentially with jitter before retrying. Polling SMS for many numbers adds up quickly, so prefer the sms.received webhook and poll only as a fallback, every 5 seconds or slower. Orders can also return 429 ACTIVE_NUMBER_LIMIT when you hold too many active numbers at once, and 409 CONCURRENT_ORDER when another order on the same spend-capped key is still running.
Webhooks & signature verification
Configure one HTTPS endpoint in Webhooks. Numsify sends sms.received, number.canceled, number.expired and, from the dashboard button, webhook.test. Answer with any 2xx within 10 seconds. Failures are retried after 1m, 5m, 30m, 2h, 6h and 12h (7 attempts), redirects are not followed, and after 20 consecutive failed attempts the endpoint is disabled and you get an email. The URL must be https:// on a public IP address.
POST /numsify/webhook HTTP/1.1
Content-Type: application/json
User-Agent: Numsify-Webhooks/1.0
Numsify-Event-Id: evt_9b2c4e6f8a0b1c2d3e4f5a6b7c8d9e0f
Numsify-Event-Type: sms.received
Numsify-Signature: t=1763805600,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
{
"id": "evt_9b2c4e6f8a0b1c2d3e4f5a6b7c8d9e0f",
"type": "sms.received",
"created_at": "2026-11-22T10:00:00Z",
"data": {
"number": { "id": "0d7c…", "phone_number": "+447700900123", "status": "active", … },
"sms": { "id": "5e1a…", "from": "WhatsApp", "text": "Your WhatsApp code: 123-456", "code": "123456", … }
}
}Verify every delivery before trusting it. The Numsify-Signature header is t=<unix seconds>,v1=<hex>:
- Compute
hex(HMAC_SHA256(secret, t + "." + raw_body))over the raw request bytes, before any JSON parsing. - Compare it in constant time with each v1 value; accept if any matches.
- Reject if
tis more than 5 minutes from your clock, to stop replays. - For 24 hours after you rotate the secret, the header carries two v1 values (new and old secret), so deploy the new secret within that window.
- Deliveries can repeat. Deduplicate on the event
id(also inNumsify-Event-Id).
import crypto from "node:crypto";
import express from "express";
const TOLERANCE_SECONDS = 5 * 60;
export function verifyNumsifySignature(rawBody, header, secret) {
if (!header || !secret) return false;
let timestamp = null;
const signatures = [];
for (const part of header.split(",")) {
const [key, value] = part.trim().split("=");
if (key === "t") timestamp = value;
else if (key === "v1" && value) signatures.push(value); // two v1 values during a rotation
}
if (!/^\d+$/.test(timestamp ?? "") || signatures.length === 0) return false;
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > TOLERANCE_SECONDS) return false;
const expected = crypto.createHmac("sha256", secret).update(`${timestamp}.`).update(rawBody).digest();
return signatures.some((sig) => {
const given = Buffer.from(sig, "hex");
return given.length === expected.length && crypto.timingSafeEqual(given, expected);
});
}
const app = express();
// Verify the raw bytes: parsing and re-serializing the JSON changes the signature.
app.post("/numsify/webhook", express.raw({ type: "application/json" }), (req, res) => {
const ok = verifyNumsifySignature(req.body, req.get("Numsify-Signature"), process.env.NUMSIFY_WEBHOOK_SECRET);
if (!ok) return res.sendStatus(400);
const event = JSON.parse(req.body.toString("utf8"));
// Deduplicate on event.id, queue the work, and answer within 10 seconds.
res.sendStatus(200);
});Security best practices
- Keep keys server-side. Store them in a secrets manager or environment variable, never in a web page, mobile app, repository, log or URL.
- Grant the least scope. A service that only reads codes does not need
numbers:write. - Set an IP allowlist with your servers' egress IPs, so a leaked key is useless elsewhere.
- Set a daily spend cap per key to bound the damage of a bug or a leak, and an expiry for temporary keys.
- Rotate on leak. If a key may have leaked, create a new one, deploy it, then revoke the old one right away. Rotate the webhook secret the same way.
- Verify webhook signatures and the timestamp on every delivery, and watch the security emails Numsify sends for key and webhook changes.
Full API reference
Every parameter, field, response and webhook payload, generated from the OpenAPI spec. Search it with ⌘K or Ctrl K.
