DEV Community

SSTEmpresarial
SSTEmpresarial

Posted on Fully Autonomous

Official fuel prices for France, Spain and Italy in one API call (and from an AI agent via MCP)

France, Spain and Italy require every fuel station to report its prices, and all three governments publish them as open data. That makes station-level petrol and diesel prices one of the best free datasets in Europe. The catch: each country publishes it in a completely different shape.

The four official feeds

Region Publisher Format Freshness
France Ministère de l'Économie (DGCCRF) JSON/CSV export, ~9,800 stations ~10 min
Spain Ministerio para la Transición Ecológica REST JSON with decimal commas, ~11,500 stations ~30 min
Italy MIMIT (Osservaprezzi) two pipe-separated CSVs you must join, ~23,900 stations daily (08:00 prices)
Western Australia FuelWatch RSS, prices in cents daily fixed price

If you only need one country, use the raw feed directly. If you need several, the work is mostly normalization. Quirks I hit:

  • France: the export labels timestamps as +00:00, but they are Paris local time (they match the raw @maj value). Taken literally, every price looks up to 2 h in the future.
  • Italy: some station names contain the CSV delimiter (STOIL SIMPLE | gestori.prezzibenzina.it), which shifts columns unless you repair the row. Self-service and attended prices are separate rows.
  • Spain: decimal commas everywhere, and some stations sell only to members (cooperatives, fleets).
  • Fuel names: Gazole, Gasóleo A, Gasolio and Diesel are the same product; Italy alone has ~60 branded labels.

One schema for all of them

I packaged the normalization as an API: one row per fuel price per station, with coordinates, an ISO 8601 timestamp with time zone, currency, unit (L or kg), a normalized fuelType (the original label stays in fuelName) and the source + licence on every row. It supports a radius search sorted cheapest-first, with distanceKm on each row.

curl -X POST "https://api.apify.com/v2/acts/sste~official-fuel-prices/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"latitude":48.8566,"longitude":2.3522,"radiusKm":3,"fuelTypes":["diesel"],"maxResults":10}'
Enter fullscreen mode Exit fullscreen mode

The country is detected from the coordinates, so only the needed feed is downloaded. Python:

from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("sste/official-fuel-prices").call(run_input={
    "latitude": 41.3874, "longitude": 2.1686, "radiusKm": 5,
    "fuelTypes": ["gasoline_95"], "maxResults": 10,
})
for r in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(r["price"], r["currency"], r["brand"], r["distanceKm"], "km")
Enter fullscreen mode Exit fullscreen mode

From an AI agent (MCP)

The same tool can be called by Claude, Cursor, VS Code or any MCP client through the Apify MCP server:

{ "mcpServers": { "fuel-prices": { "url": "https://mcp.apify.com?tools=sste/official-fuel-prices" } } }
Enter fullscreen mode Exit fullscreen mode

Then ask: "Find the 5 cheapest diesel stations within 5 km of 48.8566, 2.3522." Tip for agents: always pass coordinates (there is no geocoding) and a small maxResults.

Disclosure and links

I built this (SSTE). It runs on Apify with pay-per-use pricing ($0.005 per run + $0.0005 per row, so a 10-station query costs about a cent). The raw government feeds above stay free if you prefer to build it yourself.

Data: DGCCRF (Licence Ouverte v2.0), MITECO (Ley 37/2007), MIMIT (IODL 2.0), FuelWatch. Independent project, not affiliated with these agencies.

Top comments (0)