cURL
curl --request GET \
--url https://api.belio.co.ke/bundle/{productType} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.belio.co.ke/bundle/{productType}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.belio.co.ke/bundle/{productType}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.belio.co.ke/bundle/{productType}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.belio.co.ke/bundle/{productType}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.belio.co.ke/bundle/{productType}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.belio.co.ke/bundle/{productType}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"desc": "OK",
"result": [
{
"type": "SmsBundleResponse",
"reference": "xyz-001",
"band": "ENTERPRISE",
"bandName": "ENTERPRISE",
"balances": [
{
"type": "SmsBundleBalanceResponse",
"id": 1,
"channel": "Safaricom",
"allotted": 1000,
"balance": 8000,
"reserved": 0,
"expiry": "2025-12-24T18:17:23.674460173"
}
],
"rates": {
"Safaricom": 0.348
},
"createdAt": "2024-11-18T10:49:34",
"validity": "90 days"
}
]
}{
"desc": "<string>",
"result": "<unknown>"
}{
"desc": "<string>",
"result": "<unknown>"
}{
"desc": "<string>",
"result": "<unknown>"
}{
"desc": "<string>",
"result": "<unknown>"
}{
"desc": "<string>",
"result": "<unknown>"
}Bundles
List Bundles
Retrieve a list of bundles for a product type
GET
/
bundle
/
{productType}
cURL
curl --request GET \
--url https://api.belio.co.ke/bundle/{productType} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.belio.co.ke/bundle/{productType}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.belio.co.ke/bundle/{productType}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.belio.co.ke/bundle/{productType}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.belio.co.ke/bundle/{productType}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.belio.co.ke/bundle/{productType}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.belio.co.ke/bundle/{productType}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"desc": "OK",
"result": [
{
"type": "SmsBundleResponse",
"reference": "xyz-001",
"band": "ENTERPRISE",
"bandName": "ENTERPRISE",
"balances": [
{
"type": "SmsBundleBalanceResponse",
"id": 1,
"channel": "Safaricom",
"allotted": 1000,
"balance": 8000,
"reserved": 0,
"expiry": "2025-12-24T18:17:23.674460173"
}
],
"rates": {
"Safaricom": 0.348
},
"createdAt": "2024-11-18T10:49:34",
"validity": "90 days"
}
]
}{
"desc": "<string>",
"result": "<unknown>"
}{
"desc": "<string>",
"result": "<unknown>"
}{
"desc": "<string>",
"result": "<unknown>"
}{
"desc": "<string>",
"result": "<unknown>"
}{
"desc": "<string>",
"result": "<unknown>"
}Refer to Authentication for information on how to obtain a
bearer token. This endpoint requires the
bundle.list API client
authorization scope to access the list of bundles. You can set up scopes on
the API Clients
page.Rate Limit
This endpoint is rate limited to 1 request per second.Product types
The path parameter selects which product’s bundles to return. Matching is case insensitive.productType | Response type | Balance type | How remaining units are stored |
|---|---|---|---|
SMS | SmsBundleResponse | SmsBundleBalanceResponse | Per mobile network (Safaricom, Airtel) |
DATA_BUNDLE | DataBundleResponse | DataBundleBalanceResponse | Per mobile network, with a denomination such as 1GB |
WHATSAPP | WhatsAppBundleResponse | WhatsAppBundleBalanceResponse | Per WhatsApp pricing category on the WhatsApp channel |
rates uses the same keys as the balances: network names for SMS and data, pricing categories for WhatsApp.
Bundle fields
Each item inresult has the same envelope.
| Field | Type | Required | Description |
|---|---|---|---|
type | string | yes | SmsBundleResponse, DataBundleResponse, or WhatsAppBundleResponse |
reference | string | yes | Bundle ID |
band | string | yes | Bouquet band: STARTER, STANDARD, ENTERPRISE, SANDBOX, CUSTOM, or PERSONAL |
bandName | string | no | Display name for the band |
rates | object | yes | Unit price per network or per WhatsApp pricing category |
balances | object[] | yes | Remaining units. Shape depends on the product. See Balances. |
validity | string | no | How long the bundle lasts, for example 90 days. null when it does not expire. |
createdAt | string | yes | When the bundle was created |
updatedAt | string | no | When the bundle was last updated. Omitted when it has never been updated. |
Balances
Every balance row includesid, channel, balance, allotted, reserved, and expiry. balance is what you can still spend. reserved is held for in-flight requests.
The extra fields depend on the product:
| Product | Extra fields | channel |
|---|---|---|
| SMS | None | Mobile network |
| Data | denomination | Mobile network |
category, arrears | Always WhatsApp |
denomination is the data size on that row, for example 2GB. category is the WhatsApp pricing category. arrears is extra units owed after a send settled at a higher category than the one reserved. It is 0 when nothing is owed.
Examples
- SMS
- Data
- WhatsApp
{
"desc": "OK",
"result": [
{
"type": "SmsBundleResponse",
"reference": "xyz-001",
"band": "ENTERPRISE",
"bandName": "ENTERPRISE",
"balances": [
{
"type": "SmsBundleBalanceResponse",
"id": 1,
"channel": "Safaricom",
"allotted": 1000,
"balance": 8000,
"reserved": 0,
"expiry": "2025-12-24T18:17:23.674460173"
}
],
"rates": {
"Safaricom": 0.348
},
"createdAt": "2024-11-18T10:49:34",
"validity": "90 days"
}
]
}
{
"desc": "OK",
"result": [
{
"type": "DataBundleResponse",
"reference": "data-001",
"band": "PERSONAL",
"bandName": "BUSINESS",
"balances": [
{
"type": "DataBundleBalanceResponse",
"id": 2,
"channel": "Safaricom",
"denomination": "2GB",
"allotted": 100,
"balance": 50,
"reserved": 10,
"expiry": "2024-12-31T23:59:59"
}
],
"rates": {
"Safaricom": 12.5
},
"createdAt": "2024-10-10T09:30:00",
"validity": "30 days"
}
]
}
{
"desc": "OK",
"result": [
{
"type": "WhatsAppBundleResponse",
"reference": "wa-001",
"band": "ENTERPRISE",
"bandName": "ENTERPRISE",
"balances": [
{
"type": "WhatsAppBundleBalanceResponse",
"id": 1,
"channel": "WhatsApp",
"category": "Marketing",
"balance": 1500,
"allotted": 2000,
"reserved": 0,
"arrears": 0,
"expiry": "2025-12-24T18:17:23.674460173"
}
],
"rates": {
"Marketing": 0.58,
"Utility": 0.232
},
"createdAt": "2024-11-18T10:49:34",
"validity": "90 days"
}
]
}