Developers
Ship SMS in minutes, not days.
One HTTPS endpoint, Bearer-token auth and JSON responses. Send single or bulk SMS, check balance, pull delivery history and read two-way replies.
Quickstart
Three steps to your first message
Step 2
Generate a key
Go to Profile → API keys. The 64-character key is shown once, so store it in an environment variable.
Step 3
Send
POST action=send with a recipient and message. A 201 code means the message was accepted.
Code samples
Copy, paste, send
<?php
$ch = curl_init('https://dashboard.connectmedia.co.ke/api.php');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CM_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'action' => 'send',
'to' => '254712345678',
'message' => 'Payment received. Thank you!',
]),
]);
$res = json_decode(curl_exec($ch), true);
if (($res['code'] ?? '') !== '201') {
error_log('SMS failed: ' . ($res['message'] ?? 'no response'));
}
// Node.js 18+ (built-in fetch)
const res = await fetch('https://dashboard.connectmedia.co.ke/api.php', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CM_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
action: 'send',
to: '254712345678',
message: 'Payment received. Thank you!',
}),
});
const body = await res.json();
if (body.code !== '201') console.error('SMS failed:', body.message);
import os, requests
res = requests.post(
"https://dashboard.connectmedia.co.ke/api.php",
headers={"Authorization": f"Bearer {os.environ['CM_API_KEY']}"},
json={
"action": "send",
"to": "254712345678",
"message": "Payment received. Thank you!",
},
timeout=15,
).json()
if res.get("code") != "201":
print("SMS failed:", res.get("message"))
curl -X POST "https://dashboard.connectmedia.co.ke/api.php" \
-H "Authorization: Bearer $CM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"action":"send","to":"254712345678","sender":"ConectMedia","message":"Hello from Connect Media"}'
Endpoint
One URL, four actions
Send requests to https://dashboard.connectmedia.co.ke/api.php as JSON or form data. Authenticate with Authorization: Bearer <key>; the X-Api-Key header also works.
send→ 201to(254XXXXXXXXX, comma-separated for bulk),message, optionalsender(max 11 chars),scheduleandschedule_datetime(Africa/Nairobi).balance→ 200Current account credit.history→ 202Sent messages and delivery status, withlimit,offset,start_dateandend_date.inbox→ 302Replies from two-way SMS, withlimitandoffset.
Responses
Check code, not HTTP status
Every response uses the same JSON envelope. HTTP status is usually 200, so the application code tells you what happened.
{
"code": "201",
"message": "…",
"data": { … },
"api_version": "…"
}| Code | Meaning |
|---|---|
| 100 | Invalid or missing API key |
| 101 | Insufficient balance |
| 102 | Rejected (content, hold or gateway busy) |
| 103 | No action given |
| 104 | No valid recipients |
| 105 | Message missing |
| 106 | Banned words detected |
| 500 | Server or gateway failure |
Good to know
Before you go live
Phone numbers
International format without the plus: 254712345678. Bad numbers return code 104.
Retries
A retried request can send the message twice. De-duplicate on your side before retrying after a timeout.
Keep keys secret
Send the key in a header, not the query string, and call the API from your server, never from a browser or mobile app.
OpenAPI 3 spec
Import into Postman or Insomnia, or generate a client. Download the spec.
Prefer Postman? Open our public Postman workspace or download the collection. We are also listed on RapidAPI.
Official libraries: PHP (composer require connectmedia/sms), Python (pip install connectmedia-sms) and Node.js (npm install connectmedia-sms).
Sending high volumes continuously? SMPP connections are available on request. Email us or read SMPP vs HTTP API.
Sender IDs
Send under your brand name. Register a sender ID.
Payment alerts
See how to send SMS receipts from M-Pesa callbacks.
Need a hand integrating?
Our Nairobi team helps with setup, sender IDs, USSD and IVR integrations.