SMS API Integration Guide for Developers in Tanzania
Send SMS straight from your app, website, or backend. This developer guide walks through API keys, the send endpoint, and checking delivery status.
The DARSMS SMS API lets you send transactional and marketing messages directly from your own software: OTPs, order updates, appointment reminders, and campaigns. It uses a simple API-key model over HTTPS, so you can integrate from any language that can make an HTTP request.
1. Get an API key
Generate an API key from the API Keys section of your dashboard. Treat it like a password: store it in an environment variable, never commit it to source control, and rotate it if it is ever exposed. Each key can be revoked independently.
2. Send a message
Call the integration send endpoint with your API key in the x-api-key header, passing the recipient number, your approved sender ID label, and the message body. The response returns a message ID you can store for tracking.
3. Check delivery status
Use the returned message ID to query delivery status, or reconcile in bulk from your dashboard. Statuses move from queued to sent and then to delivered or failed as the network confirms each message.
Best practices
- Normalise phone numbers to the 255XXXXXXXXX or 07XXXXXXXXX format before sending.
- Keep OTP messages short and time boxed, and never log them in plain text.
- Handle rate limits and retries with exponential backoff.
- Monitor your credit balance and top up before it runs out to avoid failed sends.
Full request and response examples are in the API documentation. Start on a small test batch, confirm delivery reports look right, then scale up.
Ready to start sending bulk SMS?
Create a free DARSMS account, register your sender ID, and reach your audience in minutes.
