Skip to main content

Send Message

Send an SMS or WhatsApp message.

POST /api/v2/messages

Authentication

Authorization: Bearer sl_live_your_key_here

Request body

ParameterTypeRequiredDescription
tostringYesRecipient phone number in E.164 format (for example 8801XXXXXXXXX).
messagestringYesThe message body to send.
channelstringNo"sms" (default) or "whatsapp".
brand_idstringNoOptional sender/profile selector. For SMS, pass an approved masking brand name, registered non-masking number, or brand ID. If omitted, SendLime uses the default non-masking sender. For WhatsApp, pass a WhatsApp brand/profile ID to override the default WhatsApp profile.

Channel behavior

ChannelBehavior
smsSends through SMS. Delivered messages currently cost 0.5 BDT.
whatsappChecks whether the recipient is on WhatsApp, then sends through your default WhatsApp profile unless brand_id selects another approved WhatsApp profile. WhatsApp messages currently cost 0 credits.

Example request

SMS

curl -X POST "https://api.sendlime.com/api/v2/messages" \
-H "Authorization: Bearer sl_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"to": "8801XXXXXXXXX",
"message": "Hello from SendLime!",
"channel": "sms",
"brand_id": "your_brand_id_here"
}'

WhatsApp

curl -X POST "https://api.sendlime.com/api/v2/messages" \
-H "Authorization: Bearer sl_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"to": "8801XXXXXXXXX",
"message": "Hello via WhatsApp!",
"channel": "whatsapp"
}'

Success response

Status: 200 OK

{
"success": true,
"data": {
"gateway_id": "580000908Q23PJCF",
"to": "8801XXXXXXXXX",
"channel": "sms",
"status": "delivered",
"credits_remaining": 99.5
}
}

Response fields

FieldTypeDescription
gateway_idstringUnique message identifier
tostringRecipient number
channelstring"sms" or "whatsapp"
statusstringSuccessful API sends return "delivered"
credits_remainingnumberYour remaining account balance

Error responses

400 Bad Request

{ "error": "Recipient number is not on WhatsApp" }
{ "error": "Brand not found or not approved" }

401 Unauthorized

{ "error": "Invalid or revoked API key" }

403 Forbidden

{ "error": "Request from unauthorized IP address" }

402 Payment Required

{ "error": "Insufficient balance", "required": 0.5, "available": 0 }

422 Validation Error

{
"error": "Validation failed",
"details": {
"to": ["Recipient number is required"]
}
}

429 Too Many Requests

{ "error": "Rate limit exceeded", "retry_after": 42 }

500 Internal Server Error

{ "error": "Error sending WhatsApp message", "status": "failed" }