API reference
The SemaLink API is JSON over HTTPS. Each resource page shows every endpoint in two columns: what it does and its parameters on the left, requests in curl, Node.js, Python and PHP with real responses on the right.
Base URL
https://api.semalink.africa/v1The same address serves the sandbox and live: your key decides which. HTTPS only.
Authentication
Send your API key as a bearer token on every request:
Authorization: Bearer sk_test_...sk_test_ keys work in the sandbox; sk_live_ keys send real messages. Each key has scopes, and each endpoint below shows the scope it needs. Requests from web browsers are refused: keys belong on servers. See Authentication.
Requests and responses
- Send JSON bodies with
Content-Type: application/json, in UTF-8, up to 1 MB. Bodies are strict: a field the endpoint doesn't know is an error (parameter_unknown), so typos never pass unnoticed. - Every response is JSON and carries a
Request-Idheader (req_...). - Every
POSTtakes anIdempotency-Keyheader. See Idempotency. - Every request is stopped after 30 seconds (
request_timeout). - Every response carries rate-limit headers. See Rate limits.
IDs
IDs are strings with a prefix that says what they are, such as msg_3b9f6c2a1d4e4f5a8b7c6d5e4f3a2b1c. Treat them as opaque text: store them whole and don't parse them.
| Prefix | Object |
|---|---|
msg_ | Message |
bat_ | Batch |
snd_ | Sender ID |
whe_ | Webhook endpoint |
evt_ | Event |
org_ | Your organisation |
key_ | An API key (shown by GET /v1/account) |
req_ | Request (for support) |
Times
All times are ISO 8601 in UTC, such as 2026-12-02T07:15:22.000Z. When you send a time (send_at, created[gte]), you may include an offset: 2026-12-05T09:00:00+03:00 is 09:00 in Nairobi.
Money
Money is an object, with the amount in cents (the smallest unit), its currency, and the amount written for people:
{ "amount": 80, "currency": "KES", "display": "KES 0.80" }| Field | Type | Description |
|---|---|---|
amount | integer | The amount in cents. KES 0.80 is 80; KES 2,450.00 is 245000. |
currency | string | ISO 4217 code, such as KES. |
display | string | Ready to show, such as KES 0.80. |
Lists
List endpoints return a page with object: "list", data, has_more and next_cursor. Pass limit (1 to 100, default 20) and starting_after. See Pagination.
Errors
Errors use HTTP status codes and one JSON shape with a stable code:
{
"error": {
"type": "invalid_request_error",
"code": "message_too_long",
"message": "The text is 172 characters: one SMS holds 160. Shorten it by 12.",
"param": "text",
"characters": 172,
"max_characters": 160,
"doc_url": "https://docs.semalink.africa/errors#message_too_long",
"request_id": "req_5f1d0c2e8a9b4c3d9e7f6a5b4c3d2e1f"
}
}2
3
4
5
6
7
8
9
10
11
12
Every code is explained on the Errors page.
Versioning
This is version 1, in the path (/v1). Version 1 only changes by adding things: new endpoints, new optional fields, new fields in responses, new event types, new error codes. Write your code to ignore fields it doesn't know. A change that could break your code would come as /v2, with at least 6 months' notice and a changelog entry.
OpenAPI
The whole API is described in an OpenAPI 3.1 file. Import it into Postman or Insomnia, or generate a client from it:
- Download openapi.json
- Live from the API:
GET https://api.semalink.africa/v1/openapi.json, no key needed. It's the one endpoint a browser may call. See OpenAPI spec.
Official libraries for Node.js, Python and PHP are planned after launch. Until then, every example in these docs is plain HTTP.