SMS API documentation
Send one SMS, thousands, or a personalised message to every customer from your website or software, and know exactly what happened to each one.
How it works
- Your system sends a request to
https://sms.droomdazlean.com/api/v1/send. - The server checks it and queues the messages straight away. A successful answer (HTTP
200,"ok": true) means accepted and queued, not yet delivered. - Your connected phone sends the queued messages one by one at a steady, network-friendly pace (by default one every 10 seconds). Urgent sends of 10 numbers or fewer go first.
- Each message moves through pending → sending → sent → delivered (or failed). You can check its status at any time.
Base URL: https://sms.droomdazlean.com/api/v1 · Format: JSON (UTF-8) · Transport: HTTPS.
Authentication
Copy your API key from the SMS Gateway app and send it with every request in the X-API-Key header:
X-API-Key: YOUR_API_KEY
Authorization: Bearer YOUR_API_KEY works too. Spaces and lower case in the key are ignored.
Send one SMS
/api/v1/sendcurl -X POST https://sms.droomdazlean.com/api/v1/send \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to": "0771234567", "message": "Your order #1045 is ready for collection."}'
Answer: HTTP 200
{
"ok": true,
"duplicate": false,
"reference": null,
"batch_id": "b_674dbbb00b2719332187",
"count": 1,
"phone_online": true,
"invalid_count": 0,
"invalid": [],
"queue": {"waiting": 1, "send_interval_seconds": 10, "daily_limit": null,
"estimated_time": "10 seconds", "estimated_finish": "2026-11-22T06:45:53+02:00"},
"messages": [{"id": 406111, "to": "+263771234567", "status": "pending"}],
"messages_listed": 1
}
| Field | Meaning |
|---|---|
ok | true when the request was accepted. |
batch_id | Identifies this request. Use it to follow or cancel everything you sent in it. |
count | Number of messages queued. |
messages | One entry per message: its id (save it), the number in international format, and the status.
Large sends list the first 200; messages_listed says how many are listed. |
phone_online | false means the phone is offline right now: messages wait and go out when it reconnects. |
queue | How many messages wait for your phone in total, the sending pace, and when the last one should go out. |
invalid, invalid_count | Numbers that were skipped (only when you allow skipping, see below). |
duplicate, reference | See avoid duplicates. |
Request fields
| Field | Required | Description |
|---|---|---|
to | Yes* | One number, several separated by commas, or a JSON array of numbers. |
message | Yes* | The text (up to 5,000 characters). |
messages | No | A list of {"to", "message"} objects for different messages. |
file | No | A CSV file (multipart form upload). See CSV files. |
sim | No | The SIM to send from (see choose the SIM). Default: the phone's default SIM. |
reference | No | Your own unique id for this request, up to 100 characters (for example an invoice or order number). |
skip_invalid | No | true to send to the valid numbers when some are invalid. By default the whole request is refused so you can fix it. |
* Give recipients with to, messages or file, and a text with message or per recipient.
Phone numbers
Local Zimbabwe numbers such as 0771234567 or 771234567 become +263771234567.
Numbers in international format (+263…, 00263…, +27…) are kept. Spaces, dashes and brackets are ignored.
A Zimbabwe number must have 9 digits after +263.
Message length
One SMS holds 160 standard characters, or 70 if the text contains emoji or special characters. Longer texts are sent as several parts and joined on the recipient's phone; each part is charged by the network as one SMS.
Send the same message to many people
Put all the numbers in one request: a JSON array, or one string separated by commas. Duplicates are removed.
curl -X POST https://sms.droomdazlean.com/api/v1/send \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to": ["0771234567", "0712345678", "+263782345678"],
"message": "School closes on Friday at 12:00. Thank you."}'
The answer has one batch_id for the whole send and one id per message.
Send different messages to different people
Use messages: a list where each entry has its own number and text. Ideal for balances, invoices, results or reminders.
curl -X POST https://sms.droomdazlean.com/api/v1/send \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"messages": [
{"to": "0771234567", "message": "Dear Ann, your balance is $20. Thank you."},
{"to": "0712345678", "message": "Dear Ben, your balance is $35. Thank you."}
]}'
An entry without its own text uses the top-level message, if you give one.
Send from a CSV file
Upload a file in a multipart form field named file:
curl -X POST https://sms.droomdazlean.com/api/v1/send \
-H "X-API-Key: YOUR_API_KEY" \
-F "[email protected]" \
-F "message=Our shop opens at 8:00 tomorrow."
- One number per row, or a header row with a
phonecolumn (alsonumber,mobile,msisdn,to). - An optional
messagecolumn gives each row its own text; rows without one use themessagefield. - Comma, semicolon or tab separated. From Excel: File → Save As → CSV, with the phone column formatted as text so numbers keep their leading zero.
- Rows without a valid number are skipped and listed in
invalidas"row 17: …".
phone,message
0771234567,Dear Ann your results are ready
0712345678,Dear Ben your results are ready
Sending many requests
There is no limit on how many requests you make. Send one request per event (an order, a payment, a login code) as often as you need, even at the same time from several servers. Every request is queued in the order it arrives and nothing is lost.
- Many recipients at once? Prefer one request with a list (
to,messagesor a CSV) over thousands of single requests: it is faster for you and gives you onebatch_idto follow. - Urgent messages (requests with 10 numbers or fewer, such as OTP codes) are sent before waiting bulk lists.
- Pace: however many requests arrive, your phone sends at its set pace, so a large queue takes time. Use
queue.estimated_timein each answer, orGET /api/v1/queue, to see when it will finish.
Avoid duplicate messages
If your connection drops after you send a request, you can't know whether it arrived. Add a reference that is unique
for that send (for example "INV-2045" or "otp-58821") and simply repeat the same request.
If it was already accepted, nothing new is queued and the answer tells you so:
{"ok": true, "duplicate": true, "reference": "INV-2045", "batch_id": "b_77faf1178cce250bd6ee", "count": 1,
"message": "A request with this reference was already accepted, so nothing new was queued.",
"messages": [{"id": 406116, "to": "+263771234567", "status": "pending"}], "messages_listed": 1}
Use a new reference for every new message or list. A reference stays reserved for that phone.
Choose the SIM card
On dual-SIM phones, list the SIM cards and pass the sim value you want:
curl -H "X-API-Key: YOUR_API_KEY" https://sms.droomdazlean.com/api/v1/device
{"ok": true, "device": {"name": "SAMSUNG SM-A165F", "status": "active", "online": true,
"last_seen": "2026-11-22T06:45:43", "battery": 80, "charging": true, "model": "SM-A165F",
"sims": [{"sim": 1, "slot": 1, "carrier": "ECONET", "number": "+263771234567", "label": "SIM 1 (+263771234567 · ECONET)"},
{"sim": 3, "slot": 2, "carrier": "NetOne", "number": null, "label": "SIM 2 (NetOne)"}]}}
Then send with "sim": 3 to use SIM 2. This call is also a quick way to check that your key works and the phone is online.
Track delivery
One message
curl -H "X-API-Key: YOUR_API_KEY" https://sms.droomdazlean.com/api/v1/messages/406111
{"ok": true, "data": {"id": 406111, "batch_id": "b_674dbbb00b2719332187", "to": "+263771234567",
"message": "Your order #1045 is ready for collection.", "sim": null, "status": "delivered", "error": null,
"created_at": "2026-11-22T06:45:43", "updated_at": "2026-11-22T06:45:58"}}
A whole send (batch)
curl -H "X-API-Key: YOUR_API_KEY" https://sms.droomdazlean.com/api/v1/batches/b_674dbbb00b2719332187
{"ok": true, "batch_id": "b_674dbbb00b2719332187", "total": 3, "done": false,
"counts": {"delivered": 1, "sent": 1, "pending": 1},
"queue": {"waiting": 1, "send_interval_seconds": 10, "estimated_time": "10 seconds", "estimated_finish": "…"}}
done becomes true when no message of the batch is waiting any more.
Status meanings
| Status | Meaning | Final? |
|---|---|---|
| pending | Queued, waiting for its turn | No |
| sending | Handed to the phone, being sent | No |
| sent | Accepted by the mobile network | Usually: becomes delivered when the network confirms |
| delivered | Delivered to the recipient's phone | Yes |
| failed | Could not be sent; error explains why (for example no network service or no airtime) | Yes |
| cancelled | Cancelled before sending | Yes |
Some networks don't send delivery confirmations, so a message can stay sent. Check statuses every 30 to 60 seconds at most,
and stop when the status is final. To cancel messages that haven't gone out yet: POST /api/v1/batches/{batch_id}/cancel.
Response codes
Every answer is JSON. Errors always look like this:
{"ok": false, "error": "invalid_numbers", "message": "1 invalid phone number(s). Fix them, or add skip_invalid=true to send to the valid ones only.", "invalid": ["12345"]}
Check the HTTP status first, then error for the exact reason. Show message to people; it is written for them.
| HTTP | error | What it means | What to do | Retry? |
|---|---|---|---|---|
| 200 | — | Accepted and queued (or, with duplicate: true, already accepted earlier) | Save batch_id and the message ids | — |
| 400 | bad_request | The request could not be read | Check the JSON and headers | No |
| 401 | invalid_api_key | Key missing, mistyped or no longer valid | Copy the key again from the app; contact support if it persists | No |
| 403 | not_activated | The phone isn't ready to send yet | Check the app on the phone, or contact support | Later |
| 403 | disabled | Sending is suspended for this key | Contact support | No |
| 404 | not_found | Unknown address, message id or batch id | Check the URL and the id | No |
| 405 | method_not_allowed | Wrong HTTP method (for example GET instead of POST) | Use the method shown in this guide | No |
| 413 | too_large | Request or file larger than 20 MB | Split it into smaller requests | No |
| 422 | invalid_numbers | One or more numbers are invalid (listed in invalid) | Fix them, or add skip_invalid: true | After fixing |
| 422 | missing_to | No valid recipient given | Add to, messages or a CSV file | After fixing |
| 422 | missing_message | No text for some recipients | Add message | After fixing |
| 422 | message_too_long | Text longer than 5,000 characters | Shorten it | After fixing |
| 422 | too_many | More than 100,000 recipients in one request | Split the list | After fixing |
| 422 | bad_sim | sim isn't a number | Use a sim value from /api/v1/device | After fixing |
| 429 | queue_full | Your phone's queue is full (free says how many more fit) | Wait for the queue to go down; see Retry-After | Yes, later |
| 429 | rate_limited | Too many requests in a short time | Wait the number of seconds in Retry-After | Yes, later |
| 500 | server_error | A problem on our side | Retry after a short pause with the same reference | Yes |
| 502 / 503 / 504 | — | Temporarily unreachable (maintenance or network) | Retry after a short pause with the same reference | Yes |
| Timeout / no answer | — | Your request may or may not have arrived | Retry with the same reference: it is never sent twice | Yes |
Handle errors in your code
These complete examples send a message, retry safely on temporary problems, and report permanent problems.
PHP
function sendSms(string $to, string $message, string $reference): array {
$payload = json_encode(["to" => $to, "message" => $message, "reference" => $reference]);
for ($attempt = 1; $attempt <= 3; $attempt++) {
$ch = curl_init("https://sms.droomdazlean.com/api/v1/send");
curl_setopt_array($ch, [
CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => ["X-API-Key: " . getenv("SMS_API_KEY"), "Content-Type: application/json"],
CURLOPT_POSTFIELDS => $payload,
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$data = $body ? json_decode($body, true) : null;
if ($status === 200 && !empty($data["ok"])) {
return $data; // queued: save $data["messages"][0]["id"]
}
if ($body === false || $status === 429 || $status >= 500) {
sleep(5 * $attempt); // temporary problem: try again
continue;
}
throw new RuntimeException($data["message"] ?? "SMS not sent (HTTP $status)"); // fix the request
}
throw new RuntimeException("SMS service unavailable, try again later");
}
$result = sendSms("0771234567", "Your order #1045 is ready.", "order-1045-ready");
Python
import os, time, requests
API = "https://sms.droomdazlean.com/api/v1"
HEADERS = {"X-API-Key": os.environ["SMS_API_KEY"]}
def send_sms(to, message, reference):
for attempt in range(1, 4):
try:
r = requests.post(f"{API}/send", headers=HEADERS, timeout=30,
json={"to": to, "message": message, "reference": reference})
except requests.RequestException:
time.sleep(5 * attempt) # network problem: safe to retry (same reference)
continue
if r.status_code == 429 or r.status_code >= 500:
time.sleep(min(int(r.headers.get("Retry-After", 5 * attempt)), 60)) # temporary: retry
continue
data = r.json()
if r.status_code == 200 and data["ok"]:
return data # data["batch_id"], data["messages"]
raise ValueError(f'{data["error"]}: {data["message"]}') # 4xx: fix the request
raise RuntimeError("SMS service unavailable, try again later")
result = send_sms(["0771234567", "0712345678"], "Meeting moved to 3 pm.", "meeting-2026-11-24")
print(result["count"], "queued, finished in", result["queue"]["estimated_time"])
Node.js
async function sendSms(to, message, reference) {
for (let attempt = 1; attempt <= 3; attempt++) {
let res;
try {
res = await fetch("https://sms.droomdazlean.com/api/v1/send", {
method: "POST",
headers: {"X-API-Key": process.env.SMS_API_KEY, "Content-Type": "application/json"},
body: JSON.stringify({to, message, reference}),
signal: AbortSignal.timeout(30000),
});
} catch (networkError) {
await new Promise(r => setTimeout(r, 5000 * attempt)); // no answer: safe to retry (same reference)
continue;
}
if (res.status === 429 || res.status >= 500) {
await new Promise(r => setTimeout(r, 5000 * attempt)); // temporary problem: retry
continue;
}
const data = await res.json();
if (res.ok && data.ok) return data; // queued
throw new Error(`${data.error}: ${data.message}`); // 4xx: fix the request
}
throw new Error("SMS service unavailable, try again later");
}
const result = await sendSms("0771234567", "Your code is 482910", "otp-58821");
Devices and microcontrollers (ESP32, ESP8266, Arduino)
Field units, sensors and controllers can send SMS alerts directly. Small devices have limited encryption support, so choose the address that suits the device:
| Address | When to use it |
|---|---|
http://sms.droomdazlean.com/api/v1/send | Recommended for microcontrollers. Works with every device and firmware: no certificates, no clock needed. Use it on networks you trust; the key is not encrypted on the way. |
https://sms.droomdazlean.com/api/v1/send | Encrypted. The device must support TLS 1.2 with ECDSA certificates (ECDHE-ECDSA ciphers) and SNI,
and either trust the Google Trust Services root (GTS Root R4) with a correct clock (NTP), or skip certificate checking (setInsecure()). |
Both accept the same requests: JSON or form data (to, message), with the key in the X-API-Key header.
setCACert(), setCACertBundle()
or setInsecure()), RSA-only cipher settings, or a clock that isn't set. The quickest fix is the http:// address above.ESP32 (Arduino core)
#include <WiFi.h>
#include <HTTPClient.h>
#include <WiFiClientSecure.h>
const char* SMS_URL = "http://sms.droomdazlean.com/api/v1/send"; // or https://... (see below)
const char* API_KEY = "YOUR_API_KEY";
int sendSms(const String& to, const String& message, const String& reference) {
HTTPClient http;
WiFiClient plain;
WiFiClientSecure secure;
bool https = String(SMS_URL).startsWith("https");
if (https) secure.setInsecure(); // encrypted; or secure.setCACert(GTS_ROOT_R4) + NTP time
http.begin(https ? (WiFiClient&)secure : plain, SMS_URL);
http.setTimeout(20000);
http.addHeader("X-API-Key", API_KEY);
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
String body = "to=" + to + "&message=" + urlencode(message) + "&reference=" + reference;
int code = http.POST(body); // 200 = queued; 4xx = fix request; -1 = connection/TLS
String reply = http.getString();
http.end();
return code;
}
urlencode() stands for your URL-encoding helper (spaces as %20, & as %26). Use a unique reference per alert
(for example the pole id and the time) so a retried alert is never sent twice.
ESP8266
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
WiFiClient client; // for https: BearSSL::WiFiClientSecure client; client.setInsecure();
HTTPClient http;
http.begin(client, "http://sms.droomdazlean.com/api/v1/send");
http.addHeader("X-API-Key", "YOUR_API_KEY");
http.addHeader("Content-Type", "application/json");
int code = http.POST("{\"to\":\"0771234567\",\"message\":\"Pole ZESA-PL-0001 tilt alarm\",\"reference\":\"PL0001-1795330606\"}");
http.end();
Device error codes (negative numbers) come from the device's HTTP library, not from the gateway:
-1 connection or TLS failed, -4 not connected, -11 timed out. Retry later with the same reference.
Read replies
curl -H "X-API-Key: YOUR_API_KEY" "https://sms.droomdazlean.com/api/v1/received?limit=50"
{"ok": true, "data": [{"id": 88, "from": "+263771234567", "message": "YES, I will attend", "received_at": "2026-11-22T07:10:02"}]}
Endpoint reference
| Request | Description |
|---|---|
POST /api/v1/send | Queue one or many SMS: to, messages or file; plus message, sim, reference, skip_invalid |
GET /api/v1/messages/{id} | Status of one message |
GET /api/v1/messages | Your messages, newest first. Filters: status, batch_id, to; paging: page, limit (max 200) |
GET /api/v1/batches/{batch_id} | Progress of one send: total, counts per status, done |
POST /api/v1/batches/{batch_id}/cancel | Cancel the messages of that send that haven't gone out yet |
GET /api/v1/queue | Messages waiting for your phone, the pace and the estimated finish time |
GET /api/v1/device | Phone status (online, battery) and its SIM cards |
GET /api/v1/received | Incoming SMS (replies); limit up to 200 |
Limits
| Requests | No limit |
| Recipients per request | 100,000 |
| Request or file size | 20 MB |
| Message length | 5,000 characters |
| Sending pace | Set per phone (default one SMS every 10 seconds) |
| Android's own limit | About 30 SMS per 30 minutes per app until confirmed on the phone; can be raised on dedicated phones |
For high volumes, set the gateway phone up properly: all permissions granted, battery optimisation off, and Android's SMS limit raised. The setup guide explains hidden settings, settings for each phone brand and raising the limit with ADB on dedicated devices. To send more per day, add more phones: each has its own key and queue.
Go-live checklist
- The API key is stored on your server, not in web pages or source code.
- Every send has a unique
reference, and retries reuse it. - You save the
batch_idand message ids, and check status at most every 30 to 60 seconds. - You retry only on timeouts,
429and5xx; you fix and log4xxerrors. - Large lists go in one request (array,
messagesor CSV) instead of thousands of single calls. - You tested with the web sender and your own number first.