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.
The Balance API requires an account token (prefix sk.) with the balance:read scope. Create an account token with the Read Balance permission on your User Dashboard. API tokens (pk.) and legacy parent keys cannot call this endpoint. See Access Token Types.
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=jsonRegion 2: Europe
https://eu1.locationiq.com/v1/balance?key=YOUR_ACCESS_TOKEN&format=jsonRequest 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)Request Parameters
| Name | Description | Required |
|---|---|---|
| key | Authentication key | Yes |
Response
Response Example
{
"status": "ok",
"balance": {
"day": 30000,
"bonus" : 0
}
}Response Parameters
| Name | Description |
|---|---|
| status | ok on success. |
| balance | An array comprising individual components such as day and bonus. See Balance Object below for details. |
Balance Object
| Name | Description |
|---|---|
| day | Balance of requests credits in your account for the day |
| bonus | Balance of bonus / promotional request credits in your account |