Sender Ids

Account Balance

This API fetches the wallet balance of your account. Send a GET request to the following endpoint.

                                            
                                                EndPoint: https://api.braceafrica.com/v1/billing/balance

API sample code

                                                        
                                                            import requests
                                                            import json

                                                            # authentication
                                                            x_username        = "";
                                                            x_apikey          = "";

                                                            # endoint
                                                            fetchBalanceURL   = "https://api.braceafrica.com/v1/billing/balance"

                                                            headers = {
                                                                'Content-type': 'application/json',
                                                                'Accept': 'application/json',
                                                                'x-api-user': x_username,
                                                                'x-api-key' : x_apikey
                                                            }

                                                            req = requests.get(fetchBalanceURL, headers=headers)

                                                            # response
                                                            print(req.text)
                                                        
                                                    
                                                        
                                                            // authentication
                                                            $x_username           = "";
                                                            $x_apikey             = "";

                                                            // endoint
                                                            $fetchBalanceURL     = "https://api.braceafrica.com/v1/billing/balance";

                                                            $req                  = curl_init($fetchBalanceURL);

                                                            curl_setopt($req, CURLOPT_CUSTOMREQUEST, "GET");
                                                            curl_setopt($req, CURLOPT_TIMEOUT, 60);
                                                            curl_setopt($req, CURLOPT_SSL_VERIFYPEER, false);
                                                            curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
                                                            curl_setopt($req, CURLOPT_HTTPHEADER, array(
                                                                'Content-Type: application/json',
                                                                'x-api-user: '.$x_username,
                                                                'x-api-key: '.$x_apikey
                                                            ));

                                                            // read api response
                                                            $res              = curl_exec($req);

                                                            // close curl
                                                            curl_close($req);

                                                            // print the raw json response
                                                            var_dump($res);
                                                        
                                                    
                                                        
                                                            var request             = require('request');

                                                            // authentication
                                                            var x_username          = ""
                                                            var x_apikey            = ""

                                                            // endpoint
                                                            var fetchBalanceURL = "https://api.braceafrica.com/v1/billing/balance"

                                                            var headers = {
                                                                'Content-Type' :  'application/json',
                                                                'Accept' : 'application/json',
                                                                'x-api-user' : x_username,
                                                                'x-api-key' : x_apikey
                                                            }

                                                            var options = {
                                                                url: fetchBalanceURL,
                                                                method: 'GET',
                                                                headers: headers
                                                            }

                                                            // the request and response
                                                            request(options, function (error, response, body) {
                                                                if (!error && response.statusCode == 200) {
                                                                    // Print out the response body
                                                                    console.log(body)
                                                                }
                                                                else{
                                                                    console.log(error)
                                                                }
                                                            })
                                                        
                                                    
                                                        
                                                            package main

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

                                                            func main() {
                                                                // endpoint
                                                                var fetchBalanceURL string = "https://api.braceafrica.com/v1/billing/balance"

                                                                // authentication
                                                                var x_username string = ""
                                                                var x_apikey string = ""

                                                                // request
                                                                request, err := http.NewRequest("GET", fetchBalanceURL, nil)

                                                                if err != nil {
                                                                    panic(err.Error())
                                                                }

                                                                // headers
                                                                request.Header.Set("Content-Type", "application/json")
                                                                request.Header.Set("x-api-user", x_username)
                                                                request.Header.Set("x-api-key", x_apikey)

                                                                // response
                                                                response, err := http.DefaultClient.Do(request)

                                                                if err != nil {
                                                                    panic(err.Error())
                                                                }

                                                                body, err := ioutil.ReadAll(response.Body)

                                                                if err != nil {
                                                                    panic(err.Error())
                                                                }

                                                                defer response.Body.Close()
                                                                fmt.Println(string(body))
                                                            }

                                                        
                                                    

When the request is successful, you should expect the following response.

                                            
                                                {
                                                    "status": 200,
                                                    "data": {
                                                        "amount": 6080.11,
                                                        "currency": "KES"
                                                    }
                                                }
                                            
                                        

Account Statement

Fetch all the account top ups by sending a GET request to the following endpoint.

                                            
                                                EndPoint: https://api.braceafrica.com/v1/billing/topups

Send a GET request to the endpoint

API sample code

                                                        
                                                            import requests
                                                            import json

                                                            # authentication
                                                            x_username        = "";
                                                            x_apikey          = "";

                                                            # endoint
                                                            fetchStatementURL   = "https://api.braceafrica.com/v1/billing/topups"

                                                            headers = {
                                                                'Content-type': 'application/json',
                                                                'Accept': 'application/json',
                                                                'x-api-user': x_username,
                                                                'x-api-key' : x_apikey
                                                            }

                                                            req = requests.get(fetchStatementURL, headers=headers)

                                                            # response
                                                            print(req.text)
                                                        
                                                    
                                                        
                                                            // authentication
                                                            $x_username           = "";
                                                            $x_apikey             = "";

                                                            // endoint
                                                            $fetchStatementURL     = "https://api.braceafrica.com/v1/billing/topups";

                                                            $req                  = curl_init($fetchStatementURL);

                                                            curl_setopt($req, CURLOPT_CUSTOMREQUEST, "GET");
                                                            curl_setopt($req, CURLOPT_TIMEOUT, 60);
                                                            curl_setopt($req, CURLOPT_SSL_VERIFYPEER, false);
                                                            curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
                                                            curl_setopt($req, CURLOPT_HTTPHEADER, array(
                                                                'Content-Type: application/json',
                                                                'x-api-user: '.$x_username,
                                                                'x-api-key: '.$x_apikey
                                                            ));

                                                            // read api response
                                                            $res              = curl_exec($req);

                                                            // close curl
                                                            curl_close($req);

                                                            // print the raw json response
                                                            var_dump($res);
                                                        
                                                    
                                                        
                                                            var request             = require('request');

                                                            // authentication
                                                            var x_username          = ""
                                                            var x_apikey            = ""

                                                            // endpoint
                                                            var fetchStatementURL = "https://api.braceafrica.com/v1/billing/topups"

                                                            var headers = {
                                                                'Content-Type' :  'application/json',
                                                                'Accept' : 'application/json',
                                                                'x-api-user' : x_username,
                                                                'x-api-key' : x_apikey
                                                            }

                                                            var options = {
                                                                url: fetchStatementURL,
                                                                method: 'GET',
                                                                headers: headers
                                                            }

                                                            // the request and response
                                                            request(options, function (error, response, body) {
                                                                if (!error && response.statusCode == 200) {
                                                                    // Print out the response body
                                                                    console.log(body)
                                                                }
                                                                else{
                                                                    console.log(error)
                                                                }
                                                            })
                                                        
                                                    
                                                        
                                                            package main

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

                                                            func main() {
                                                                // endpoint
                                                                var fetchStatementURL string = "https://api.braceafrica.com/v1/billing/topups"

                                                                // authentication
                                                                var x_username string = ""
                                                                var x_apikey string = ""

                                                                // request
                                                                request, err := http.NewRequest("GET", fetchStatementURL, nil)

                                                                if err != nil {
                                                                    panic(err.Error())
                                                                }

                                                                // headers
                                                                request.Header.Set("Content-Type", "application/json")
                                                                request.Header.Set("x-api-user", x_username)
                                                                request.Header.Set("x-api-key", x_apikey)

                                                                // response

                                                                response, err := http.DefaultClient.Do(request)

                                                                if err != nil {
                                                                    panic(err.Error())
                                                                }

                                                                body, err := ioutil.ReadAll(response.Body)

                                                                if err != nil {
                                                                    panic(err.Error())
                                                                }
                                                                defer response.Body.Close()

                                                                fmt.Println(string(body))
                                                            }

                                                        
                                                    

When the request is successful, you should expect the following response.

                                            
                                                {
                                                    "status": 200,
                                                    "data": [
                                                        {
                                                            "id": 4155,
                                                            "amount": "KES 500",
                                                            "description": "Mpesa Code ML689276",
                                                            "type": "MPESA",
                                                            "date_created": "2019-12-22T14:38:44.000Z",
                                                            "currency": "KES"
                                                        }
                                                        {
                                                            "id": 4338,
                                                            "amount": "KES 1100",
                                                            "description": "Mpesa Code MJUYEO67M",
                                                            "type": "MPESA",
                                                            "date_created": "2019-12-22T14:38:44.000Z",
                                                            "currency": "KES"
                                                        }
                                                        {
                                                            "id": 4598,
                                                            "amount": "KES 8000",
                                                            "description": "Admin Top Up",
                                                            "type": "Admin",
                                                            "date_created": "2019-12-22T14:38:44.000Z",
                                                            "currency": "KES"
                                                        }
                                                    ]
                                                }