Balance API

The Balance API provides a count of request credits left in the user's account for the day. Balance is reset at midnight UTC everyday (00:00 UTC).

🚧

Due to the distributed nature of our API stack that spans multiple continents and datacenters, the values returned by this endpoint will be a few seconds old.

Request

Request Format

Requests can be sent to any of the following endpoints. To prevent abuse, this endpoint is rate limited at 1 request per second.

Region 1: US

https://us1.locationiq.com/v1/balance?key=YOUR_ACCESS_TOKEN&format=json

Region 2: Europe

https://eu1.locationiq.com/v1/balance?key=YOUR_ACCESS_TOKEN&format=json

Request Parameters

python
import requests

url = "https://us1.locationiq.com/v1/balance"

data = {
    'key': 'YOUR_ACCESS_TOKEN'
}

response = requests.get(url, params=data)

print(response.text)
<?php

$curl = curl_init('https://us1.locationiq.com/v1/balance?key=YOUR_ACCESS_TOKEN&format=json');

curl_setopt_array($curl, array(
  CURLOPT_RETURNTRANSFER    =>  true,
  CURLOPT_FOLLOWLOCATION    =>  true,
  CURLOPT_MAXREDIRS         =>  10,
  CURLOPT_TIMEOUT           =>  30,
  CURLOPT_CUSTOMREQUEST     =>  'GET',
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo 'cURL Error #:' . $err;
} else {
  echo $response;
}
curl --request GET \
  --url 'https://us1.locationiq.com/v1/balance?key=YOUR_ACCESS_TOKEN&format=json'
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://us1.locationiq.com/v1/balance?key=YOUR_ACCESS_TOKEN&format=json",
  "method": "GET"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

Request Parameters

NameDescriptionRequired
keyAuthentication keyYes

Response

Response Example

{
    "status": "ok",
    "balance": {
        "day": 30000,
        "bonus" : 0
    }
}

Response Parameters

NameDescription
statusok on success.
balanceAn array comprising individual components such as day and bonus. See Balance Object below for details.

Balance Object

NameDescription
dayBalance of requests credits in your account for the day
bonusBalance of bonus / promotional request credits in your account