API Documentation

Integrate SMS Localhost into your application with our REST API.

Using WhatsApp? There's a dedicated guide. Connecting your number, agents, templates, campaigns and the WhatsApp REST API

Authentication

All API requests require an API key passed via the X-API-KEY header.

curl -H "X-API-KEY: your_api_key_here" \ https://sms.localhost.co.zw/api/v1/sms/history/
import requests headers = {"X-API-KEY": "your_api_key_here"} response = requests.get( "https://sms.localhost.co.zw/api/v1/sms/history/", headers=headers ) print(response.json())
const response = await fetch( "https://sms.localhost.co.zw/api/v1/sms/history/", { headers: { "X-API-KEY": "your_api_key_here" } } ); const data = await response.json(); console.log(data);
$ch = curl_init("https://sms.localhost.co.zw/api/v1/sms/history/"); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "X-API-KEY: your_api_key_here" ]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $data = json_decode($response, true);
HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://sms.localhost.co.zw/api/v1/sms/history/")) .header("X-API-KEY", "your_api_key_here") .build(); HttpResponse<String> response = client.send( request, HttpResponse.BodyHandlers.ofString() ); System.out.println(response.body());

Generate API keys from your API Keys page in the dashboard.

Auth

GET POST /api/v1/auth/keys/

List active API keys or create a new one.

POST body: name

DELETE /api/v1/auth/keys/{key_id}/

Revoke an API key.

SMS

POST /api/v1/sms/send/

Send an SMS message.

Body: to (phone number), sender (approved Sender ID), message

curl -X POST https://sms.localhost.co.zw/api/v1/sms/send/ \ -H "X-API-KEY: your_api_key" \ -H "Content-Type: application/json" \ -d '{"to": "0771234567", "sender": "MyBrand", "message": "Hello!"}'
import requests response = requests.post( "https://sms.localhost.co.zw/api/v1/sms/send/", headers={ "X-API-KEY": "your_api_key", "Content-Type": "application/json", }, json={ "to": "0771234567", "sender": "MyBrand", "message": "Hello!" } ) print(response.json()) # {"message_id": "...", "channel": "sms", "status": "sent", ...}
const response = await fetch( "https://sms.localhost.co.zw/api/v1/sms/send/", { method: "POST", headers: { "X-API-KEY": "your_api_key", "Content-Type": "application/json", }, body: JSON.stringify({ to: "0771234567", sender: "MyBrand", message: "Hello!", }), } ); const data = await response.json(); console.log(data); // {message_id: "...", channel: "sms", status: "sent", ...}
$ch = curl_init("https://sms.localhost.co.zw/api/v1/sms/send/"); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ "X-API-KEY: your_api_key", "Content-Type: application/json", ], CURLOPT_POSTFIELDS => json_encode([ "to" => "0771234567", "sender" => "MyBrand", "message" => "Hello!", ]), CURLOPT_RETURNTRANSFER => true, ]); $response = curl_exec($ch); $data = json_decode($response, true); print_r($data);
String json = """ {"to":"0771234567","sender":"MyBrand","message":"Hello!"} """; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://sms.localhost.co.zw/api/v1/sms/send/")) .header("X-API-KEY", "your_api_key") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); HttpResponse<String> response = client.send( request, HttpResponse.BodyHandlers.ofString() ); System.out.println(response.body());

Success response:

{ "message_id": "a1b2c3d4-...", "channel": "sms", "status": "sent", "to": "0771234567", "sender": "MyBrand", "sms_credits": 142 }
GET /api/v1/sms/history/

Retrieve the last 100 sent messages.

Optional query: ?channel=sms

curl https://sms.localhost.co.zw/api/v1/sms/history/ \ -H "X-API-KEY: your_api_key"
import requests response = requests.get( "https://sms.localhost.co.zw/api/v1/sms/history/", headers={"X-API-KEY": "your_api_key"} ) messages = response.json()["messages"] for msg in messages: print(f"{msg['recipient']}: {msg['status']}")
const response = await fetch( "https://sms.localhost.co.zw/api/v1/sms/history/", { headers: { "X-API-KEY": "your_api_key" } } ); const { messages } = await response.json(); messages.forEach(msg => console.log(`${msg.recipient}: ${msg.status}`) );
$ch = curl_init("https://sms.localhost.co.zw/api/v1/sms/history/"); curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-KEY: your_api_key"]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $data = json_decode(curl_exec($ch), true); foreach ($data["messages"] as $msg) { echo $msg["recipient"] . ": " . $msg["status"] . "\n"; }
GET POST /api/v1/sms/senders/

List your Sender IDs or request a new one.

POST body: sender_name (3-11 alphanumeric characters)

GET /api/v1/sms/testers/

List your verified tester numbers.

Sandbox keys

A sandbox key lets you build against /api/v1/sms/send/ without sending anything, spending credits or waiting for a sender ID. Create one on the API Keys page with Mode: Sandbox; it starts with test_ so you can tell it apart on sight.

  • The request is validated exactly like a live one: body shape, sender format (3 to 11 letters, digits and spaces), numbers outside Zimbabwe refused with the live error, content guards applied. A 400 in sandbox is a 400 in production.
  • Any well-formed sender is treated as approved, so you can integrate before your sender ID is granted. Nothing reaches a network, no credits move and nothing appears in your history.
  • The response is the live shape plus "sandbox": true, "billed": 0, "credits_required" (what the live send would cost), the detected network, and a provider_message_id starting sandbox..
  • An sms.delivered webhook fires straight away. Send to a number ending in 0000 to get sms.failed instead. See Sandbox events for which endpoints receive them.
  • Reseller keys may pass X-Sub-Account as usual; the simulated send runs as that sub-account.
  • Every other SMS endpoint (history, senders, testers) and all of contacts, campaigns and billing refuse a sandbox key with 403, so a key left in the wrong config can never spend real credits.

WhatsApp

Send to any number from your connected WhatsApp Business number. All four endpoints take to as a full international number (8–15 digits; + and spaces are ignored) and an optional client_reference (up to 64 characters): a retry with the same reference returns the original send with "duplicate": true instead of sending twice. A 200 means Meta accepted the message; use the status webhooks to learn whether it arrived. Inbox, agents and templates are covered in the WhatsApp guide.

POST /api/v1/whatsapp/send-template/

Send an approved template to any number, whether or not they have messaged you. This is the only way to reach someone whose 24-hour window is closed. One credit per message, except utility and service templates sent while the window is open, which are free because Meta does not charge for them either.

Body: to, template_name, language (default en), components (Meta's template components, optional), client_reference (optional)

Errors: 402 insufficient credits, 429 API key credit limit reached, 404 WhatsApp not connected

curl -X POST https://sms.localhost.co.zw/api/v1/whatsapp/send-template/ \ -H "X-API-KEY: your_api_key" \ -H "Content-Type: application/json" \ -d '{"to": "+263771234567", "template_name": "incident_alert", "language": "en", "components": [{"type": "body", "parameters": [{"type": "text", "text": "db-1"}]}], "client_reference": "incident:41"}'
import requests response = requests.post( "https://sms.localhost.co.zw/api/v1/whatsapp/send-template/", headers={"X-API-KEY": "your_api_key"}, json={ "to": "+263771234567", "template_name": "incident_alert", "language": "en", "components": [{"type": "body", "parameters": [{"type": "text", "text": "db-1"}]}], "client_reference": "incident:41", }, ) print(response.json())

Success response:

{ "message_id": "a1b2c3d4-...", "provider_message_id": "wamid...", "status": "sent", "to": "263771234567", "channel": "whatsapp", "billed": 1, "window": "closed", "billing_reason": "...", "sms_credits": 141 }

The next three are free-form: Meta allows them only while the customer's 24-hour window is open (they messaged you in the last 24 hours), and charges nothing for them there, so they always return "billed": 0. A closed window — or a number that has never messaged you — is refused with 409 and "window": "closed"; send a template instead. A body Meta would reject is a 400 whose error names the field.

POST /api/v1/whatsapp/send-text/

Plain text into an open window — typically the reply that closes a loop after someone taps a button.

Body: to, body (up to 4096 characters), client_reference (optional)

curl -X POST https://sms.localhost.co.zw/api/v1/whatsapp/send-text/ \ -H "X-API-KEY: your_api_key" \ -H "Content-Type: application/json" \ -d '{"to": "+263771234567", "body": "Acknowledged.", "client_reference": "ack:41"}'

Success response:

{ "message_id": "a1b2c3d4-...", "provider_message_id": "wamid...", "status": "sent", "to": "263771234567", "channel": "whatsapp", "billed": 0, "window": "open", "billing_reason": "free inside the 24h service window", "sms_credits": 142 }
POST /api/v1/whatsapp/send-media/

An image, video, audio clip or document into an open window. Meta downloads the file from url, so it must be publicly reachable and https:// — a plain-http link could be swapped by anyone in between.

Body: to, media_type (image, video, audio or document), url (https, up to 500 characters), caption (optional, up to 1024; not allowed on audio), filename (optional, up to 240; document only), client_reference (optional)

Response is the same shape as send-text.

curl -X POST https://sms.localhost.co.zw/api/v1/whatsapp/send-media/ \ -H "X-API-KEY: your_api_key" \ -H "Content-Type: application/json" \ -d '{"to": "+263771234567", "media_type": "image", "url": "https://example.com/graph.png", "caption": "CPU, last hour", "client_reference": "graph:41"}'
POST /api/v1/whatsapp/send-interactive/

Reply buttons, a list, or a call-to-action link into an open window. interactive is Meta's own interactive object and is sent as given once it passes Meta's documented limits. Buttons are what let a reply come back with a machine-readable id: a tap arrives as a whatsapp.button_reply webhook carrying the button's id in button_id.

Body: to, interactive (type button, list or cta_url), client_reference (optional)

Limits: body text 1024; button: 1–3 reply buttons, unique ids (256), titles 20; list: 1–10 sections, 10 rows in total, unique row ids (200), row title 24, description 72, section title 24 (required with more than one section), list button 20; cta_url: display_text 20 and an https url. Optional header: text (60) or an image, video or document with an https link. Optional footer: 60.

Response is the same shape as send-text.

curl -X POST https://sms.localhost.co.zw/api/v1/whatsapp/send-interactive/ \ -H "X-API-KEY: your_api_key" \ -H "Content-Type: application/json" \ -d '{"to": "+263771234567", "interactive": { "type": "button", "body": {"text": "web-1 is down. Restart it?"}, "action": {"buttons": [ {"type": "reply", "reply": {"id": "restart:41", "title": "Restart"}}, {"type": "reply", "reply": {"id": "ignore:41", "title": "Ignore"}} ]} }, "client_reference": "restart:41"}'

Sandbox keys

A sandbox key lets you build and test against the four endpoints above without sending anything or spending credits. Create one on the API Keys page with Mode: Sandbox; it starts with test_ so you can tell it apart on sight.

  • Requests are validated exactly like live ones, so a 400 in sandbox is a 400 in production. After that nothing reaches Meta, no credits are used, and no WhatsApp number needs to be connected. The window is always treated as open.
  • The response is the live shape with "billed": 0, "sandbox": true, and a provider_message_id starting sandbox..
  • client_reference behaves as it does live: a retry returns the original response with "duplicate": true. References are remembered for 7 days.
  • whatsapp.sent and whatsapp.delivered webhooks fire straight away. Send to a number ending in 0000 to get whatsapp.failed instead, with Meta's real error 131026. See Sandbox events for which endpoints receive them.
  • The same key works on /api/v1/sms/send/. Every other endpoint (SMS history, contacts, campaigns, billing, the updates WebSocket) refuses it with 403 and {"error": "Sandbox keys can only be used with the SMS send and WhatsApp APIs"}, so a key left in the wrong config can never spend real credits.

Contacts

GET POST /api/v1/contacts/

List contacts or create a new one.

POST body: phone, first_name, last_name (optional), email (optional)

# Create a contact curl -X POST https://sms.localhost.co.zw/api/v1/contacts/ \ -H "X-API-KEY: your_api_key" \ -H "Content-Type: application/json" \ -d '{"phone": "0771234567", "first_name": "John", "last_name": "Doe"}'
import requests # Create a contact response = requests.post( "https://sms.localhost.co.zw/api/v1/contacts/", headers={ "X-API-KEY": "your_api_key", "Content-Type": "application/json", }, json={ "phone": "0771234567", "first_name": "John", "last_name": "Doe", } ) print(response.json())
// Create a contact const response = await fetch( "https://sms.localhost.co.zw/api/v1/contacts/", { method: "POST", headers: { "X-API-KEY": "your_api_key", "Content-Type": "application/json", }, body: JSON.stringify({ phone: "0771234567", first_name: "John", last_name: "Doe", }), } ); console.log(await response.json());
// Create a contact $ch = curl_init("https://sms.localhost.co.zw/api/v1/contacts/"); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ "X-API-KEY: your_api_key", "Content-Type: application/json", ], CURLOPT_POSTFIELDS => json_encode([ "phone" => "0771234567", "first_name" => "John", "last_name" => "Doe", ]), CURLOPT_RETURNTRANSFER => true, ]); $data = json_decode(curl_exec($ch), true);
GET PUT DELETE /api/v1/contacts/{contact_id}/

Retrieve, update, or delete a single contact.

GET POST /api/v1/contacts/groups/

List contact groups or create a new one.

Campaigns

GET POST /api/v1/campaigns/

List campaigns or create a new one.

POST body: name, message, sender_name, group_id

curl -X POST https://sms.localhost.co.zw/api/v1/campaigns/ \ -H "X-API-KEY: your_api_key" \ -H "Content-Type: application/json" \ -d '{ "name": "March Promo", "message": "Hi {name}, enjoy 20% off this week!", "sender_name": "MyBrand", "group_id": "your_group_uuid" }'
import requests response = requests.post( "https://sms.localhost.co.zw/api/v1/campaigns/", headers={ "X-API-KEY": "your_api_key", "Content-Type": "application/json", }, json={ "name": "March Promo", "message": "Hi {name}, enjoy 20% off this week!", "sender_name": "MyBrand", "group_id": "your_group_uuid", } ) campaign = response.json() print(f"Campaign created: {campaign['id']}")
const response = await fetch( "https://sms.localhost.co.zw/api/v1/campaigns/", { method: "POST", headers: { "X-API-KEY": "your_api_key", "Content-Type": "application/json", }, body: JSON.stringify({ name: "March Promo", message: "Hi {name}, enjoy 20% off this week!", sender_name: "MyBrand", group_id: "your_group_uuid", }), } ); const campaign = await response.json(); console.log(`Campaign created: ${campaign.id}`);
POST /api/v1/campaigns/{campaign_id}/send/

Launch a campaign for sending.

POST /api/v1/campaigns/{campaign_id}/pause/

Pause a running campaign.

POST /api/v1/campaigns/{campaign_id}/cancel/

Cancel a campaign.

Billing

GET /api/v1/billing/balance/

Get your current SMS credit balance.

curl https://sms.localhost.co.zw/api/v1/billing/balance/ \ -H "X-API-KEY: your_api_key"
import requests response = requests.get( "https://sms.localhost.co.zw/api/v1/billing/balance/", headers={"X-API-KEY": "your_api_key"} ) data = response.json() print(f"Credits remaining: {data['sms_credits']}")
const response = await fetch( "https://sms.localhost.co.zw/api/v1/billing/balance/", { headers: { "X-API-KEY": "your_api_key" } } ); const data = await response.json(); console.log(`Credits remaining: ${data.sms_credits}`);
$ch = curl_init("https://sms.localhost.co.zw/api/v1/billing/balance/"); curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-KEY: your_api_key"]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $data = json_decode(curl_exec($ch), true); echo "Credits remaining: " . $data["sms_credits"];
GET /api/v1/billing/transactions/

View your transaction history.

Reseller API RESELLERS

Approved resellers manage sub-accounts — one per client, each with its own credit balance, API keys, sender IDs and history. Credits are moved from your pool into a sub-account and can be pulled back; nothing here is priced in money. Everything below is called with your reseller key. Not a reseller yet? Apply from the dashboard under Reseller.

POST any endpoint with header X-Sub-Account

Act as one of your sub-accounts with your own key. Pass our sub-account id or the external_ref you gave it. The call then uses that sub-account's credits, sender IDs and history — on /sms/send/, /sms/history/, /billing/balance/, contacts, campaigns, everything. Alternatively, issue the sub-account its own key (below) and call without the header.

curl -X POST https://sms.localhost.co.zw/api/v1/sms/send/ \ -H "X-API-KEY: your_reseller_key" \ -H "X-Sub-Account: acme-pharmacy" \ -H "Content-Type: application/json" \ -d '{"to": "0771234567", "sender": "MyBrand", "message": "Hello!"}'
import requests requests.post( "https://sms.localhost.co.zw/api/v1/sms/send/", headers={ "X-API-KEY": "your_reseller_key", "X-Sub-Account": "acme-pharmacy", # your external_ref or our id }, json={"to": "0771234567", "sender": "MyBrand", "message": "Hello!"}, )

A sub-account may send with its own approved sender IDs and any of yours. A sub-account with no credits gets 202 credit_queued; the message goes out as soon as you allocate.

GET /api/v1/reseller/summary/

Your pool balance, total held by sub-accounts, and every sub-account with its balance and 30-day send count.

GET POST /api/v1/reseller/sub-accounts/

List sub-accounts (?include_inactive=1 for deactivated ones), or create one.

Body: name, external_ref (optional — your own client id, unique within your account)

curl -X POST https://sms.localhost.co.zw/api/v1/reseller/sub-accounts/ \ -H "X-API-KEY: your_reseller_key" \ -H "Content-Type: application/json" \ -d '{"name": "Acme Pharmacy", "external_ref": "acme-pharmacy"}' # 201 {"sub_account": {"id": "…", "name": "Acme Pharmacy", "external_ref": "acme-pharmacy", "sms_credits": 0, "is_active": true, "created_at": "…", "sent_last_30_days": 0}}
GET PATCH DELETE /api/v1/reseller/sub-accounts/{id_or_ref}/

Read one sub-account (with its active keys), rename it or change its external_ref, or deactivate it — which returns its remaining credits to your pool and revokes its keys. History is kept.

POST /api/v1/reseller/sub-accounts/{id_or_ref}/allocate/

Move credits from your pool into the sub-account. Fails with 402 if your pool cannot cover it; nothing moves in that case.

Body: credits (positive integer)

curl -X POST https://sms.localhost.co.zw/api/v1/reseller/sub-accounts/acme-pharmacy/allocate/ \ -H "X-API-KEY: your_reseller_key" \ -H "Content-Type: application/json" \ -d '{"credits": 500}' # 200 {"allocated": 500, "sub_account": {"…": "…", "sms_credits": 500}, "pool_credits": 9500}
POST /api/v1/reseller/sub-accounts/{id_or_ref}/reclaim/

Move credits back from the sub-account into your pool. 409 if it holds fewer than asked.

Body: credits (positive integer)

GET POST /api/v1/reseller/sub-accounts/{id_or_ref}/keys/

List or create API keys bound to the sub-account. A key made here can only act as that sub-account — hand it to your client or keep it in your platform. The full key is returned once. Revoke with DELETE …/keys/{key_id}/.

Body: name

GET /api/v1/reseller/sub-accounts/{id_or_ref}/transactions/

The sub-account's credit ledger — allocations in, sends out — last 100 rows, credits only.

GET POST /api/v1/reseller/sub-accounts/{id_or_ref}/sender-ids/

List every sender ID the sub-account holds, or order a new one for it. You collect any fee from your client; we charge nothing for the order and record the fee you tell us, so you can reconcile. The name then goes through the usual approval. Sending the same reference again for the same name returns the existing order with 200.

Body: sender_name (3 to 11 letters, digits and spaces, at least one letter), business_name, purpose, sample_message, reference (your order id, unique), fee (optional, e.g. {"amount": "5.00", "currency": "USD"}). 409 with code name_taken or reference_conflict.

curl -X POST https://sms.localhost.co.zw/api/v1/reseller/sub-accounts/acme-pharmacy/sender-ids/ \ -H "X-API-KEY: your_reseller_key" \ -H "Content-Type: application/json" \ -d '{"sender_name": "AcmePharm", "business_name": "Acme Pharmacy (Pvt) Ltd", "purpose": "Prescription reminders", "sample_message": "Your prescription is ready. Acme Pharmacy.", "reference": "order-1042", "fee": {"amount": "5.00", "currency": "USD"}}' # 201 {"sender_id": {"id": "…", "sender_name": "AcmePharm", "status": "pending", "note": "", "suggestion": "", "reference": "order-1042", "fee": {"amount": "5.00", "currency": "USD"}, "sub_account": {"id": "…", "external_ref": "acme-pharmacy"}, "created_at": "…", "decided_at": null}}

On a rejection, note gives the reason and suggestion may offer an alternative name that was free when we reviewed it.

GET /api/v1/reseller/sender-ids/

Every sender ID you have ordered, across all sub-accounts, newest first. Filter with ?status=pending|approved|rejected|frozen and ?since= an ISO-8601 date or time (when the order was placed).

Subscribe to sender_id.approved, sender_id.rejected and sender_id.frozen on the Webhooks page to hear the outcome as it happens.

Webhooks: your webhook endpoints also receive every sub-account's events, with a sub_account object (id, name, external_ref) added to the payload so you can route them.

Not available to sub-accounts: buying credits, redeeming tokens, requesting sender IDs (order them above), team/profile endpoints, and WhatsApp. Those belong to the reseller.

LinksAPI BETA

LinksAPI automatically shortens links in your outgoing messages using branded rerout.co short links. Shorter links use fewer 160-character SMS segments — so you spend fewer credits — and every link gets click analytics. It applies to SMS sent from the dashboard, the Send API, and campaigns, plus free-text WhatsApp messages.

There is nothing to call — it runs server-side at send time. Turn it on per organization at LinksAPI in your dashboard; from then on any https:// link in your message is replaced automatically before it is sent and billed.

Link modes

  • Per URL (shared) — one short link per destination, reused across recipients. Most efficient; analytics are aggregated per link. URLs too short to save space are left untouched.
  • Per recipient (trackable) — a unique short link per recipient, so clicks can be attributed individually. Every link is shortened (even short ones) for full tracking.

One-time links

In per-recipient mode you can enable one-time links: each link stops redirecting after its first click — ideal for single-use survey or verification links. The first click is served, then the link is deactivated automatically.

Analytics

Total clicks plus top countries and referrers are shown for every link on your LinksAPI page. Click data is aggregated and never exposes recipients' raw IP addresses.

MNO Status

Check the live delivery status of Zimbabwean mobile network operators (NetOne, Econet, Telecel) so your application can react to carrier-side incidents — e.g. pause sends, switch fallback routes, or surface a banner to your own users. You can also subscribe to webhook events that fire the moment a status changes (see Webhooks).

GET /api/v1/status/

Returns the current status for every MNO. Possible state values: operational, degraded, outage, maintenance.

curl https://sms.localhost.co.zw/api/v1/status/ \ -H "X-API-KEY: your_api_key"
import requests statuses = requests.get( "https://sms.localhost.co.zw/api/v1/status/", headers={"X-API-KEY": "your_api_key"}, ).json() for s in statuses: if s["state"] != "operational": print(f"{s['mno_display']} is {s['state']}: {s['note']}")
const res = await fetch( "https://sms.localhost.co.zw/api/v1/status/", { headers: { "X-API-KEY": "your_api_key" } } ); const statuses = await res.json(); statuses .filter(s => s.state !== "operational") .forEach(s => console.warn(`${s.mno_display}: ${s.state}`));

Sample response

[ {"mno":"netone", "mno_display":"NetOne", "state":"outage", "state_display":"Outage", "note":"NetOne core network issue, ETA 2h", "updated_at":"2026-05-12T10:00:00Z"}, {"mno":"econet", "mno_display":"Econet", "state":"operational", "state_display":"Operational", "note":"", "updated_at":"2026-05-10T08:32:11Z"}, {"mno":"telecel", "mno_display":"Telecel", "state":"operational", "state_display":"Operational", "note":"", "updated_at":"2026-05-10T08:32:11Z"} ]
GET /api/v1/status/incidents/

History of state transitions. Optional query params: mno=netone|econet|telecel, limit=N (default 50, max 200). Incidents with ended_at: null are still in progress.

curl "https://sms.localhost.co.zw/api/v1/status/incidents/?mno=netone&limit=10" \ -H "X-API-KEY: your_api_key"

Webhooks

Webhooks let us POST events to your server the instant they happen — no polling required. Register an endpoint at Settings → Webhooks, tick the events you care about, and copy the signing secret we generate (shown only once).

How it works

  1. Create a webhook with an HTTPS URL on your server.
  2. Pick which events to subscribe to (or leave empty to receive all). Available events:
    • sms.delivered — an SMS reached its recipient
    • sms.failed — an SMS failed delivery
    • mno.status.changed — an MNO's delivery state changed (outage, degraded, recovered, maintenance)
    • message.inbound — someone replied to you
    • whatsapp.button_reply — someone tapped a button on a WhatsApp message
    • whatsapp.sent — Meta sent a WhatsApp message to the recipient's phone
    • whatsapp.delivered — a WhatsApp message reached its recipient
    • whatsapp.read — the recipient opened a WhatsApp message (only if they have read receipts on)
    • whatsapp.failed — Meta could not deliver a WhatsApp message; carries error_code and error_details
  3. We POST a JSON body to your URL with an X-Webhook-Signature header (HMAC-SHA256 of the raw body, hex-encoded, using your secret).
  4. Respond with HTTP 2xx within 10 seconds. Non-2xx responses are retried once after 10 seconds; after that the delivery is logged as failed.

MNO status payload

POST https://your-server.com/webhook Content-Type: application/json X-Webhook-Signature: 4f9c1a...e7 { "event": "mno.status.changed", "mno": "netone", "previous_state": "operational", "state": "outage", "note": "NetOne core network issue, ETA 2h", "incident_id": "5b6f2e4c-...", "timestamp": "2026-05-12T10:00:00Z" }

Inbound reply payload

Sent when someone replies to you. A tap on a WhatsApp button arrives as whatsapp.button_reply and carries the button's payload in button_id, exactly as you set it — so a single-use token you put on a button comes back to you untouched.

POST https://your-server.com/webhook Content-Type: application/json X-Webhook-Signature: 8b2e70...c4 { "event": "whatsapp.button_reply", "from": "263771234567", "to": "104512...", "body": "Acknowledge", "button_id": "ack:AbC-123_x", "channel": "whatsapp", "provider_message_id": "wamid...", "timestamp": "2026-08-15T09:14:02Z" }

WhatsApp status payload

All four whatsapp.* status events share one shape, with the error fields blank (and error_code null) unless the status is failed. message_id is the id the send endpoint returned, so you can match the event without storing Meta's id. Branch on error_code rather than the error title: the title cannot tell a number that is not on WhatsApp from one outside the 24-hour window, the code can.

Statuses only move forward. Meta reports them out of order and repeats them, so an event that would move a message backwards, or repeat one already sent, is dropped. You get each event at most once per message, but not necessarily every one: if read arrives before delivered, no delivered follows. failed is final.

POST https://your-server.com/webhook Content-Type: application/json X-Webhook-Signature: 1d93ab...02 { "event": "whatsapp.failed", "message_id": "a1b2c3d4-...", "provider_message_id": "wamid...", "recipient": "+263771234567", "sender": "+263242000000", "channel": "whatsapp", "status": "failed", "error": "Message undeliverable", "error_code": 131026, "error_details": "Unable to deliver message. Reasons can include: the recipient phone number is not a WhatsApp phone number.", "timestamp": "2026-11-06T09:14:02Z" }

Sandbox events

Sends made with a sandbox key (SMS or WhatsApp) fire simulated status events. They are delivered only to webhooks with Also receive sandbox events ticked, and carry "sandbox": true in the body plus an X-Webhook-Sandbox: true header, so you can drop them before parsing. They are signed with your real secret — the opt-in exists so that whoever holds a sandbox key cannot send convincing failure events to a production endpoint that has never heard of sandbox mode.

Verifying the signature

Always verify X-Webhook-Signature against the raw request body — not a re-serialized JSON — using your webhook's secret:

import hmac, hashlib from flask import Flask, request, abort SECRET = b"your_webhook_secret" app = Flask(__name__) @app.post("/webhook") def webhook(): expected = hmac.new(SECRET, request.get_data(), hashlib.sha256).hexdigest() got = request.headers.get("X-Webhook-Signature", "") if not hmac.compare_digest(expected, got): abort(401) event = request.get_json() if event["event"] == "mno.status.changed" and event["state"] in ("outage", "degraded"): pause_sends_for(event["mno"]) return "", 204
const express = require("express"); const crypto = require("crypto"); const app = express(); const SECRET = "your_webhook_secret"; app.post("/webhook", express.raw({ type: "application/json" }), (req, res) => { const expected = crypto.createHmac("sha256", SECRET).update(req.body).digest("hex"); const got = req.headers["x-webhook-signature"] || ""; if (!crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(got))) return res.sendStatus(401); const event = JSON.parse(req.body.toString()); if (event.event === "mno.status.changed" && ["outage", "degraded"].includes(event.state)) { pauseSendsFor(event.mno); } res.sendStatus(204); });
$secret = "your_webhook_secret"; $body = file_get_contents("php://input"); $expected = hash_hmac("sha256", $body, $secret); $got = $_SERVER["HTTP_X_WEBHOOK_SIGNATURE"] ?? ""; if (!hash_equals($expected, $got)) { http_response_code(401); exit; } $event = json_decode($body, true); if ($event["event"] === "mno.status.changed" && in_array($event["state"], ["outage", "degraded"])) { pause_sends_for($event["mno"]); } http_response_code(204);

Rate Limits

Endpoint Limit
/api/v1/sms/send/ 60 requests per minute (per user)

Error Responses

All errors return a JSON object with an error key.

{"error": "Insufficient SMS credits."}
Status Meaning
400 Bad request — check your request body
401 Unauthorized — invalid or missing API key
402 Insufficient SMS credits
403 Sender not approved or insufficient permissions
404 Resource not found
409 Conflict — resource already exists
429 Rate limit exceeded — slow down