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. 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. 2. Check your balance

    Orders are charged to your communication balance in US cents. Top it up on the website.

    Shell
    curl https://api.numsify.com/api/v1/balance \
      -H "Authorization: Bearer $NUMSIFY_API_KEY"
    
    # {"success":true,"data":{"balance_cents":1250,"currency":"USD"},"timestamp":"…"}
  3. 3. Pick a service and country

    Find the service, then read price and stock per country.

    Shell
    curl "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. 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.

    Shell
    curl -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. 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.

    Shell
    curl 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

    curl
    curl "https://api.numsify.com/api/v1/balance" \
      -H "Authorization: Bearer $NUMSIFY_API_KEY"

    Response

    200 · JSON
    {
      "success": true,
      "data": {
        "balance_cents": 1250,
        "currency": "USD"
      },
      "timestamp": "2026-11-22T10:00:00Z"
    }
    All parameters, fields and error responses for GET /v1/balance

Services

Numbers

Responses & errors

Every response uses the same envelope. Check success, then read data or error. pagination is only on list endpoints.

JSON
// 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

Error codes, their usual HTTP status and what to do
CodeHTTPMeaning and what to do
UNAUTHORIZED401Missing or unknown API key.
API_KEY_REVOKED401The key was revoked.
API_KEY_EXPIRED401The key passed its expiry.
IP_NOT_ALLOWED403The request IP is not in the key's allowlist.
INSUFFICIENT_SCOPE403The key lacks the scope this endpoint needs.
API_ACCESS_DISABLED403API access is not enabled for this account.
BROWSER_REQUESTS_NOT_ALLOWED403The request carried an Origin header. Call the API from your server only.
SERVICE_RESTRICTED403This service cannot be ordered through the API.
VALIDATION_FAILED400A parameter or body field is invalid.
IDEMPOTENCY_KEY_REQUIRED400POST /v1/numbers was sent without an Idempotency-Key header.
INSUFFICIENT_BALANCE402Top up your communication balance, then retry with the same Idempotency-Key.
NUMBER_NOT_FOUND404No number with this ID on your account.
CONCURRENT_ORDER409Another order with this spend-capped key is in flight. Retry shortly.
CANCELLATION_TOO_EARLY409Numbers can be canceled 2 minutes after the order. See cancelable_after and the Retry-After header.
NUMBER_CANCELLED409The number is already canceled.
NUMBER_EXPIRED409The number already expired.
IDEMPOTENCY_IN_PROGRESS409The same Idempotency-Key is still being processed.
DAILY_SPEND_LIMIT_REACHED422The key's daily spend cap is used up.
SERVICE_UNAVAILABLE422This service is not offered in that country.
IDEMPOTENCY_KEY_REUSED422The same Idempotency-Key was sent with a different body.
ACTIVE_NUMBER_LIMIT429Too many active numbers. Cancel some or wait for them to finish.
RATE_LIMIT_EXCEEDED429Slow down and retry with backoff.
INTERNAL_ERROR500Something failed on our side. Retry with backoff.
TEMPORARILY_UNAVAILABLE503Ordering 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.

ScopeEndpoints
numbers:readGET /v1/services, /v1/services/{id}/countries, /v1/numbers, /v1/numbers/{id}, /v1/numbers/{id}/sms
numbers:writePOST /v1/numbers, /v1/numbers/{id}/cancel, /v1/numbers/{id}/retry
balance:readGET /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.
Node.js
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 replay

Rate 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.

Example delivery
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>:

  1. Compute hex(HMAC_SHA256(secret, t + "." + raw_body)) over the raw request bytes, before any JSON parsing.
  2. Compare it in constant time with each v1 value; accept if any matches.
  3. Reject if t is more than 5 minutes from your clock, to stop replays.
  4. 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.
  5. Deliveries can repeat. Deduplicate on the event id (also in Numsify-Event-Id).
Node.js
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.

Download openapi.yaml
Loading the full API reference…

Your second number, wherever you are

Get the Numsify app to manage numbers and read codes on your phone, or rent a number right here on the web.

Privacy & Data

Manage requests for your account data and choose which cookies Numsify can use.

Account data

Download your data

Request a copy of your personal account data.

Delete your data

Request deletion of your account data.

Read our Privacy Policy