SMS API
Send single, bulk and scheduled SMS or WhatsApp template messages.
Send one message or thousands in a single request, schedule them for later, or send approved WhatsApp templates. Then list your history or fetch a single message to see its delivery status.
Send SMS
Creates and queues one or more messages. The whole request succeeds or fails together: if any message is invalid or your balance can't cover all of them, nothing is sent and nothing is charged.
sender_name, if given, must be approved, enabled, and yours (created by you, assigned to you, or a shared default).- Recipients you haven't messaged before are saved as contacts automatically.
- Your SMS balance (or postpaid limit) is checked and charged in the same step.
sender_namestringoptionalNBM. Leave it out to send without one. Ignored for WhatsApp.messagesarrayrequired{ receiver, content } objects. Can't be empty.messages[].receiverstringrequiredmessages[].contentstringrequiredis_scheduledbooleanoptionaldefault: falsetrue to send later. Requires scheduled_date.scheduled_datestring (ISO 8601)optional2026-12-01T07:00:00+03:00. Must be in the future. The message waits as scheduled, then moves to sending.channelstringoptionaldefault: smscurl -X POST https://sms.nbmbrand.com/api/v1/messages \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-2041-ready" \
-d '{
"sender_name": "NBM",
"messages": [
{
"receiver": "0712345678",
"content": "Hello Asha, your order NBM-2041 is ready for pickup."
}
]
}'{
"success": true,
"status_code": 201,
"status_text": "Created",
"message": "messages have been created",
"data": null
}Bulk messages
Put as many entries in messages as you need — each can have different text, so personalised campaigns need only one request. For very large campaigns, send batches of up to 1,000 messages per request.
curl -X POST https://sms.nbmbrand.com/api/v1/messages \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sender_name": "NBM",
"messages": [
{
"receiver": "0712345678",
"content": "Hi Asha, your NBM points balance is 1,250."
},
{
"receiver": "0754987654",
"content": "Hi Juma, your NBM points balance is 430."
},
{
"receiver": "255688112233",
"content": "Hi Neema, your NBM points balance is 2,900."
}
]
}'Scheduled send
Scheduled messages are charged when you create them, so the balance is reserved. Include a timezone offset in scheduled_date (Tanzania is +03:00); a date without one is treated as UTC.
curl -X POST https://sms.nbmbrand.com/api/v1/messages \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sender_name": "NBM",
"is_scheduled": true,
"scheduled_date": "2026-12-01T07:00:00+03:00",
"messages": [
{
"receiver": "0712345678",
"content": "Black Friday starts now — up to 50% off at NBM."
}
]
}'| Status | error | When it happens |
|---|---|---|
| 400 | validation_error | messages is missing or empty, a receiver or content is missing, or scheduled_date is missing or in the past. |
| 400 | creation_error | The sender name isn't approved, is disabled or isn't yours, or your balance / postpaid limit can't cover the messages. |
| 400 | idempotency_conflict | The Idempotency-Key was already used with a different body. |
| 401 | invalid_token | Missing or invalid API key. |
Message length & billing
SMS are billed in units. Long messages are split into parts by the network and joined again on the phone; each part costs one unit. Part size depends on the characters you use:
| Text type | 1 unit | Each part when longer | Examples |
|---|---|---|---|
| Plain (GSM-7: A–Z, 0–9, common punctuation) | up to 160 chars | 153 chars | 160 → 1 · 161 → 2 · 306 → 2 · 307 → 3 · 475 → 4 |
| Unicode (emoji, curly quotes, non-Latin scripts) | up to 70 chars | 63 chars | 70 → 1 · 71 → 2 · 126 → 2 · 127 → 3 |
The number of units is returned as count on each message. Accounts with staff (admin) rights in the portal send without being charged.
Safe retries (Idempotency-Key)
If a send times out or the connection drops, you can't tell whether the messages were created. Retrying blindly could text your customers twice — and charge you twice.
Send an Idempotency-Key header with every POST /messages: any string up to 128 printable characters, unique per send (an order id, or a UUID you store before sending).
- Repeating the request with the same key and body doesn't create or charge anything again; you get
200 OKsaying the messages already exist. - Reusing a key with a different body is refused with
idempotency_conflict. - Keys are remembered for 48 hours.
{
"success": true,
"status_code": 200,
"status_text": "OK",
"message": "messages have already been created",
"data": null
}Send via WhatsApp
Uses the same endpoint with channel: "whatsapp". WhatsApp only allows business-initiated messages from approved templates, so you send a template id and the values for its placeholders instead of free text. Templates are created and submitted for approval in the portal's WhatsApp section.
channelstringrequiredwhatsapp.template_iduuidrequiredwhatsapp_sourcestringoptionaldefault: defaultdefault sends from the shared NBM WhatsApp number; own sends from your own connected business number.messages[].receiverstringrequiredmessages[].template_paramsstring[]optional{{1}}, {{2}}… placeholders, in order.messages[].contentstringoptional| Status | error | When it happens |
|---|---|---|
| 400 | validation_error | template_id missing or a receiver missing. |
| 400 | creation_error | Template not approved, WhatsApp isn't set up on your account, your own number isn't active (with own), or the WhatsApp wallet is too low. |
curl -X POST https://sms.nbmbrand.com/api/v1/messages \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"channel": "whatsapp",
"template_id": "5c0d8a2e-9b1f-4c3d-8e7a-6f5b4a3c2d1e",
"whatsapp_source": "default",
"messages": [
{
"receiver": "0712345678",
"content": "",
"template_params": [
"Asha",
"NBM-2041",
"Kariakoo branch"
]
}
]
}'{
"success": true,
"status_code": 201,
"status_text": "Created",
"message": "messages have been created",
"data": null
}List messages
Returns your messages, newest first, one page at a time.
pageintegeroptionaldefault: 1limitintegeroptionaldefault: 10sort_bystringoptionaldefault: created_atstatus, count, is_scheduled, scheduled_date, created_at, updated_at.sort_dirstringoptionaldefault: descasc or desc.statusstringoptionalscheduledbooleanoptionaltrue for scheduled messages only, false to exclude them.channelstringoptionalsms or whatsapp.curl "https://sms.nbmbrand.com/api/v1/messages?page=1&limit=20&status=delivered&sort_dir=desc" \
-H "Authorization: Bearer $API_KEY"{
"success": true,
"status_code": 200,
"status_text": "OK",
"message": "messages have been fetched",
"data": {
"data": [
{
"id": "6b2f6e2a-4b0e-4e9a-9a2e-1a2b3c4d5e6f",
"status": "delivered",
"content": "Hello Asha, your order NBM-2041 is ready for pickup.",
"count": 1,
"sender_name": "NBM",
"sender_name_id": "9a1c1e2a-4b0e-4e9a-9a2e-1a2b3c4d5e6f",
"phone_number": "255712345678",
"contact_id": "c41d2b8e-7f3a-4e21-9b8c-2d5f6a7e8b9c",
"contact_name": "Asha Mushi",
"is_scheduled": false,
"scheduled_date": null,
"message_id": "prv-88213470",
"channel": "sms",
"template_id": null,
"template_name": null,
"whatsapp_number": null,
"whatsapp_phone_number_id": null,
"next_check_at": null,
"failure_reason": null,
"created_by": "2f0b6c1d-1e2a-4b3c-8d9e-0f1a2b3c4d5e",
"created_by_name": "Shop API",
"created_at": "2026-11-20T09:14:03Z",
"updated_by": null,
"updated_by_name": null,
"updated_at": "2026-11-20T09:14:41Z"
}
],
"total": 1,
"page": 1,
"limit": 20,
"total_pages": 1,
"has_next_page": false,
"has_previous_page": false,
"next_page": null,
"previous_page": null
}
}Search messages
Like List messages, plus a required searchterm matched against the message text and the recipient's number or contact name. Accepts the same filters and pagination.
searchstringrequiredcurl "https://sms.nbmbrand.com/api/v1/messages/search?search=NBM-2041&limit=20" \
-H "Authorization: Bearer $API_KEY"Get a message
Fetches one message, including sender, recipient and contact names. Use it after a webhook to get full details.
iduuidrequired| Status | error | When it happens |
|---|---|---|
| 400 | invalid_parameter | id isn't a valid UUID. |
| 404 | not_found | No message with that id belongs to you. |
curl https://sms.nbmbrand.com/api/v1/messages/6b2f6e2a-4b0e-4e9a-9a2e-1a2b3c4d5e6f \
-H "Authorization: Bearer $API_KEY"{
"success": true,
"status_code": 200,
"status_text": "OK",
"message": "message has been fetched",
"data": {
"id": "6b2f6e2a-4b0e-4e9a-9a2e-1a2b3c4d5e6f",
"status": "delivered",
"content": "Hello Asha, your order NBM-2041 is ready for pickup.",
"count": 1,
"sender_name": "NBM",
"sender_name_id": "9a1c1e2a-4b0e-4e9a-9a2e-1a2b3c4d5e6f",
"phone_number": "255712345678",
"contact_id": "c41d2b8e-7f3a-4e21-9b8c-2d5f6a7e8b9c",
"contact_name": "Asha Mushi",
"is_scheduled": false,
"scheduled_date": null,
"message_id": "prv-88213470",
"channel": "sms",
"template_id": null,
"template_name": null,
"whatsapp_number": null,
"whatsapp_phone_number_id": null,
"next_check_at": null,
"failure_reason": null,
"created_by": "2f0b6c1d-1e2a-4b3c-8d9e-0f1a2b3c4d5e",
"created_by_name": "Shop API",
"created_at": "2026-11-20T09:14:03Z",
"updated_by": null,
"updated_by_name": null,
"updated_at": "2026-11-20T09:14:41Z"
}
}{
"success": false,
"status_code": 404,
"status_text": "Not Found",
"message": "message not found",
"error": "not_found"
}The message object
iduuidrequiredstatusstringrequiredcontentstringrequiredcountintegerrequiredchannelstringrequiredsms or whatsapp.phone_numberstringrequiredsender_name / sender_name_idstring | nulloptionalcontact_id / contact_namestring | nulloptionalis_scheduled / scheduled_dateboolean / string | nulloptionalmessage_idstring | nulloptionaltemplate_id / template_namestring | nulloptionalwhatsapp_number / whatsapp_phone_number_idstring | nulloptionalfailure_reasonstring | nulloptionalfailed or undelivered, when known.next_check_atstring | nulloptionalcreated_by / created_by_namestringoptionalcreated_at / updated_atstring (ISO 8601)requiredMessage statuses
| Status | Meaning | Final? |
|---|---|---|
scheduled | Waiting for its scheduled_date. | No |
sending | Accepted and queued to go out now. | No |
processing | Being handed to the mobile network. | No |
processing_status | Waiting for the network's delivery report. | No |
sent | The network accepted it; the phone hasn't confirmed yet (it may be off or out of coverage). | No |
delivered | The handset confirmed receipt. | Yes |
undelivered | The network gave up — number unreachable, inactive or blocked. | Yes |
failed | We couldn't send it (e.g. invalid number, operator rejected it). See failure_reason. | Yes |
Delivery status is checked about every 30 seconds. The final delivered and undelivered changes are pushed to your webhook.