SMS API — Developer Guide
Welcome to the Notify Africa Core API! This guide will help you quickly integrate SMS capabilities into your applications using RESTful endpoints. You’ll find example requests, developer tips, important notes, and code snippets for common notification tasks.
Use an official SDK for faster integration:
- Node.js: /docs/sdks/node
- Go: /docs/sdks/go
- Python: /docs/sdks/python
- PHP: /docs/sdks/php
Quick Start
First, you’ll need an API Token. Please request your token via your admin dashboard or contact your system administrator.
All endpoints expect authorization via a Bearer token header. Always send:
Authorization: Bearer {API-TOKEN}
Replace {API-TOKEN} with your actual API token.
All endpoints below are relative to:
https://api.notify.africa/
Endpoints Overview
| Action | Endpoint | Method |
|---|---|---|
| Send Single SMS | /api/v1/api/messages/send | POST |
| Send Batch SMS | /api/v1/api/messages/batch | POST |
| Check Message Status | /api/v1/api/messages/status/{messageId} | GET |
Tip: All endpoint paths are relative to the base URL above.
1. Send a Single SMS
Sends an SMS to one recipient.
Your sender_id should be assigned by Notify Africa.
Example Request (cURL) — Single SMS
curl -X POST https://api.notify.africa/api/v1/api/messages/send \
-H "Authorization: Bearer {API-TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "255689737459",
"message": "Hello from API Management endpoint!",
"sender_id": "137"
}'
Response Sample — Single SMS
{
"status": 200,
"message": "SMS sent successfully",
"timestamp": "2025-11-13T12:36:09.751Z",
"path": "/api/v1/api/messages/send",
"data": {
"messageId": "156023",
"status": "PROCESSING"
}
}
Helpful Notes — Single SMS
- Phone numbers should be in international format (e.g.,
255...for Tanzania). - The
statusfield may initially bePROCESSING. Use the status API to track delivery. - Ensure
Content-Typeis set toapplication/json. - Avoid special characters in
sender_idand keep messages within SMS length limits (usually 160 chars per segment).
2. Send Batch SMS
Sends a message to multiple recipients at once.
Example Request (cURL) — Batch SMS
curl -X POST https://api.notify.africa/api/v1/api/messages/batch \
-H "Authorization: Bearer {API-TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"phone_numbers": ["255763765548", "255689737839"],
"message": "test",
"sender_id": "137"
}'
Response Sample — Batch SMS
{
"status": 200,
"message": "Batch messages sent successfully",
"timestamp": "2025-11-13T12:47:09.596Z",
"path": "/api/v1/api/messages/batch",
"data": {
"messageCount": 2,
"creditsDeducted": 2,
"remainingBalance": 1475
}
}
Helpful Notes — Batch SMS
phone_numbersmust be an array of valid phone numbers.- Each SMS to a recipient will consume one credit; check
remainingBalanceafter a batch send. - Errors (such as invalid numbers) will be returned with
status≠ 200 and a descriptivemessage.
3. Check Message Status
Track your message using the unique messageId from the send response.
Example Request (cURL)
curl -X GET https://api.notify.africa/api/v1/api/messages/status/156022 \
-H "Authorization: Bearer {API-TOKEN}"
Response Sample
{
"status": 200,
"message": "Message status retrieved successfully",
"timestamp": "2025-11-13T12:48:03.876Z",
"path": "/api/v1/api/messages/status/156022",
"data": {
"messageId": "156022",
"status": "SENT",
"sentAt": null,
"deliveredAt": "2025-11-13T12:34:08.540Z"
}
}
Status Values
PROCESSING: Message is queued.SENT: Message sent to carrier.DELIVERED: Message received on recipient device.FAILED: Message could not be delivered.
Helpful Notes
- Track the
deliveredAttimestamp for confirmation. - If
sentAtis null, the message is not yet sent; re-check after a few seconds.
Pro Tips
- Best Practice: Use environment configs to store your API Token, never hard-code in source files.
- Error Handling: Always check for errors in API responses—unexpected issues such as quota exceeded or invalid parameters are returned with descriptive messages.
- Rate Limits: Avoid sending too many requests at once. Notify Africa may rate-limit API calls to ensure system stability. Batch requests where possible.
- Security: Keep your API token confidential; treat it like a password. Rotate regularly for enhanced security.
Example: Using SMS API (Multi-language)
Send Single SMS
- Node.js (Axios)
- Python (requests)
- Go (net/http)
- PHP (cURL)
import axios from 'axios';
const API_TOKEN = process.env.NOTIFY_API_TOKEN;
const BASE_URL = 'https://api.notify.africa/api/v1/api';
async function sendSMS() {
try {
const res = await axios.post(
`${BASE_URL}/messages/send`,
{
phone_number: '255689737459',
message: 'Hello from API!',
sender_id: '137',
},
{
headers: {
Authorization: `Bearer ${API_TOKEN}`,
'Content-Type': 'application/json',
},
},
);
console.log(res.data);
} catch (error: any) {
console.error(error.response?.data || error.message);
}
}
import os
import requests
API_TOKEN = os.getenv("NOTIFY_API_TOKEN")
BASE_URL = "https://api.notify.africa/api/v1/api"
payload = {
"phone_number": "255689737459",
"message": "Hello from API!",
"sender_id": "137",
}
res = requests.post(
f"{BASE_URL}/messages/send",
json=payload,
headers={
"Authorization": f"Bearer {API_TOKEN}",
"Content-Type": "application/json",
},
)
print(res.json())
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
apiToken := os.Getenv("NOTIFY_API_TOKEN")
baseURL := "https://api.notify.africa/api/v1/api"
payload := map[string]string{
"phone_number": "255689737459",
"message": "Hello from API!",
"sender_id": "137",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", baseURL+"/messages/send", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer "+apiToken)
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
fmt.Println("Status:", res.Status)
}
<?php
$apiToken = getenv('NOTIFY_API_TOKEN');
$baseUrl = 'https://api.notify.africa/api/v1/api';
$payload = json_encode([
'phone_number' => '255689737459',
'message' => 'Hello from API!',
'sender_id' => '137',
]);
$ch = curl_init($baseUrl . '/messages/send');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiToken,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Send Batch SMS
- Node.js (Axios)
- Python (requests)
- Go (net/http)
- PHP (cURL)
async function sendBatchSMS() {
try {
const res = await axios.post(
`${BASE_URL}/messages/batch`,
{
phone_numbers: ['255763765548', '255689737839'],
message: 'Bulk message',
sender_id: '137',
},
{
headers: {
Authorization: `Bearer ${API_TOKEN}`,
'Content-Type': 'application/json',
},
},
);
console.log(res.data);
} catch (error: any) {
console.error(error.response?.data || error.message);
}
}
payload = {
"phone_numbers": ["255763765548", "255689737839"],
"message": "Bulk message",
"sender_id": "137",
}
res = requests.post(
f"{BASE_URL}/messages/batch",
json=payload,
headers={
"Authorization": f"Bearer {API_TOKEN}",
"Content-Type": "application/json",
},
)
print(res.json())
payload := map[string]any{
"phone_numbers": []string{"255763765548", "255689737839"},
"message": "Bulk message",
"sender_id": "137",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", baseURL+"/messages/batch", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer "+apiToken)
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
$payload = json_encode([
'phone_numbers' => ['255763765548', '255689737839'],
'message' => 'Bulk message',
'sender_id' => '137',
]);
$ch = curl_init($baseUrl . '/messages/batch');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiToken,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Need Help?
If you need anything, reach us via WhatsApp, phone, or email:
Quick links
- WhatsApp: Chat on WhatsApp
- Phone call: Call +255 759 818 157
- Email: beatha@notify.africa
Happy Sending! 🚀