Send SMS messages
Send a single SMS message to a specified phone number.
Request
POST {{base_url}}/messages
Headers
| Header | Value | Required |
|---|---|---|
| content-type | application/json | Yes |
| api_key | YOUR_API_KEY | Yes |
Request Body
{
"message": {
"type": "sms",
"content": "Your OTP code is 1234",
"phone": {
"country_code": "254",
"number": "7********"
}
}
}
Request sample (cURL)
curl --request POST \
--url https://messenger.stg.cashia.com/api/messages \
--header 'api_key: L2aAVtBsfhGzk5S5BA1SelgvM49r8gSpS2_Uhok98I_' \
--header 'content-type: application/json' \
--data '{
"message": {
"type": "sms",
"content": "Your OTP code is 1234",
"phone": {
"country_code": "254",
"number": "7********"
}
}
}'
Response Sample
201 Created
{
"message": "Message sent successfully",
"data": {
"status": "delivered",
"id": "msg_123xyz",
}
}
401 Unauthorized
"status": "error",
"message": "Invalid or missing API key",
"error_code": "unauthorized"
404 Not Found
"status": "error",
"message": "Message not found",
"error_code": "not_found"
500 Internal Server Error
"status": "error",
"message": "An unexpected error occurred",
"error_code": "internal_server_error"