API reference/Energy & Utilities/Spain Fuel Prices by Station

Spain Fuel Prices by Station

Official pump prices at every service station in a Spanish province or municipality, from the Ministry for the Ecological Transition: price of the chosen fuel, all fuels sold, brand, address, coordinates and opening hours, cheapest first, with min, median, average and max. Optional nearby search and past dates.

GET/api/v1/energy/es/fuel-prices

Data source

Query parameters

ParameterDescriptionTry value
province
string
Province code, e.g. 28 for Madrid (or use municipality; codes from /energy/es/fuel-areas)
municipality
string
Municipality code, e.g. 4354 for Madrid city
fuel
string
gasoline-95 (default diesel), gasoline-98, gasoline-95-e10, diesel, diesel-premium, diesel-b, renewable-diesel, biodiesel, lpg, cng, lng, hydrogen, adblue…
lat
number
Latitude (with lon) to keep stations within radiusKm
lon
number
Longitude (with lat)
radiusKm
number
Radius for lat/lon in km (default 10, max 100)
sort
string
price (default) or distance (needs lat/lon)
date
date
Past date YYYY-MM-DD (prices in force at 00:00); default live
limit
number
Rows (default 50, max 500)
apikey
string required
Your API key. Can also be sent as the X-API-Key header.demo key used here

Response envelope

Success: { data, meta: { sources, fetchedAt, cached } }. Errors: { error: { code, message } } with HTTP 400, 401, 404, 502, 503 or 504.