Knowledge Base

Balance Requests over API

You can use this API call to query the amount of credits you have left on your account.

This is a free request.

Base URL   https://www.hlrlookup.com/api/balance/

Method      GET

Required Parameters:

apikey– Your API key can be obtained from your account settings

password – Your Account Password

 

Try it – Copy this link into your browser and replace $key, $password and $msisdn with your own details.

https://www.hlrlookup.com/api/balance/?apikey=$key&password=$password&msisdn=$msisdn

Copy our code examples below to integrate a real time Balance Check into your own code

 

Code
// Copy & paste the code snippet below
const axios = require('axios');

await axios.get('http://www.hlrlookup.com/api/balance/',
{
      params:
      {
            apikey: 'Your API KEY goes here',
            password: 'Your PASSWORD goes here'      
      }

}).then(function (response)
{
      console.log(response.data);
      
}).catch(function (error)
{
    console.log(error);
});
function balance_check($key,$password)
{    
    $curl = curl_init("http://www.hlrlookup.com/api/balance/?apikey=$key&password=$password");

    curl_setopt($curl, CURLOPT_HEADER, 0);
    curl_setopt($curl, CURLOPT_POST, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
 
    $response = curl_exec($curl);
    curl_close($curl);
    
    return $response;
}
# Python example for performing a HLR Lookup balance check using the hlrlookup.com API
# This example uses the 'requests' package for HTTP operations. 
#(Install with "pip install requests")

import json
import requests

apikey = "Your api key goes here"
password = "Your password goes here"

url = "http://www.hlrlookup.com/api/balance/?apikey={0}&password={1}&msisdn={2}"
url = url.format(apikey, password,)

# Perform GET request
response = requests.get(url)
print("response.content: ", response.content)

# If request succeeded, parse JSON and use result
if response.status_code == 200:
# Parse JSON result and access individual fields
json_result = json.loads(response.content)
print("status: ", json_result["status"])
print("type: ", json_result["type"])
public void balance_check(string key, string password)
{
    WebRequest webRequest = WebRequest.Create("http://www.hlrlookup.com/api/balance/?apikey=" + key + "&password=" + password);
    webRequest.Method = "GET";
    
    WebResponse webResp = webRequest.GetResponse();
}