Quick Start
Code samples
Copy-paste recipes for the most common Sozuri calls in nine languages. Drop your project name and API key in, hit run, and you’ll see a real message land on a real phone within seconds.
The base URL for messaging endpoints is
https://sozuri.net/api/v1/messaging. Use the Postman fork button in the sidebar to try every endpoint without writing a line of code.
Send your first SMS
1. Set the request headers
POST /api/v1/messaging
Content-Type: application/json
Authorization: Bearer Your_Project_API_KEY
2. (Quick) Sample GET request
https://sozuri.net/api/v1/messaging?apiKey=Your_Project_API_KEY&project=Your_Project_name&from=MySenderID&to=254722xxx675&campaign=Nai-Promo&channel=sms&message=SozuriTestSMS&type=promotional
3. Sample POST request — pick your language
POST /api/v1/messaging HTTP/1.1
Host: sozuri.net
Authorization: Bearer LOx5JPdqf0lvf.......R9X9XDJ4PFxRqVrt9dx83cWiwfTQMF
Content-Type: application/json
Accept: application/json
{
"project": "my project",
"from": "Sozuri",
"to": "2547251642xx,2547326971xx",
"campaign": "Promo Nai",
"channel": "sms",
"message": "Test SMS.",
"type": "promotional"
}
POST /api/v1/messaging HTTP/1.1
Host: sozuri.net
Authorization: Bearer LOx5JPdqf0lvf45EZAQMJ.......SUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF
Content-Type: application/json
Accept: application/xml
<request>
<project>my project</project>
<from>Sozuri</from>
<to>2547251642xx,2547326971xx</to>
<campaign>Promo Nai</campaign>
<channel>sms</channel>
<message>Test SMS.</message>
<type>promotional</type>
</request>
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sozuri.net/api/v1/messaging",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
"project" => "my project",
"from" => "Sozuri",
"to" => "2547251642xx,2547326971xx",
"campaign" => "Promo Nai",
"channel" => "sms",
"message" => "Test SMS.",
"type" => "promotional",
]),
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Authorization: Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF",
"Content-Type: application/json",
],
]);
echo curl_exec($curl);
curl_close($curl);
const response = await fetch("https://sozuri.net/api/v1/messaging", {
method: "POST",
headers: {
"Authorization": "Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF",
"Content-Type": "application/json",
"Accept": "application/json"
},
body: JSON.stringify({
project: "my project",
from: "Sozuri",
to: "2547251642xx,2547326971xx",
campaign: "Promo Nai",
channel: "sms",
message: "Test SMS.",
type: "promotional"
})
});
console.log(await response.json());
require 'uri'
require 'net/http'
require 'json'
uri = URI("https://sozuri.net/api/v1/messaging")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF"
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request.body = {
project: "my project", from: "Sozuri", to: "2547251642xx,2547326971xx",
campaign: "Promo Nai", channel: "sms", message: "Test SMS.", type: "promotional"
}.to_json
puts http.request(request).body
import requests
response = requests.post(
"https://sozuri.net/api/v1/messaging",
headers={
"Authorization": "Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF",
"Content-Type": "application/json",
"Accept": "application/json",
},
json={
"project": "my project", "from": "Sozuri",
"to": "2547251642xx,2547326971xx", "campaign": "Promo Nai",
"channel": "sms", "message": "Test SMS.", "type": "promotional",
},
)
print(response.json())
HttpResponse<String> response = Unirest.post("https://sozuri.net/api/v1/messaging")
.header("Authorization", "Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF")
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.body("{\"project\":\"my project\",\"from\":\"Sozuri\",\"to\":\"2547251642xx,2547326971xx\","
+ "\"campaign\":\"Promo Nai\",\"channel\":\"sms\",\"message\":\"Test SMS.\",\"type\":\"promotional\"}")
.asString();
var client = new RestClient("https://sozuri.net/api/v1/messaging");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF");
request.AddParameter("application/json",
"{\"project\":\"my project\",\"from\":\"Sozuri\",\"to\":\"2547251642xx,2547326971xx\","
+ "\"campaign\":\"Promo Nai\",\"channel\":\"sms\",\"message\":\"Test SMS.\",\"type\":\"promotional\"}",
ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
curl -X POST https://sozuri.net/api/v1/messaging \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer LOx5JPdqf0lvf45EZAQMJm85OSUzyxR9X9XDJ4PFxRqVrt9dx83cWiwfTQMF' \
-d '{
"project": "my project",
"from": "Sozuri",
"to": "2547251642xx,2547326971xx",
"campaign": "Promo Nai",
"channel": "sms",
"message": "Test SMS.",
"type": "promotional"
}'
4. Expected response
{
"messageData": { "messages": 2 },
"recipients": [
{
"messageId": "MSGBLK6012A7E8B90A21611835368",
"to": "2547251642xx",
"status": "accepted",
"statusCode": "11",
"bulkId": "bulk6012a7e8b904e1611835368",
"messagePart": 1,
"type": "promotional"
}
]
}
Recipes for every channel
This page shows the SMS happy path. For full request/response, multi-language samples, callbacks and edge cases, jump to the channel docs:
Bulk SMS
Send to one or thousands across Safaricom, Airtel and Telkom.
Text, media, location, contacts, interactive lists & buttons.
Airtime
Send airtime top-ups to any Kenyan subscriber.
Payments
M-Pesa STK Push, C2B, hosted pay links.
Contacts
Phonebook + groups for targeted campaigns.
Webhooks
Receive delivery, read and inbound events in real time.
Have your first message land in five minutes.
Sign up, copy a snippet, paste your API key, and watch a real SMS arrive.