Authenticate every request with a bearer token.
According to the official Webline Africa API Docs page, all API requests require a bearer token passed through the authorization header. The token is obtained from your dashboard.
Authorization: Bearer YOUR_API_TOKEN
Use the SMS send endpoint for single-recipient delivery.
The official API Docs page presents a `POST` endpoint for sending SMS to a recipient in international number format.
POST https://sms.webline.africa/api/v3/sms/send
Required fields for the send request.
These parameters are shown on the official documentation page for the `send` endpoint.
| Parameter | Type | Required | Description |
|---|---|---|---|
recipient |
string | Yes | Phone number in international format, for example `+255734666100`. |
sender_id |
string | Yes | Sender ID for the message, with the official docs indicating up to 11 characters. |
message |
string | Yes | Message body content, passed as a URL-encoded value. |
Reference examples for common integration paths.
The official API docs show PHP, JavaScript, and Python examples. The samples below mirror the same implementation pattern while keeping the examples clean and easy to adapt.
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sms.webline.africa/api/v3/sms/send?recipient=%2B255734666100&sender_id=Webline&message=Hello%20from%20Webline",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOUR_API_TOKEN"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
const url = "https://sms.webline.africa/api/v3/sms/send?recipient=%2B255734666100&sender_id=Webline&message=Hello%20from%20Webline";
const options = {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_TOKEN"
}
};
fetch(url, options)
.then((res) => res.json())
.then((json) => console.log(json))
.catch((err) => console.error(err));
import requests
url = "https://sms.webline.africa/api/v3/sms/send"
params = {
"recipient": "+255734666100",
"sender_id": "Webline",
"message": "Hello from Webline"
}
headers = {
"Authorization": "Bearer YOUR_API_TOKEN"
}
response = requests.post(url, params=params, headers=headers)
print(response.json())
Understand success and error responses quickly.
The official documentation shows JSON responses for both successful requests and authentication failures.
{
"status": "success",
"message_id": "12345-abcdef",
"recipient": "+255734666100",
"delivery_status": "SENT"
}
{
"status": "error",
"message": "Invalid API token."
}