Complete guide to integrating SMESS WhatsApp API into your application
YOUR_API_KEY_HERE
All API requests require your API key. Include it in every request:
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://smess.io/api/send',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query([
'apikey' => 'YOUR_API_KEY_HERE',
'recipient' => '+233244123456',
'text' => 'Hello World!'
])
]);
$response = curl_exec($curl);
curl_close($curl);
POST https://smess.io/api/send
| Name | Type | Required | Description |
|---|---|---|---|
| apikey | string | Yes | Your API authentication key. Not api_key. |
| recipient | string | Yes | Phone number with country code (e.g., +233244123456). Not phone. |
| text | string | Yes | Message content to send. Not message. |
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://smess.io/api/send',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query([
'apikey' => 'YOUR_API_KEY_HERE',
'recipient' => '+233244123456',
'text' => 'Hello from SMESS!'
])
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
{
"success": true,
"message": "Message queued successfully",
"queue_id": "q_abc123def456",
"estimated_delivery": "2-3 seconds"
}
POST https://smess.io/api/send
Documents, images, and all media are sent through the same endpoint. Use the appropriate parameters to specify the media type.
| Name | Type | Required | Description |
|---|---|---|---|
| apikey | string | Yes | Your API authentication key |
| recipient | string | Yes | Phone number with country code (e.g., +233244123456) |
| document | string | Yes | Public URL to the document (PDF, DOC, etc.) |
| text | string | No | Optional caption for the document |
| filename | string | No | Display filename (e.g., Invoice-2024.pdf) |
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://smess.io/api/send',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query([
'apikey' => 'YOUR_API_KEY_HERE',
'recipient' => '+233244123456',
'document' => 'https://example.com/invoice.pdf',
'text' => 'Here is your document',
'filename' => 'Invoice-2024.pdf'
])
]);
$response = curl_exec($ch);
curl_close($ch);
GET https://smess.io/api/queue-status?apikey={API_KEY}&queue_id={QUEUE_ID}
{
"success": true,
"queue_id": "q_abc123def456",
"status": "delivered",
"attempts": 1,
"created_at": "2024-01-15T10:30:00Z",
"delivered_at": "2024-01-15T10:30:02Z"
}
The API returns appropriate HTTP status codes and JSON error responses:
| 400 | Bad Request - Missing or invalid parameters |
| 401 | Unauthorized - Invalid API key |
| 403 | Forbidden - Account suspended or rate limited |
| 429 | Too Many Requests - Rate limit exceeded |
| 503 | Service Unavailable - WhatsApp service down |
{
"success": false,
"error": "Invalid API key",
"code": "AUTH_INVALID"
}
To ensure fair usage and system stability, the following rate limits apply:
10 requests
1000 requests
Common mistakes that cause API errors:
This error means the server did not receive your API key. Most common cause: wrong parameter name.
| ❌ Wrong (will fail) | ✅ Correct |
|---|---|
api_key (with underscore) | apikey |
Authorization: Bearer header | apikey as POST form field |
key or token | apikey |
JSON body (Content-Type: application/json) | application/x-www-form-urlencoded |
| ❌ Wrong (will fail) | ✅ Correct |
|---|---|
phone, number, to | recipient |
message, msg, body | text |
curl -X POST https://smess.io/api/send \
-d "apikey=YOUR_API_KEY_HERE" \
-d "recipient=+233244123456" \
-d "text=Hello, this works!"
# WRONG - these parameter names are NOT accepted
curl -X POST https://smess.io/api/send \
-d "api_key=YOUR_API_KEY_HERE" \
-d "phone=+233244123456" \
-d "message=This will fail with 401"