Webhooks
Get order events pushed to your server the moment they happen.
Register one HTTPS endpoint and we send every order event to it with an HTTP POST — number allocated, SMS received, failed, expired. Webhooks are faster than any polling interval and cost none of your rate limit.
Register your endpoint
- Open Dashboard → API Keys → Webhooks and add your URL. Your API key and webhook endpoint belong to the same account.
- Copy the signing secret: it is shown only once.
- Click Verify Webhook. We send a
webhook.testevent; return any2xxwithin 10 seconds to start receiving events.
Events
| Event | When | Key fields |
|---|---|---|
order.number_allocated |
A number is allocated; the order becomes active |
phone_number (no sms_code yet) |
order.completed |
The SMS arrives; the order becomes completed |
sms_code, sms_content |
order.failed |
No number could be allocated | error_code; nothing is charged |
order.expired |
A number was allocated but no SMS arrived in time | The charge is refunded automatically |
Every order event carries amount_cents (the amount charged; 0 for failed orders) and, for orders placed by channel, channel_id. Each request also carries X-Webhook-Event with the event type.
Example payloads
order.number_allocated
{
"event_type": "order.number_allocated",
"order_id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93",
"service_code": "string",
"country_code": "string",
"phone_number": "+15550142290",
"status": "active",
"allocated_at": "2026-12-01T09:00:00Z",
"amount_cents": 43,
"channel_id": "string"
}
order.completed
{
"event_type": "order.completed",
"order_id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93",
"service_code": "string",
"country_code": "string",
"phone_number": "+15550142290",
"sms_code": "string",
"sms_content": "string",
"completed_at": "2026-12-01T09:00:00Z",
"amount_cents": 43,
"channel_id": "string"
}
order.failed
{
"event_type": "order.failed",
"order_id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93",
"service_code": "string",
"country_code": "string",
"status": "failed",
"error_code": "NO_NUMBERS_AVAILABLE",
"failed_at": "2026-12-01T09:00:00Z",
"amount_cents": 0,
"channel_id": "string"
}
order.expired
{
"event_type": "order.expired",
"order_id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93",
"service_code": "string",
"country_code": "string",
"phone_number": "+15550142290",
"status": "expired",
"expired_at": "2026-12-01T09:00:00Z",
"amount_cents": 43,
"channel_id": "string"
}
Verify the signature
Every delivery carries X-Webhook-Signature: sha256=<hex>: an HMAC-SHA256 of the raw request body keyed with your webhook secret. Compute it yourself and compare in constant time before trusting the payload.
import crypto from "node:crypto";
function verify(rawBody, header, secret) {
const expected = "sha256=" + crypto
.createHmac("sha256", secret)
.update(rawBody) // raw bytes, not parsed JSON
.digest("hex");
const sig = Buffer.from(header || "", "utf8");
const exp = Buffer.from(expected, "utf8");
// length check first: timingSafeEqual throws on unequal lengths
return sig.length === exp.length && crypto.timingSafeEqual(sig, exp);
}
import hashlib, hmac
def verify(raw_body: bytes, header: str, secret: str) -> bool:
expected = "sha256=" + hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, header or "")
Delivery and retries
Respond with a 2xx quickly (within 10 seconds). A failed delivery is retried up to 5 times with backoff: 30s → 5m → 30m → 2h. Delivery is best-effort, so make your handler idempotent: the same event can arrive more than once.
Reconciliation
Watch failed deliveries in the dashboard's delivery history. Polling doubles as your reconciliation path: GET /orders?status=pending,active shows anything a missed event left open. See Order status.