Developers

The bulk SMS API for Kenya

One API and one balance to reach Safaricom, Airtel and Telkom. Clean REST, a typed SDK, webhooks and idempotent sends, documented properly so you ship in an afternoon.

Send your first SMS in five minutes

1. Install the SDK

terminal
$ npm install @pesarails/sms

2. Send a message

send.ts
import { Pesarails } from "@pesarails/sms";

const sms = new Pesarails("YOUR_API_KEY");

await sms.send({
  to: "254712345678",
  sender: "PESARAILS",
  message: "Hello from PESA RAILS",
});

Prefer raw HTTP? Here is the same call with curl.

curl
curl https://api.sms.pesarails.com/v1/messages \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "to": "254712345678", "sender": "PESARAILS", "text": "Hello" }'

Endpoints

A small, predictable surface. No surprises.

MethodPathWhat it does
POST/v1/messagesSend an SMS to one recipient
POST/v1/messages/bulkSend up to 1,000 messages in one call
POST/v1/otp/sendSend an OTP or transactional message
GET/v1/messages/:idFetch a message and its delivery events
GET/v1/balanceCheck your SMS credit balance

Delivery reports

Know what landed, in real time

Register a webhook and we post every delivery event the moment a network confirms it. No polling, no guessing. Signed so you can trust the payload.

POST /your-webhook
{
  "event": "message.delivered",
  "data": {
    "id": "a1b2c3",
    "to": "254712345678",
    "status": "DeliveredToTerminal"
  }
}

Build on PESA RAILS

Grab an API key and send a test message in the next five minutes.

Get an API key