Skip to main content

Send SMS

Send the same message to one number, a list, or up to 10,000 numbers.

POSThttps://api.cloudmetis.com/v1/sms/sendscope: sms:send

How big sends work​

RecipientsResponseMessage IDs
1 (as a string)201 with a single messageIn the response
A list of up to 50201 with a messages arrayIn the response
A list of 51 – 10,000202 batch receiptVia webhooks or GET /v1/sms/batches/{batch_id}

Large lists are sent in the background, so you get an answer immediately instead of waiting for thousands of messages.

Request​

FieldTypeDescription
to
required
string | string[]One phone number, or a list of up to 10,000. Kenyan formats (0712…, 712…, 254712…) are converted to E.164. Duplicates are removed.
message
required
stringMessage text, up to 1,600 characters. See SMS units for how length becomes parts.
sender_idstringAn approved sender ID of your organisation, e.g. MYCOMPANY (not case-sensitive). Defaults to your default sender ID. See Sender IDs.
callback_urlstringWhere to send delivery reports for this request. Overrides the key's webhook URL. See Webhooks.

Optional header: Idempotency-Key — makes retries safe. See Idempotency.

curl -X POST https://api.cloudmetis.com/v1/sms/send \
-H "Authorization: Bearer cm_live_your_key" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: otp-7f3a9c" \
-d '{
"to": "+254712345678",
"message": "Your verification code is 482913.",
"sender_id": "MYCOMPANY"
}'

Response: one number (201)​

{
"status": "accepted",
"message_id": "msg_247",
"to": "+254712345678",
"message_status": "sent",
"recipients": 1,
"sms_parts": 1,
"batch_id": "bat_107",
"units_used": 1,
"units_available": 4999,
"sandbox": false
}

message_status is the message's state at the moment of the response — usually sent (live) or delivered (sandbox). Later changes arrive by webhook.

Response: a list of up to 50 (201)​

{
"status": "accepted",
"recipients": 2,
"messages": [
{"message_id": "msg_185", "to": "+254712000101", "status": "sent", "sms_parts": 1},
{"message_id": "msg_186", "to": "+254733000102", "status": "sent", "sms_parts": 1}
],
"batch_id": "bat_105",
"units_used": 2,
"units_available": 4997,
"sandbox": false
}

A number that has opted out appears with "status": "optedout", "message_id": null and "sms_parts": 0 — it is not sent and uses no units.

Response: 51 to 10,000 numbers (202)​

{
"status": "queued",
"batch_id": "bat_106",
"recipients": 60,
"opted_out": 0,
"units_required": 60,
"units_available": 4937,
"sandbox": false
}

The whole batch is checked first — numbers, sender ID and units. If anything is wrong, you get an error and nothing is queued. Once queued, the batch is sent within seconds; follow it with GET /v1/sms/batches/bat_106 or webhooks.

Response fields​

FieldDescription
statusaccepted (sent now) or queued (batch, sent in the background)
message_id / messages[].message_idUse with GET /v1/sms/status/{message_id}
message_status / messages[].statusSee statuses
batch_idEvery request gets one; use with GET /v1/sms/batches/{batch_id}
recipientsNumbers in the request after removing duplicates (for batches, opted-out numbers are counted in opted_out instead)
opted_outBatches only: numbers skipped because they opted out
units_used / units_requiredUnits this request uses — see SMS units
units_availableUnits left in your wallet
sandboxtrue for test keys

Errors​

StatusCodeWhen
400invalid_requestMissing to or message, more than 10,000 numbers, message over 1,600 characters, bad callback_url
400invalid_phone_numberAny number is invalid — nothing is sent
402insufficient_unitsNot enough units for the whole request — nothing is sent
403invalid_sender_idsender_id not approved, or no approved sender ID
403sms_not_configuredSMS not set up for your organisation (live keys)
409idempotency_conflictSee Idempotency
422all_recipients_opted_outEvery number has opted out
502send_failedThe SMS network rejected the request

Full list: Errors.