Skip to Content
DocumentationSending SMS

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/
FieldTypeRequiredDescription
tostringYesRecipient phone number
messagestringYesSMS text
fromstringNoRegistered 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
FieldTypeRequiredDescription
toarray of stringsYesRecipient phone numbers. Maximum 1000 per call; use a campaign for larger audiences.
messagestringYesSMS text
fromstringNoRegistered 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" }
FieldTypeDescription
totalintRecipients in the batch
sentintRecipients accepted by the provider
failedintRecipients that failed
resultsarrayPer-recipient outcome

Per-recipient result fields — message_id and credits_used appear on success, error on failure:

FieldTypeDescription
tostringRecipient phone number
statusstringsent or failed
message_idstringPresent when sent
credits_usedintPresent when sent
errorstringPresent 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/logs

Query 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/rates

See Delivery Status to know what a send actually guarantees, and the SDK pages for typed wrappers:

Last updated on