NBM SMS API
What the NBM SMS API does and how to send your first message.
The NBM SMS API lets your application send SMS, one-time passcodes and WhatsApp template messages, track delivery, manage sender names and top up credit. It is a JSON REST API over HTTPS, with an SMPP gateway for systems that already speak SMPP.
What you can build
SMS
Single, bulk and scheduled messages to any Tanzanian network.
OTP
Send and verify 6-digit codes without storing them yourself.
WhatsApp
Send approved WhatsApp templates with the same endpoint.
Sender names
Request branded sender IDs and share them with your team.
Credits
Check balance and buy credit by mobile money from your app.
Webhooks
Delivery reports and status changes pushed to your server.
SMPP
Plug in an existing SMPP client over TLS for high volume.
Errors
Predictable error codes so your code knows what went wrong.
Quick start
- Create an account and an API keySign up at sms.nbmbrand.com, open API in the portal and choose New API key. Copy the key straight away — it starts with
nbm_and is shown only once. See Authentication. - Keep the key on your serverStore it in an environment variable such as
NBM_SMS_API_KEY. Never put it in a mobile app, a web page or a public repository. - Send a message
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": "Karibu! Your NBM account is ready." } ] }'Response201 Created{ "success": true, "status_code": 201, "status_text": "Created", "message": "messages have been created", "data": null } - Track deliveryAdd a webhook URL in the portal to receive delivery reports, or poll List messages.
Key concepts
| Term | Meaning |
|---|---|
| API key | A secret starting with nbm_ that identifies your account on every request. You can have many, one per integration. |
| Sender name | The name recipients see as the sender, e.g. NBM. Up to 11 characters, reviewed by NBM before use. |
| Unit | The billing unit for SMS. A plain-text message of up to 160 characters is 1 unit; longer or Unicode messages use more. See billing. |
| Balance | Your prepaid SMS credit (in units) and your WhatsApp wallet. Checked and charged when a message is accepted. |
| Webhook | A URL on your server that NBM calls when a message is delivered or a sender name / purchase changes status. |
| Reseller | An account that manages its own customers, shares sender names with them and can see their activity. |