This page provides guidelines on how to get started with our REST API to quickly integrate our products and services with your systems. Ensure that you have an active account or click on Sign Up to create an account before proceeding.
Authentication is done using API-key and API-secret. The API-key and API-secret can be generated from My Profile > API > Generate API Credentials. Please note that the parameters will not be visible on your profile after logging out. When new API-credentials are generated, the old API-credentials become invalid. For security reasons, we do not log or keep a record of API-credentials.
Parameter Example
Api-secret 45kr84oo98735lkhtefapidyfjdy
The values must be Base64 encoded before using it in the header. The functions below take the API-key and API-secret and concatenates the two parameters to get bytes representation and encodes the bytes to a Base64 encrypted string. When sending the authorization header, it must begin with the prefix Bearer.
Authorization: Bearer R1RITkZSNjdIR0tINDVrcjg0b285ODczNWxraHRlZmFwaWR5ZmpkeQ==
$apiKey = "your_api_key";
$apiSecret = "your_api_secret";
public void EncryptToBase64()
       String key = "your_api_key";
       String secret = "your_api_secret";
       strToBeEncrypted = key+secret;
       String digest = strToBeEncrypted;
       byte[] bytes = digest.getBytes();
       String encryptedString = Base64.encodeBytes(bytes);
import base64
api_key = 'your_api_key'
api_secret = 'your_api_secret'
token = api_key + api_secret
encoded_u = base64.b64encode(token.encode()).decode()
let api_key = "your_api_key";
let api_secret = "your_api_secret";
let buf = Buffer.from(api_key+''+api_secret, 'utf8');
Send Bulk SMS

Make a HTTP POST request to the endpoint below:


Request Endpoint: https://api.cemanet.co.ke:8445/Cemanet/api/CemanetBulkApi

Request Parameters

Parameter Description Example
productId Used to identify the SMS sender Id. Obtained from accounts profile 1
clientId Allocated to the client after successful registration. Obtained from accounts profile. 1
unique_ref Unique transaction id for the message 136397
dlrEndpoint Dlr endpoint for receiving notifications https://example.com/test
msisdn Recipient mobile number 254722123456
message Text message THIS IS API TEST

Request Header Parameter

Key Value Example
Authorization Bearer + Base64(Api-key+Api-secret) encrypted string Bearer R1RITkZSNjdIR0tINDVrcjg0b285ODczNWxraHRlZmFwaWR5ZmpkeQ==
Content-Type application/json application/json
"unique_ref" : "136397",
"clientId" : "1",
"dlrEndpoint" : "https://example.com/test",
"productId" : "1",
"msisdn" : "254722123456",
"message" : "THIS IS API TEST"
"status_message" : "SUCCESS",
"status_code" : "100",
"credits" : "45"

Status Message:

status_message: SUCCESS status_code: 200 Description: Message submitted successful
status_message: INSUFFICIENT status_code: 201 Description: Insufficient balance in your account
status_message: PENDING status_code: 202 Description: Account NOT Active

Wrap Up Everything
$apiKey = 'your_api_key';
$apiSecret = 'your_api_secret';
$token = base64_encode($apiKey.$apiSecret);
$requestbody = array(
'unique_ref' => 'your_unique_ref', //your own unique reference number
'clientId' => 'your_clientId',
'dlrEndpoint' => 'https://example.com/test',
'productId' => 'your_productId',
'msisdn' => 'your_msisdn',
'message' => 'your_message'
header('Content-Type: application/json'); // Specify the type of data
$ch = curl_init('https://api.cemanet.co.ke:8445/Cemanet/api/CemanetBulkApi'); // Initialise cURL
$requestbody = json_encode($requestbody); // Encode the data array into a JSON string echo $token;
$authorization = "Authorization: Bearer ".$token; // Prepare the authorisation token
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', $authorization )); // Inject the token into the header
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1); // Specify the request method as POST
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestbody); // Set the posted fields
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // This will follow any redirects
$result = curl_exec($ch); // Execute the cURL statement
   if (curl_errno($ch)) {
$error_msg = curl_error($ch);
curl_close($ch); // Close the cURL connection
echo $result;
import java.io.*;
import java.util.Random;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
public class CemanetJava_Class {
public CemanetJava_Class()
public void sendText()
String endpoint ="Your_endpoint";
String url ="https://api.cemanet.co.ke:8445/Cemanet/api/CemanetBulkApi";
String product_id ="your_product_id";
String mobile ="your_mobile_number";
String msg ="Your_text_message";
String key ="your_api_key";
String secret ="your_api_secret";
String client_id ="your_clientID";
String resp ="";
int resp_codes =0;
BufferedReader rd =null;
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
JSONParser jsonParser = new JSONParser();
String hashdata=key+secret;
String final_request=EncryptBase64(hashdata) ;
String basicAuth="Bearer "+final_request;
String corr=generateCorrelatorId();
JSONObject obj = new JSONObject();
obj.put("productId", product_id);
obj.put("clientId", client_id);
obj.put("msisdn", mobile);
obj.put("message", msg);
obj.put("unique_ref", corr);
obj.put("dlrEndpoint", endpoint);
String request = obj.toJSONString();
// add header
post.setHeader("Authorization", basicAuth);
post.setEntity(new StringEntity(request));
HttpResponse response = client.execute(post);
System.out.println("Response Code : "
rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer result = new StringBuffer();

String line = "";
while ((line = rd.readLine()) != null)
{ result.append(line);
System.out.println("Response Code : " +resp);
catch(Exception e)
//generate correlator
public String generateCorrelatorId()
String code = "";
int aStart = 1000000;
long aEnd = 9999999L;
Random random = new Random();
if ( aStart > aEnd )
throw new IllegalArgumentException("Start cannot exceed End.");
long range = aEnd - (long)aStart + 1;
long fraction = (long)(range * random.nextDouble());
long randomNumber = fraction + (long)aStart;
code = String.valueOf(randomNumber);
return code;
//using base64
public String EncryptBase64(String strToBeEncrypted)
String encryptedString = null;
byte[] bytesToBeEncrypted;
try {
String digest = strToBeEncrypted;
byte[] bytes = digest.getBytes();
encryptedString =Base64.encodeBytes(bytes);
catch(Exception e)
return encryptedString;
public static void main(String[] args)
new CemanetJava_Class().sendText();
import base64
import json
import requests
api_key = "your_api_key"
api_secret = "your_api_secret"
# Get Bearer
token = api_key + api_secret
message_bytes = token.encode('ascii')
base64_bytes = base64.b64encode(message_bytes)
bearer = base64_bytes.decode('ascii')
# Handle data and send to API enpoint
post_dict = {
'unique_ref': 'your_unique_ref',
'clientId': 'your_clientID',
'dlrEndpoint': 'https://example.com/test',
'productId': 'your_productID',
'msisdn': 'your_msisdn',
'message': 'your_message',
data = json.dumps(post_dict) #converts data to json
url = 'https://api.cemanet.co.ke:8445/Cemanet/api/CemanetBulkApi' # set url
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer ' + bearer} # set headers
r = requests.get(url=url, data=data, headers=headers) # make the request to the API endpoint
my_data = r.json() # converts the request into json format
const https = require('https');
let api_key = "your_api_key";
let api_secret = "your_api_secret";
let buf = Buffer.from(api_key+''+api_secret, 'utf8');
let authorization = "Bearer " + buf.toString('base64');
const data = JSON.stringify({
unique_ref: "your_unique_ref",
clientId: "your_clientID",
dlrEndpoint: "your_endpoint",
productId: "your_productID",
message: "your_message",
msisdn: "your_msisdn"
const options = {
hostname: 'api.cemanet.co.ke',
port: 8445,
path: '/Cemanet/api/CemanetBulkApi',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length,
'Authorization': authorization,
const req = https.request(options, (res) => {
console.log(`statusCode: ${res.statusCode}`)
res.on('data', (d) => {
req.on('error', (error) => {