Returns the network and product details given a mobile.

Endpoint


POST https://app.topups.co.ke/api/get_product LIVE

Request


Parameter Example
Headers
Accept application/json
String | Optional
The format of the response body. Options are:
  • application/json
  • text/xml
Defaults to application/json if not specified.
Authorization Bearer a12f4f9a99be83f1e631e379834864e7
String | Required
The API token used for authorizing the API call as Bearer token.
Content-Type application/json
String | Optional
The format of the request body. Options are:
  • application/json
  • text/xml
Defaults to application/json if not specified.
Body
channel_type Airtime
String | Required
Type of Topups channel. Options are:
  • Airtime
  • Agent Float
  • SMS
country_symbol KE
String | Required
Country code of the mobile. In 2 letter international ISO format. Options are:
  • KE (Kenya)
mobile 254722000000
Integer | Required
Mobile number to query network and other details. Expected format to have country code without the plus (+) e.g 2547XXXXXXXX

Code Scripts


POST /api/get_product HTTP/1.1
Host: app.topups.co.ke
Accept: application/json
Authorization: Bearer a12f4f9a99be83f1e631e379834864e7
Content-Type: application/json
Content-Length: 35

{
    "channel_type": "Airtime",
    "country_symbol": "KE",
    "mobile": "254722000000"
}
curl --request POST 'https://app.topups.co.ke/api/send_airtime' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer a12f4f9a99be83f1e631e379834864e7' \
--header 'Content-Type: application/json' \
--data-raw '{
    "channel_type": "Airtime",
    "country_symbol": "KE",
    "mobile": "254722000000"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://app.topups.co.ke/api/get_product',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS =>'{
        "channel_type": "Airtime",
        "country_symbol": "KE",
        "mobile": "254722000000"
    }',
    CURLOPT_HTTPHEADER => array(
        'Accept: application/json',
        'Authorization: Bearer a12f4f9a99be83f1e631e379834864e7',
        'Content-Type: application/json'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
#!/usr/bin/python
import http.client
import json

conn = http.client.HTTPSConnection("app.topups.co.ke")
payload = json.dumps({
    "channel_type": "Airtime",
    "country_symbol": "KE",
    "mobile": "254722000000"
})
headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer a12f4f9a99be83f1e631e379834864e7',
    'Content-Type': 'application/json'
}
conn.request("POST", "/api/get_product", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require "uri"
require "json"
require "net/http"

url = URI("https://app.topups.co.ke/api/get_product")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Authorization"] = "Bearer a12f4f9a99be83f1e631e379834864e7"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
    "channel_type": "Airtime",
    "country_symbol": "KE",
    "mobile": "254722000000"
})

response = https.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"channel_type\": \"Airtime\",\r\n    \"country_symbol\":\"KE\",\r\n    \"mobile\":\"254722000000\"\r\n}");
Request request = new Request.Builder()
    .url("https://app.topups.co.ke/api/get_product")
    .method("POST", body)
    .addHeader("Accept", "application/json")
    .addHeader("Authorization", "Bearer a12f4f9a99be83f1e631e379834864e7")
    .addHeader("Content-Type", "application/json")
    .build();
Response response = client.newCall(request).execute();
var client = new RestClient("https://app.topups.co.ke/api/get_product");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", "Bearer a12f4f9a99be83f1e631e379834864e7");
request.AddHeader("Content-Type", "application/json");
var body = @"{
    " + "\n" +
    @"    ""channel_type"": ""Airtime"",
    " + "\n" +
    @"    ""country_symbol"":""KE"",
    " + "\n" +
    @"    ""mobile"":""254722000000""
    " + "\n" +
@"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = require('request');
var options = {
    'method': 'POST',
    'url': 'https://app.topups.co.ke/api/get_product',
    'headers': {
        'Accept': 'application/json',
        'Authorization': 'Bearer a12f4f9a99be83f1e631e379834864e7',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        "channel_type": "Airtime",
        "country_symbol": "KE",
        "mobile": "254722000000"
    })
};
request(options, function (error, response) {
if (error) throw new Error(error);
    console.log(response.body);
});
package main

import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

url := "https://app.topups.co.ke/api/get_product"
method := "POST"

payload := strings.NewReader(`{`+"
"+`
    "channel_type": "Airtime",`+"
"+`
    "country_symbol":"KE",`+"
"+`
    "mobile":"254722000000"`+"
"+`
}`)

client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)

if err != nil {
    fmt.Println(err)
    return
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer a12f4f9a99be83f1e631e379834864e7")
req.Header.Add("Content-Type", "application/json")

res, err := client.Do(req)
if err != nil {
    fmt.Println(err)
    return
}
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
if err != nil {
    fmt.Println(err)
    return
}
fmt.Println(string(body))
}

Response


Parameter Example
status
type SUCCESS
String
Indication of whether the API call executed successfully or failed. Options are:
  • SUCCESS
  • FAIL
code 0000
Numeric
Identifier of the API call result status
message Product Found
String
Description of the API call result status
data
error []
Array of Strings
A list of errors found when the API call fails. Returns empty if none are found.
channel
type Airtime
String
Type of product channel. Options are:
  • Airtime
  • Agent Float
  • SMS
currency Kenyan Shilling
String
Currency of your product
currency_symbol 41126.00
Numeric
Balance of the specified channel

Success Example


{
    "status": {
        "type": "SUCCESS",
        "code": "0000",
        "message": "Product Found"
    },
    "data": {
        "errors": [],
        "channel": {
            "reference": "JFGDG124SD",
            "type": "Airtime",
            "code": "airtime",
            "product": {
                "reference": "356A192B79",
                "type": "Safaricom",
                "code": "safaricom",
                "country_reference": "V3UQQAUAZS",
                "country": "Kenya",
                "country_symbol": "KE",
                "country_prefix": "254",
                "mobile_country_code": "639",
                "mobile_network_code": "02",
                "mobile_country_network_code": "63902",
                "currency": "Kenyan Shilling",
                "currency_symbol": "KES",
                "minimum_amount": "5.0000",
                "maximum_amount": "10000.0000"
            }
        }
    }
}
<?xml version="1.0" encoding="utf-8"?>
<xml>
    <status>
        <type>SUCCESS</type>
        <code>0000</code>
        <message>Product Found</message>
    </status>
    <data>
        <errors/>
        <channel>
            <reference>JFGDG124SD</reference>
            <type>Airtime</type>
            <code>airtime</code>
            <product>
                <reference>356A192B79</reference>
                <type>Safaricom</type>
                <code>safaricom</code>
                <country_reference>V3UQQAUAZS</country_reference>
                <country>Kenya</country>
                <country_symbol>KE</country_symbol>
                <country_prefix>254</country_prefix>
                <mobile_country_code>639</mobile_country_code>
                <mobile_network_code>02</mobile_network_code>
                <mobile_country_network_code>63902</mobile_country_network_code>
                <currency>Kenyan Shilling</currency>
                <currency_symbol>KES</currency_symbol>
                <minimum_amount>5.0000</minimum_amount>
                <maximum_amount>10000.0000</maximum_amount>
            </product>
        </channel>
    </data>
</xml>

Status


Code
0000 SUCCESS
Product Found
1000 FAIL
Invalid API Request
2000 FAIL
Invalid Request Method
3000 FAIL
Missing or Invalid Parameters
4000 FAIL
Invalid API Token
5000 FAIL
Request Not Allowed
6000 FAIL
Invalid Account
7000 FAIL
Channel Not Found
8000 FAIL
Product Not Supported
9000 FAIL
Product Not Found

Fail Example


{
    "status": {
        "type": "FAIL",
        "code": "8000",
        "message": "Product Not Supported"
    },
    "data": {
        "errors": []
    }
}
<?xml version="1.0" encoding="utf-8"?>
<xml>
    <status>
        <type>FAIL</type>
        <code>8000</code>
        <message>Product Not Supported</message>
    </status>
    <data>
        <errors/>
    </data>
</xml>