Check your balance
GET
/api/v3/balanceReturns the SMS units left on your account. Check it before a large send so a campaign does not stop halfway.
Example request
curl -X GET "https://app.nkomosms.com/api/v3/balance" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"<?php
$ch = curl_init('https://app.nkomosms.com/api/v3/balance');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_TOKEN',
'Accept: application/json',
],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($response['status'] ?? '') === 'success') {
print_r($response['data']);
} else {
echo $response['message'] ?? 'Request failed';
}// Node.js 18 or newer (fetch is built in)
const res = await fetch('https://app.nkomosms.com/api/v3/balance', {
method: 'GET',
headers: {
Authorization: 'Bearer YOUR_API_TOKEN',
Accept: 'application/json',
},
});
const result = await res.json();
if (result.status === 'success') {
console.log(result.data);
} else {
console.error(result.message);
}import requests
response = requests.get(
"https://app.nkomosms.com/api/v3/balance",
headers={"Authorization": "Bearer YOUR_API_TOKEN", "Accept": "application/json"},
timeout=30,
)
result = response.json()
if result["status"] == "success":
print(result["data"])
else:
print(result["message"])Response
{
"status": "success",
"data": "…"
}Error response
{
"status": "error",
"message": "A human-readable description of the error."
}View your profile
GET
/api/v3/meReturns the details of the account that owns the API token.
Example request
curl -X GET "https://app.nkomosms.com/api/v3/me" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"<?php
$ch = curl_init('https://app.nkomosms.com/api/v3/me');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_TOKEN',
'Accept: application/json',
],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($response['status'] ?? '') === 'success') {
print_r($response['data']);
} else {
echo $response['message'] ?? 'Request failed';
}// Node.js 18 or newer (fetch is built in)
const res = await fetch('https://app.nkomosms.com/api/v3/me', {
method: 'GET',
headers: {
Authorization: 'Bearer YOUR_API_TOKEN',
Accept: 'application/json',
},
});
const result = await res.json();
if (result.status === 'success') {
console.log(result.data);
} else {
console.error(result.message);
}import requests
response = requests.get(
"https://app.nkomosms.com/api/v3/me",
headers={"Authorization": "Bearer YOUR_API_TOKEN", "Accept": "application/json"},
timeout=30,
)
result = response.json()
if result["status"] == "success":
print(result["data"])
else:
print(result["message"])Response
{
"status": "success",
"data": "…"
}Error response
{
"status": "error",
"message": "A human-readable description of the error."
}Need help with your integration?
Message us on WhatsApp, call +233 55 269 0110 or email support@nkomosms.com. Send us the request you made and the response you got, but never your API token.