Fuel Prices
Get current fuel prices for a specific African country or all countries at once.
GET
https://afrotools.com/api/fuel
Authentication required. Pass your API key via
x-api-key header. Learn more
Request Parameters
| Parameter | Type | Description |
|---|---|---|
| country optional | string | ISO 3166-1 alpha-2 country code. Omit to get all countries. |
| fuel_type optional | string | Filter by fuel type: petrol, diesel, kerosene, or lpg. |
| currency optional | string | Convert prices to a different currency (e.g., USD). Default: local currency. |
| date optional | string | Historical date (YYYY-MM-DD). Pro plan required. |
Response Fields
| Field | Type | Description |
|---|---|---|
| country | string | ISO country code. |
| country_name | string | Full country name. |
| currency | string | Currency of the prices. |
| fuels | object | Object with fuel type keys. |
| fuels.*.price | number | Current price per unit. |
| fuels.*.unit | string | Unit of measurement (litre or kg). |
| fuels.*.change | number | Change since last update. |
| updated | string | Date of last price update. |
Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | invalid_country | Country code not supported. |
| 400 | invalid_fuel_type | Fuel type is not recognized. |
| 401 | missing_api_key | No API key was provided. |
| 429 | rate_limit_exceeded | Rate limit exceeded. |
Request Examples
curl "https://afrotools.com/api/fuel?country=NG" \
-H "x-api-key: afro_live_your_key_here"
const res = await fetch(
"https://afrotools.com/api/fuel?country=NG",
{ headers: { "x-api-key": "afro_live_your_key_here" } }
);
const data = await res.json();
console.log(`Petrol: ${data.data.fuels.petrol.price} NGN/litre`);
import requests
resp = requests.get(
"https://afrotools.com/api/fuel",
params={"country": "NG"},
headers={"x-api-key": "afro_live_your_key_here"}
)
data = resp.json()
print(f"Petrol: {data['data']['fuels']['petrol']['price']} NGN/litre")
const axios = require("axios");
const { data } = await axios.get(
"https://afrotools.com/api/fuel",
{
params: { country: "NG" },
headers: { "x-api-key": "afro_live_your_key_here" }
}
);
console.log(`Petrol: ${data.data.fuels.petrol.price} NGN/litre`);
$ch = curl_init("https://afrotools.com/api/fuel?country=NG");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"x-api-key: afro_live_your_key_here"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
echo "Petrol: " . $data["data"]["fuels"]["petrol"]["price"] . " NGN/litre";
Response (200 OK)
{
"success": true,
"data": {
"country": "NG",
"country_name": "Nigeria",
"currency": "NGN",
"fuels": {
"petrol": {
"price": 897.00,
"unit": "litre",
"change": 0
},
"diesel": {
"price": 1420.00,
"unit": "litre",
"change": -30.00
},
"kerosene": {
"price": 1250.00,
"unit": "litre",
"change": 0
},
"lpg": {
"price": 1150.00,
"unit": "kg",
"change": 50.00
}
},
"updated": "2026-03-10"
}
}
All Countries (no country param)
# Get fuel prices for all countries
curl "https://afrotools.com/api/fuel" \
-H "x-api-key: afro_test_abc123"
{
"success": true,
"data": {
"countries": [
{ "country": "NG", "currency": "NGN", "petrol": 897.00, ... },
{ "country": "KE", "currency": "KES", "petrol": 217.36, ... },
{ "country": "ZA", "currency": "ZAR", "petrol": 25.83, ... }
],
"count": 54
}
}