Oil price API: pump prices
Pump pricesA country's pump prices: today's for each fuel, or one fuel over a range.
PlansEvery plan
Cost1 call per request
ReturnsUp to 5,000 points
UpdatedAs each source publishes
What it is for
A country's pump prices. With only country, today's price for every fuel; add fuel for that fuel's history, oldest first.
Where a country publishes more than one series for a fuel (daily station averages and a weekly official average, say), interval picks one. Prices are in the country's own currency per litre unless you convert them with currency.
Good for
- Today's prices on a country page
- A fuel's price history for a chart
- Comparing countries in one currency
- Prices in today's money with
real=latest
price_nowParameters 8 in the query
| Name | Where and type | Required | What it does | Example |
|---|---|---|---|---|
country | query country | required | Two letter country code, such as fr, gb or ke. | mx |
fuel | query string | optional | One fuel, such as diesel or gasoline_95; leave out for every fuel now. | diesel |
from | query date | optional | First date, YYYY-MM-DD. | 2024-01-01 |
to | query date | optional | Last date, YYYY-MM-DD. | 2024-12-31 |
interval | query one of | optional | Which published series to read when a country has more than one. One of day, week, month. | |
currency | query ISO 4217 | optional | Convert every price to this currency on its own day, such as usd. | usd |
real | query string | optional | Restate every price in the money of one month with the country's consumer price index: latest, or a month as YYYY-MM such as 2020-01. | latest |
limit | query integer | default 100 | Most recent points when no from is given. Up to 5,000. | 30 |
Try it runs against the live API with your key
No key yet? Get a free one; it is saved in this browser for every page.
The answer 200, application/json
| Field | Type | What it holds | Example |
|---|---|---|---|
country | string | Two letter country code | "MX" |
fuel | string | Fuel code; see Fuels and units | |
interval | string | day, week, month or year | |
unit | string | litre, gallon or barrel | |
currency | string | Three letter currency code | |
values | array | The points, oldest first |
Example answer real, from what we hold now; long lists cut to three
GET /v1/prices/retail?country=mx{ "data": { "country": "MX", "fuels": [ { "fuel": "diesel", "kind": "average", "interval": "day", "date": "2026-10-29", "price": 26.9903, "unit": "litre", "currency": "MXN" }, { "fuel": "gasoline_premium", "kind": "average", "interval": "day", "date": "2026-10-29", "price": 28.5914, "unit": "litre", "currency": "MXN" }, { "fuel": "gasoline_regular", "kind": "average", "interval": "day", "date": "2026-10-29", "price": 23.6972, "unit": "litre", "currency": "MXN" } ] }, "meta": { "count": 3 } }
Errors every error has the same shape
| HTTP | Code | When | What to do |
|---|---|---|---|
| 401 | unauthorized | No key, or not a valid one | Send your key in the X-API-Key header; your account page shows it. |
| 400 | bad_request | A value is wrong or a required one is missing | The message names the parameter and the form it takes. |
| 422 | unknown_parameter | A parameter this endpoint does not take | Take it out; the parameters this endpoint takes are listed above. |
| 429 | rate_limited | Too many calls this minute | Wait the seconds in the Retry-After header, then call again. |
| 429 | quota_exceeded | Today's calls are used up | Wait for the day to reset at midnight UTC, or move to a larger plan. |
Dates and times are UTC. A point's date is the day its price took effect, or the first day of its week or month for weekly and monthly series. Conversions use each day's own rate, so a converted series moves with both the price and the exchange rate.
Related
Government set pricesPrices a government has fixed, as each level took effect.GET /v1/prices/setTrack a country's pricesToday's pump prices for a country, then one fuel's history to chart.RecipeCompare countries in dollarsPut any countries side by side in US dollars a litre, each at its own day's rate.Recipe