Integrate SMS functionality in 7+ programming languages
SimNet SMS API provides a robust, scalable solution for sending SMS messages programmatically. Our API supports bulk SMS, delivery reports, real-time balance checking, and detailed analytics. With examples in 7+ programming languages, integration is seamless across any platform.
https://api-smstz.simnet.co.tz/sms_api
JSON
API Key + Client ID
All API requests require authentication using API key and client ID in headers.
X-API-Key: your_api_key_here
X-Client-ID: your_client_id_here
Content-Type: application/json
Security Note: Keep your API credentials secure. Never expose them in client-side code or public repositories.
/send
| Parameter | Type | Required | Description |
|---|---|---|---|
| to | string/array | Yes | Phone number(s) - comma separated or array |
| message | string | Yes | SMS content (max 1600 chars) |
| sender_id | string | No | Sender name (max 11 chars, default: INFO) |
| flash | boolean | No | Flash SMS (default: false) |
<?php
$apiKey = "your_api_key";
$clientId = "your_client_id";
$ch = curl_init("https://api-smstz.simnet.co.tz/sms_api/send");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"X-API-Key: $apiKey",
"X-Client-ID: $clientId",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode([
"to" => ["255716718040", "255655912841"],
"message" => "Hello from PHP!",
"sender_id" => "SimNet",
"flash" => false
])
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "HTTP Code: $httpCode\n";
echo "Response: $response\n";
?>
{
"status": "success",
"message": "All messages sent successfully",
"timestamp": "2026-04-26 17:45:29",
"request_id": "req_69ee250929f44",
"data": {
"recipients": {
"valid": 2,
"invalid": 0,
"total": 2,
"successful": 2,
"pending": 0,
"failed": 0
},
"sms_count": {
"attempted": 2,
"sent": 2
},
"credit_balance": 1000,
"reference": "api_CLIENT_123456"
}
}
/balance
<?php
$apiKey = "your_api_key";
$clientId = "your_client_id";
$ch = curl_init("https://api-smstz.simnet.co.tz/sms_api/balance");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"X-API-Key: $apiKey",
"X-Client-ID: $clientId"
]
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "Balance Response: $response\n";
?>
{
"status": "success",
"message": "Balance retrieved successfully",
"timestamp": "2026-04-26 17:45:29",
"data": {
"balance": 15450,
"currency": "TZS"
}
}
/reports
| Parameter | Type | Description |
|---|---|---|
| limit | int | Results per page (max 1000) |
| offset | int | Pagination offset |
| status | string | Filter by status (success/pending/failed) |
| from_date | date | Start date (YYYY-MM-DD) |
| to_date | date | End date (YYYY-MM-DD) |
import requests
api_key = "your_api_key"
client_id = "your_client_id"
params = {
"limit": 10,
"offset": 0,
"status": "success"
}
response = requests.get(
"https://api-smstz.simnet.co.tz/sms_api/reports",
headers={"X-API-Key": api_key, "X-Client-ID": client_id},
params=params
)
print(response.json())
Full working examples in different programming languages
<?php
class SimNetSMS {
private $apiKey;
private $clientId;
private $baseUrl;
public function __construct($apiKey, $clientId) {
$this->apiKey = $apiKey;
$this->clientId = $clientId;
$this->baseUrl = "https://api-smstz.simnet.co.tz/sms_api";
}
public function send($to, $message, $senderId = "INFO") {
$ch = curl_init("{$this->baseUrl}/send");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"X-API-Key: {$this->apiKey}",
"X-Client-ID: {$this->clientId}",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode([
"to" => is_array($to) ? $to : explode(',', $to),
"message" => $message,
"sender_id" => $senderId
])
]);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
public function getBalance() {
$ch = curl_init("{$this->baseUrl}/balance");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"X-API-Key: {$this->apiKey}",
"X-Client-ID: {$this->clientId}"
]
]);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
}
// Usage
$sms = new SimNetSMS("your_api_key", "your_client_id");
$result = $sms->send("255716718040", "Hello World!", "SimNet");
$balance = $sms->getBalance();
?>
import requests
from typing import List, Dict, Union
class SimNetSMS:
def __init__(self, api_key: str, client_id: str):
self.api_key = api_key
self.client_id = client_id
self.base_url = "https://api-smstz.simnet.co.tz/sms_api"
def send(self, to: Union[str, List[str]], message: str,
sender_id: str = "INFO") -> Dict:
headers = {
"X-API-Key": self.api_key,
"X-Client-ID": self.client_id,
"Content-Type": "application/json"
}
if isinstance(to, str):
to = [x.strip() for x in to.split(',')]
payload = {
"to": to,
"message": message,
"sender_id": sender_id,
"flash": False
}
response = requests.post(
f"{self.base_url}/send",
headers=headers,
json=payload
)
return response.json()
def get_balance(self) -> Dict:
headers = {
"X-API-Key": self.api_key,
"X-Client-ID": self.client_id
}
response = requests.get(
f"{self.base_url}/balance",
headers=headers
)
return response.json()
def get_reports(self, limit: int = 100, offset: int = 0,
status: str = None) -> Dict:
headers = {
"X-API-Key": self.api_key,
"X-Client-ID": self.client_id
}
params = {"limit": limit, "offset": offset}
if status:
params["status"] = status
response = requests.get(
f"{self.base_url}/reports",
headers=headers,
params=params
)
return response.json()
# Usage
sms = SimNetSMS("your_api_key", "your_client_id")
result = sms.send("255716718040", "Hello World!", "SimNet")
balance = sms.get_balance()
reports = sms.get_reports(limit=10, status="success")
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using System.Collections.Generic;
public class SimNetSMS
{
private readonly string _apiKey;
private readonly string _clientId;
private readonly HttpClient _httpClient;
private const string BaseUrl = "https://api-smstz.simnet.co.tz/sms_api";
public SimNetSMS(string apiKey, string clientId)
{
_apiKey = apiKey;
_clientId = clientId;
_httpClient = new HttpClient();
}
public async Task SendAsync(string[] to, string message,
string senderId = "INFO")
{
var payload = new
{
to = to,
message = message,
sender_id = senderId,
flash = false
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
_httpClient.DefaultRequestHeaders.Clear();
_httpClient.DefaultRequestHeaders.Add("X-API-Key", _apiKey);
_httpClient.DefaultRequestHeaders.Add("X-Client-ID", _clientId);
var response = await _httpClient.PostAsync($"{BaseUrl}/send", content);
var responseBody = await response.Content.ReadAsStringAsync();
return JsonDocument.Parse(responseBody).RootElement;
}
public async Task GetBalanceAsync()
{
_httpClient.DefaultRequestHeaders.Clear();
_httpClient.DefaultRequestHeaders.Add("X-API-Key", _apiKey);
_httpClient.DefaultRequestHeaders.Add("X-Client-ID", _clientId);
var response = await _httpClient.GetAsync($"{BaseUrl}/balance");
var responseBody = await response.Content.ReadAsStringAsync();
var json = JsonDocument.Parse(responseBody);
return json.RootElement.GetProperty("data").GetProperty("balance").GetInt32();
}
}
// Usage
var sms = new SimNetSMS("your_api_key", "your_client_id");
var result = await sms.SendAsync(
new[] { "255716718040", "255655912841" },
"Hello from C#!",
"SimNet"
);
var balance = await sms.GetBalanceAsync();
class SimNetSMS(private val apiKey: String, private val clientId: String) {
private val client = OkHttpClient()
private val gson = Gson()
private val baseUrl = "https://api-smstz.simnet.co.tz/sms_api"
fun sendSMS(to: List, message: String,
senderId: String = "INFO", callback: (Result) -> Unit) {
val payload = mapOf(
"to" to to,
"message" to message,
"sender_id" to senderId,
"flash" to false
)
val json = gson.toJson(payload)
val body = RequestBody.create(
MediaType.parse("application/json"), json
)
val request = Request.Builder()
.url("$baseUrl/send")
.addHeader("X-API-Key", apiKey)
.addHeader("X-Client-ID", clientId)
.post(body)
.build()
client.newCall(request).enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
callback(Result.Error(e.message ?: "Network error"))
}
override fun onResponse(call: Call, response: Response) {
val body = response.body?.string() ?: ""
callback(Result.Success(body))
}
})
}
suspend fun getBalance(): Int {
val request = Request.Builder()
.url("$baseUrl/balance")
.addHeader("X-API-Key", apiKey)
.addHeader("X-Client-ID", clientId)
.get()
.build()
return withContext(Dispatchers.IO) {
val response = client.newCall(request).execute()
val body = response.body?.string() ?: "{}"
val json = JSONObject(body)
json.getJSONObject("data").getInt("balance")
}
}
sealed class Result {
data class Success(val data: String) : Result()
data class Error(val message: String) : Result()
}
}
Invalid or missing API credentials
Insufficient credit balance
Permission denied or IP not whitelisted
Endpoint not found
Rate limit exceeded
Server error, please try again later
Test the API endpoints directly from your browser
CLItdqp0uuu29BDEAA3485C
08b8245472e3667189bdad57e57c1fdd4a2efa4004b1dd70