Pricing and billing
The API costs the same as sending from the app. There's no API fee, no monthly fee and no minimum.
The price
| Country | Price per SMS |
|---|---|
| Kenya: Safaricom, Airtel and Telkom | KES 0.80 |
| Tanzania | Coming |
| Uganda | Coming |
One SMS is up to 160 GSM-7 characters (see Message length), so every message costs one SMS. Sending to 1,000 people in Kenya costs KES 800.
We give 30 days' notice before any price change. The sandbox is free.
Money in the API
Amounts are objects with the amount in cents, so there's never a rounding question:
{ "amount": 80, "currency": "KES", "display": "KES 0.80" }Use amount for sums and display to show people.
How you're charged
- Set aside when SemaLink accepts the message (or schedules it). It can't be spent twice.
- Charged when the message is handed to the network (status
sent). - Refunded if it never reaches the network: refused at hand-over, cancelled, or not sent because the person opted out meanwhile. The message shows
refunded: true.
Some messages are never charged:
- Refused numbers (invalid, opted out, another country, no price) are never charged: they never become messages.
- Cancelled messages get what was set aside back at once.
- A request that fails with an error charges nothing.
A message the network accepted but couldn't deliver, for example because the phone stayed off, stays charged. That's how every SMS network bills: the network carried the message.
Top up
Top up your balance with M-Pesa in the dashboard. When the balance can't cover a send, the API answers 402 with insufficient_balance and a shortfall, the amount a top-up must cover, and nothing is sent:
{
"error": {
"type": "insufficient_balance",
"code": "insufficient_balance",
"message": "The balance is KES 40.00 short of this send's KES 800.00. Top up, then send again.",
"shortfall": { "amount": 4000, "currency": "KES", "display": "KES 40.00" },
"doc_url": "https://docs.semalink.africa/errors#insufficient_balance",
"request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
}
}2
3
4
5
6
7
8
9
10
Check prices and your balance
curl https://api.semalink.africa/v1/pricing \
-H "Authorization: Bearer $SEMALINK_API_KEY"
curl https://api.semalink.africa/v1/balance \
-H "Authorization: Bearer $SEMALINK_API_KEY"2
3
4
5
const headers = { Authorization: `Bearer ${process.env.SEMALINK_API_KEY}` };
const pricing = await (await fetch('https://api.semalink.africa/v1/pricing', { headers })).json();
const balance = await (await fetch('https://api.semalink.africa/v1/balance', { headers })).json();
const kenya = pricing.data.find((p) => p.country === 'KE');
const affordable = Math.floor(balance.available.amount / kenya.price_per_sms.amount);
console.log(`${balance.available.display} buys ${affordable} SMS in Kenya`);2
3
4
5
6
7
8
import os
import requests
headers = {"Authorization": f"Bearer {os.environ['SEMALINK_API_KEY']}"}
pricing = requests.get("https://api.semalink.africa/v1/pricing", headers=headers, timeout=30).json()
balance = requests.get("https://api.semalink.africa/v1/balance", headers=headers, timeout=30).json()
kenya = next(p for p in pricing["data"] if p["country"] == "KE")
affordable = balance["available"]["amount"] // kenya["price_per_sms"]["amount"]
print(f"{balance['available']['display']} buys {affordable} SMS in Kenya")2
3
4
5
6
7
8
9
10
11
12
<?php
function semalinkGet(string $path): array
{
$ch = curl_init('https://api.semalink.africa/v1' . $path);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('SEMALINK_API_KEY')],
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
return $result;
}
$pricing = semalinkGet('/pricing');
$balance = semalinkGet('/balance');
$kenya = array_values(array_filter($pricing['data'], fn ($p) => $p['country'] === 'KE'))[0];
$affordable = intdiv($balance['available']['amount'], $kenya['price_per_sms']['amount']);
echo "{$balance['available']['display']} buys {$affordable} SMS in Kenya", PHP_EOL;2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
"object": "list",
"data": [
{
"object": "price",
"country": "KE",
"price_per_sms": { "amount": 80, "currency": "KES", "display": "KES 0.80" }
}
],
"has_more": false,
"next_cursor": null
}2
3
4
5
6
7
8
9
10
11
12
{
"object": "balance",
"livemode": true,
"available": { "amount": 245000, "currency": "KES", "display": "KES 2,450.00" },
"reserved": { "amount": 1600, "currency": "KES", "display": "KES 16.00" }
}2
3
4
5
6
available is what sending can use now, credit included. reserved is set aside for messages that are scheduled or being sent. GET /v1/pricing lists each country your organisation can send to; every network in a country costs the same.
Know the cost before you send
POST /v1/messages/estimate returns the exact cost of a text to a list of numbers (totals.cost), and sends nothing. Every message shows its cost, and a batch shows its cost and what was refunded as it goes.
The sandbox is free
Test keys use a virtual balance of KES 10,000 a day. Sandbox messages are priced like live ones so the numbers look real, but no money moves and nothing appears on your invoices.