API Documentation
Integrate SMS messaging into your application with our REST API. Send single messages or batch campaigns with just a few lines of code.
Authentication
The API uses HTTP Basic Authentication with your API key and secret.
Basic Authentication
Use your API key and secret for server-to-server integrations.
Send your API key and secret as a Base64-encoded apiKey:apiSecret pair in the Authorization header.
Example with a key my-api-key and secret my-api-secret:
Generate API keys
Create and manage API keys from Settings > API Keys in your dashboard. Each key can be scoped to a specific project and organization.
Base URL
Send SMS
Send a single SMS message to a phone number. Returns immediately with a message ID you can use to track delivery status.
Endpoint
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| channel | string | Yes | Set to "Sms" |
| to | string | Yes | Recipient phone number in E.164 format |
| body | string | Yes* | Message content (or use templateId) |
| from | string | No | Sender ID or phone number |
| templateId | number | No | Use a saved template instead of inline body |
| variables | object | No | Key-value pairs for template variable substitution |
| priority | string | No | Low Normal Medium High |
| clientReference | string | No | Your own reference (up to 128 characters), returned by GET /api/messages/{id} and in every status webhook |
| callbackUrl | string | No | Where to POST status webhooks for this message. Must be https on a public host name (no IP addresses, localhost or private networks) |
Send an Idempotency-Key header (up to 128 characters) to make retries safe: a repeat with the same key returns the original message with 200 OK and "idempotent": true instead of sending (and charging) twice.
Segments and cost
Long texts travel as several SMS parts (segments) and each segment is billed. A body written only in the GSM-7 alphabet fits 160 characters in one segment and 153 per segment beyond that; the characters ^ { } \ [ ~ ] | €count as two. Any other character (accents outside GSM-7, other scripts, emoji) switches the whole message to UCS-2: 70 characters in one segment, 67 per segment beyond that, emoji counting as two. A message costs (rate + fees) × segments, the rate being the one for the destination number's longest matching prefix on the chosen route. GET /api/messages/estimate?destination=…&text=… counts the segments of text for you.
Example request
curl -X POST /api/messages \ -u "YOUR_API_KEY:YOUR_API_SECRET" \ -H "Content-Type: application/json" \ -d '{ "channel": "Sms", "to": "+18765551234", "body": "Hi Jane, your order #1042 has shipped!", "from": "+0987654321", "priority": "Normal", "clientReference": "order-1042", "callbackUrl": "https://example.com/webhooks/smsx" }'
Example response
{
"id": 984301,
"status": "Pending",
"channel": "Sms",
"to": "+18765551234",
"segments": 1,
"encoding": "GSM-7",
"countryCode": "JM",
"estimatedCost": 0.02,
"currencyCode": "USD",
"clientReference": "order-1042"
}Response fields
| Field | Type | Description |
|---|---|---|
| id | number | Message ID |
| status | string | Always Pending on creation (see statuses) |
| channel | string | Sms |
| to | string | Recipient |
| segments | number | SMS segments the body needs (billed per segment) |
| encoding | string | GSM-7 or UCS-2 |
| countryCode | string | null | ISO 3166-1 alpha-2 country of the recipient |
| estimatedCost | number | null | (rate + fees) × segments on the route the message will most likely take; null when no route is available right now. The final cost arrives with the status webhooks and GET /api/messages/{id} |
| currencyCode | string | null | Currency of estimatedCost |
| clientReference | string | null | Your reference, echoed |
| idempotent | boolean | Only on an Idempotency-Key replay (200 OK): true |
Send Batch SMS
Send SMS messages to multiple recipients in a single request. Supply recipients directly, reference contact lists or groups, or combine all three. Batches are processed asynchronously.
Endpoint
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| channel | string | Yes | Set to "Sms" |
| body | string | Yes* | Message content (or use templateId) |
| name | string | No | A name to identify this batch campaign |
| recipients | string[] | No* | Array of phone numbers in E.164 format |
| detailedRecipients | object[] | No* | Recipients with per-recipient variables: { destination, variables } |
| listIds | number[] | No* | Send to contacts in these saved lists |
| groupIds | number[] | No* | Send to contacts in these groups |
| scheduledAt | string | No | ISO 8601 datetime to schedule delivery |
| priority | string | No | Low Normal Medium High |
recipients, detailedRecipients, listIds, or groupIds.Example — simple batch
curl -X POST /api/messages/batch \ -u "YOUR_API_KEY:YOUR_API_SECRET" \ -H "Content-Type: application/json" \ -d '{ "channel": "Sms", "name": "Order updates", "body": "Hi! Your order is on its way.", "recipients": [ "+1234567890", "+0987654321", "+1122334455" ] }'
Example — personalized batch with variables
curl -X POST /api/messages/batch \ -u "YOUR_API_KEY:YOUR_API_SECRET" \ -H "Content-Type: application/json" \ -d '{ "channel": "Sms", "name": "Welcome campaign", "body": "Hi {{name}}, welcome to {{company}}!", "isParameterized": true, "detailedRecipients": [ { "destination": "+1234567890", "variables": { "name": "Jane", "company": "Acme" } }, { "destination": "+0987654321", "variables": { "name": "John", "company": "Globex" } } ] }'
Example response
{
"id": 501220,
"status": "Loading",
"totalRecipients": 3
}Status webhooks
When a message sent with a callbackUrl is sent, delivered or fails, we POST a JSON event to that URL. Respond with any 2xx within 10 seconds. Anything else is retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours, then dropped. Delivery is at least once and events can arrive out of order, so dedupe by the event id and rely on status and occurredAt rather than arrival order.
Events
| Field | Type | Description |
|---|---|---|
| message.sent | event | The carrier accepted the message (status Sent) |
| message.delivered | event | The carrier confirmed delivery (status Delivered) |
| message.failed | event | The message failed (status Failed) or was rejected by compliance rules (status Rejected). If a provider refused it after you were charged, the charge is credited back once and refunded is true. A failure reported by the carrier after it accepted the message is not refunded. |
Example event
Content-Type: application/json
X-Smsx-Timestamp: 1760188902
X-Smsx-Signature: sha256=5d1c…e9
X-Smsx-Event-Id: 6f1d6c3e-8f43-4f0a-9b0e-0c2a7f6b9d11
X-Smsx-Event-Type: message.delivered
{
"id": "6f1d6c3e-8f43-4f0a-9b0e-0c2a7f6b9d11",
"type": "message.delivered",
"messageId": 984301,
"clientReference": "order-1042",
"status": "Delivered",
"to": "+18765551234",
"countryCode": "JM",
"segments": 1,
"encoding": "GSM-7",
"cost": 0.02,
"price": 0.02,
"fee": 0,
"currencyCode": "USD",
"refunded": false,
"error": null,
"occurredAt": "2026-10-10T14:03:22.418+00:00"
}Event fields
| Field | Type | Description |
|---|---|---|
| id | string | Event ID (also in X-Smsx-Event-Id); dedupe on it |
| type | string | message.sent, message.delivered or message.failed |
| messageId | number | The message |
| clientReference | string | null | Your reference from the send request |
| status | string | Sent, Delivered, Failed or Rejected |
| to | string | Recipient |
| countryCode | string | null | Recipient's country |
| segments | number | Segments billed |
| encoding | string | GSM-7 or UCS-2 |
| price | number | null | Rate × segments |
| fee | number | null | Fees × segments |
| cost | number | null | What was charged to your balance: price + fee, or 0 when package credits (one per segment) covered it; null when nothing was charged (e.g. insufficient funds, or failed before billing). price and fee are then null too |
| currencyCode | string | null | Currency of price, fee and cost |
| refunded | boolean | The charge was credited back (balance or package credits) |
| error | string | null | Why it failed |
| occurredAt | string | When the status changed (ISO 8601) |
Verifying the signature
Each delivery attempt carries X-Smsx-Timestamp (unix seconds, UTC, computed at the moment this attempt is sent — retries carry fresh timestamps) and X-Smsx-Signature of the form sha256= followed by the lowercase hex HMAC-SHA256 of the UTF-8 bytes of "<timestamp>.<body>", keyed with your project's webhook secret (UTF-8). Compute it over the raw bytes you received, before parsing, and compare in constant time. Also reject anything with a timestamp more than ~5 minutes from your clock to foil replay attacks. Retries of one event share X-Smsx-Event-Id — dedupe on it. Project owners and administrators can read the secret with GET /api/webhooks/secret and replace it with POST /api/webhooks/secret/rotate; a rotated secret signs every delivery from then on, retries of earlier events included.
// Node.js (Express: app.post(path, express.raw({ type: "application/json" }), ...))
import crypto from "node:crypto";
const TOLERANCE_SECONDS = 300; // ±5 minutes
const seen = new Set(); // persist this in a shared store in production
function verify(req, secret) {
const header = req.get("x-smsx-signature") ?? "";
const timestamp = Number(req.get("x-smsx-timestamp"));
const eventId = req.get("x-smsx-event-id") ?? "";
if (!Number.isFinite(timestamp)) return false;
if (Math.abs(Date.now() / 1000 - timestamp) > TOLERANCE_SECONDS) return false;
const expected = "sha256=" + crypto
.createHmac("sha256", secret)
.update(timestamp + "." + req.body.toString("utf8"))
.digest("hex");
if (header.length !== expected.length) return false;
if (!crypto.timingSafeEqual(Buffer.from(header), Buffer.from(expected))) return false;
if (seen.has(eventId)) return "duplicate"; // ack 200 but skip business logic
seen.add(eventId);
return true;
}// C#
const int toleranceSeconds = 300; // ±5 minutes
var header = request.Headers["X-Smsx-Signature"].ToString();
var timestampHeader = request.Headers["X-Smsx-Timestamp"].ToString();
var eventId = request.Headers["X-Smsx-Event-Id"].ToString();
if (!long.TryParse(timestampHeader, out var timestamp)) return Results.BadRequest();
if (Math.Abs(DateTimeOffset.UtcNow.ToUnixTimeSeconds() - timestamp) > toleranceSeconds)
return Results.BadRequest();
var signed = Encoding.UTF8.GetBytes($"{timestamp}.{Encoding.UTF8.GetString(rawBodyBytes)}");
var expected = "sha256=" + Convert.ToHexStringLower(
HMACSHA256.HashData(Encoding.UTF8.GetBytes(secret), signed));
if (!CryptographicOperations.FixedTimeEquals(
Encoding.ASCII.GetBytes(expected), Encoding.ASCII.GetBytes(header)))
return Results.Unauthorized();
// dedupe on eventId before applying the event — retries carry the same id.Message statuses
Track the lifecycle of each message through these statuses.
| Status | Description |
|---|---|
Pending | Message received, awaiting processing |
Queued | Routed and priced (charged), queued for delivery to carrier |
Sent | Handed off to the carrier network; webhook message.sent |
Delivered | Confirmed delivered to the recipient; webhook message.delivered |
Failed | Delivery failed (invalid number, carrier rejection, etc.); webhook message.failed |
Rejected | Rejected by policy or compliance rules (never charged); webhook message.failed |
Ready to start sending?
Create a free account and send your first SMS in minutes. No credit card required.

