Sending SMS
Two ways to send from the REST API: one message to one number, or one message to many numbers in a single call.
Send one SMS
POST /v1/sms/| Field | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient phone number |
message | string | Yes | SMS text |
from | string | No | Registered sender ID; defaults when omitted |
curl -X POST https://api.sendafrica.online/v1/sms/ \
-H "X-API-Key: $SENDAFRICA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to":"0712345678","message":"Your verification code is 4921."}'Response
{
"success": true,
"data": {
"message_id": "f3b1c2d4-9e8a-4f2b-b1c2-d3e4f5a6b7c8",
"status": "Success",
"credits_used": 1
},
"request_id": "dfffa252-4781-43ff-8e1a-bf01a754d66a"
}Provider submission success is not handset delivery. Use webhooks for asynchronous delivery events.
Send bulk SMS
Send one message to many recipients in a single call. Partial failures return 200 with per-recipient results; only whole-request problems are error statuses.
POST /v1/sms/bulk| Field | Type | Required | Description |
|---|---|---|---|
to | array of strings | Yes | Recipient phone numbers. Maximum 1000 per call; use a campaign for larger audiences. |
message | string | Yes | SMS text |
from | string | No | Registered sender ID; defaults when omitted |
curl -X POST https://api.sendafrica.online/v1/sms/bulk \
-H "X-API-Key: $SENDAFRICA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to":["0712345678","0712345679"],"message":"Hello from SendAfrica!"}'Response
{
"success": true,
"data": {
"total": 2,
"sent": 2,
"failed": 0,
"results": [
{
"to": "0712345678",
"status": "sent",
"message_id": "f3b1c2d4-9e8a-4f2b-b1c2-d3e4f5a6b7c8",
"credits_used": 1
},
{
"to": "0712345679",
"status": "sent",
"message_id": "c9a5b6d7-3c1e-4f0a-a2b3-4e5f6a7b8c9d",
"credits_used": 1
}
]
},
"request_id": "dfffa252-4781-43ff-8e1a-bf01a754d66a"
}| Field | Type | Description |
|---|---|---|
total | int | Recipients in the batch |
sent | int | Recipients accepted by the provider |
failed | int | Recipients that failed |
results | array | Per-recipient outcome |
Per-recipient result fields — message_id and credits_used appear on success, error on failure:
| Field | Type | Description |
|---|---|---|
to | string | Recipient phone number |
status | string | sent or failed |
message_id | string | Present when sent |
credits_used | int | Present when sent |
error | string | Present on failure |
Idempotency
Pass an Idempotency-Key header (max 128 characters) to make the call safe to retry. A repeat request with the same key replays the stored whole-batch result; concurrent duplicates are rejected with 409 request_in_progress.
Message logs
GET /v1/sms/logsQuery parameters: page, per_page, status (pending | sent | delivered | failed), search, date_from. The SDKs wrap this in a typed logs(...) method.
Other public reads
GET /v1/credits/balance
GET /v1/ratesSee Delivery Status to know what a send actually guarantees, and the SDK pages for typed wrappers:
- Go — Sending SMS
- Python — SMS
- TypeScript — SMS