SharaSMS
Developers

Add SMS to your app in minutes

A small REST API for bulk, subscription and on-demand messages. Create a token in the portal and send your first message with one request.

Quickstart

Your first request

Every request goes to https://app.sharasms.co.ke and carries your token in the Authorization header. Your short_code_id is shown in the portal.

  • Bulk: POST /api/messages/new
  • Subscription: POST /api/messages/new/subscription
  • On demand: POST /api/messages/new/on-demand (needs linkid)
  • phone accepts one number, an array, or a comma-separated string
Manage API tokens
curl -X POST https://app.sharasms.co.ke/api/messages/new \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "message": "Your code is 482913",
    "phone": "2547xxxxxxxx",
    "short_code_id": "<short_code_id>"
  }'
$ch = curl_init('https://app.sharasms.co.ke/api/messages/new');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $accessToken,
        'Content-Type: application/json',
        'Accept: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'message' => 'Your code is 482913',
        'phone' => '2547xxxxxxxx',
        'short_code_id' => $shortCodeId,
    ]),
]);
$response = curl_exec($ch);
{
  "message": "Our offices are closed on Friday.",
  "phone": ["2547xxxxxxxx", "2541xxxxxxxx"],
  "short_code_id": "<short_code_id>"
}
curl -X POST https://app.sharasms.co.ke/api/messages/new/subscription \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "message": "Today's tip: ...",
    "phone": "2547xxxxxxxx",
    "short_code_id": "<short_code_id>"
  }'
curl -X POST https://app.sharasms.co.ke/api/messages/new/on-demand \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "message": "Here is the result you asked for.",
    "phone": "2547xxxxxxxx",
    "short_code_id": "<short_code_id>",
    "linkid": "<linkid>"
  }'
Good to know

Built to behave predictably

Tokens you control

Create and revoke API tokens from the portal at any time.

Invalid numbers skipped

Numbers that are not valid are skipped and logged, while the rest of the batch still goes out.

Blacklist respected

Numbers on your blacklist are never sent to, even when they appear in an API request.

Clear balance errors

If you do not have enough units for a request, the API returns a 422 error and nothing is sent.

Kenyan and international

Kenyan numbers are routed to the right network automatically. International numbers are supported too.

Delivery tracking

Follow the status of every message from the portal.

Ready to send your first message?

Create an account in a minute, buy units from KES 0.40 each, and start sending today.