# France Fuel Prices by Commune: Gaps, Cheapest Station (`phonic_lily/france-fuel-prices-by-commune`) Actor

Fuel prices for every French commune (34,969) and fuel (diesel, SP95, SP98, E10, E85, LPG): mean, min, median, gap to the department and France, cheapest station in the commune and within 10 km, with population and median income. Embedded data, pay per record.

- **URL**: https://apify.com/phonic_lily/france-fuel-prices-by-commune.md
- **Developed by:** [Henri bousquet](https://apify.com/phonic_lily) (community)
- **Categories:** Business, Travel
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$4.00 / 1,000 commune fuel record returneds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### What this Actor does

Fuel prices for every French commune (34,969) and fuel (diesel, SP95, SP98, E10, E85, LPG): mean, min, median, gap to the department and France, cheapest station in the commune and within 10 km, with population and median income. Embedded data, pay per record.

**No scraping, no live dependency, no login**: the data is embedded in the Actor and searched locally. You pay per record returned (pay-per-event `commune-fuel-result`), never for empty runs.

### What you get

- 209,814 records, snapshot 2026-11-14T04:17Z (download time; source dataset last modified 2026-11-13T07:06Z; most recent price update 2026-11-13).
- Source licence: Licence Ouverte (Etalab): prices from data.gouv.fr id fr-lo, communes under Licence Ouverte 2.0.
- 26 input filters, all optional and combinable; results export as JSON, CSV, Excel, XML or HTML from the console or the API.

### Quick start

Press **Try for free** with the pre-filled input, or paste it into the Input tab:

```json
{
  "departments": [
    "31"
  ],
  "fuels": [
    "diesel"
  ],
  "maxResults": 10
}
```

That run returns up to 10 records and costs about $0.04 (10 x $0.004). A run of 1,000 records costs $4.00. `maxResults` (up to 10,000) caps both the output and the bill.

### Example output

One real record from the data, columns as returned:

```json
{
  "record_id": "01004-diesel",
  "insee_code": "01004",
  "commune_name": "Ambérieu-en-Bugey",
  "department": "01",
  "fuel": "diesel",
  "fuel_label": "Diesel (Gazole)",
  "population": 15934,
  "median_income_eur": 21660.0,
  "lat": 45.9575,
  "lon": 5.3706,
  "station_count": 4,
  "stations_with_price": 4,
  "price_mean_eur": 2.1895,
  "price_min_eur": 2.054
}
```

### Input

Every filter is optional; combine them freely.

- `query` (string): Commune name (accent- and case-insensitive substring).
- `inseeCode` (string): INSEE commune code (full or prefix) (accent- and case-insensitive substring).
- `departments` (array): Department codes (e.g. 75, 2A). Records with an empty value never match.
- `fuels` (array): Fuels (diesel, sp95, sp98, e10, e85, lpg). Records with an empty value never match.
- `minMeanPriceEur` (number): Min commune mean price (EUR/l). Records with an empty value never match.
- `maxMeanPriceEur` (number): Max commune mean price (EUR/l). Records with an empty value never match.
- `minGapVsDepartmentPct` (number): Min gap to department mean (%). Records with an empty value never match.
- `maxGapVsDepartmentPct` (number): Max gap to department mean (%). Records with an empty value never match.
- `minGapVsFrancePct` (number): Min gap to France mean (%). Records with an empty value never match.
- `maxGapVsFrancePct` (number): Max gap to France mean (%). Records with an empty value never match.
- `minNearbyCheapestPriceEur` (number): Min cheapest price within 10 km (EUR/l). Records with an empty value never match.
- `maxNearbyCheapestPriceEur` (number): Max cheapest price within 10 km (EUR/l). Records with an empty value never match.
- `minStations` (number): Min stations in the commune. Records with an empty value never match.
- `maxStations` (number): Max stations in the commune. Records with an empty value never match.
- `minPopulation` (number): Min population. Records with an empty value never match.
- `maxPopulation` (number): Max population. Records with an empty value never match.
- `minMedianIncomeEur` (number): Min median income (EUR). Records with an empty value never match.
- `maxMedianIncomeEur` (number): Max median income (EUR). Records with an empty value never match.
- `nearLatitude` (number): Center latitude. Latitude of the search center (-90..90). Use with nearLongitude and radiusKm.
- `nearLongitude` (number): Center longitude. Longitude of the search center (-180..180).
- `radiusKm` (number): Radius (km). Search radius in km (max 20000). Results get a distance_km field and are sorted by distance.
- `minLatitude` (number): Min latitude. South edge of a bounding box; give all four box values together.
- `maxLatitude` (number): Max latitude. North edge of the bounding box.
- `minLongitude` (number): Min longitude. West edge; if greater than max longitude the box crosses the antimeridian.
- `maxLongitude` (number): Max longitude. East edge of the bounding box.
- `sortBy` (string): Sort by. Sort order of results. Default: file order (or distance when a radius is given).
- `maxResults` (integer): Max results. Maximum records returned and billed (1..10000).

### Output fields

- `record_id` : Unique key: INSEE code and fuel, e.g. 31555-diesel.
- `insee_code` : INSEE commune code (Paris, Lyon and Marseille are single communes: arrondissement stations are counted in them).
- `commune_name` : Commune name.
- `department` : Department code.
- `fuel` : Fuel of this record: diesel, sp95, sp98, e10, e85 or lpg.
- `fuel_label` : Fuel name as sold (Diesel (Gazole), SP95, SP98, SP95-E10, E85, LPG).
- `population` : Commune population, null if unknown.
- `median_income_eur` : Median income per consumption unit (EUR, INSEE Filosofi 2023), null if unknown or secret.
- `lat` : Commune centre latitude.
- `lon` : Commune centre longitude.
- `station_count` : Stations listed in the feed in this commune (any fuel). 0 means no station in the feed.
- `stations_with_price` : Stations of the commune with a price for this fuel.
- `price_mean_eur` : Mean price of this fuel across the commune's stations (EUR/l), null if no station reports it.
- `price_min_eur` : Lowest price of this fuel in the commune (EUR/l), null if none.
- `price_median_eur` : Median price of this fuel in the commune (EUR/l), null if none.
- `price_max_eur` : Highest price of this fuel in the commune (EUR/l), null if none.
- `price_latest_update` : Most recent price update timestamp among the commune's stations for this fuel (ISO 8601), null if none.
- `department_mean_eur` : Mean price of this fuel over all priced stations of the department (EUR/l), null if none.
- `france_mean_eur` : Mean price of this fuel over all priced stations in the feed (EUR/l).
- `gap_vs_department_eur` : price_mean_eur minus department_mean_eur (EUR/l); null when the commune has no price.
- `gap_vs_department_pct` : Same gap in percent of the department mean; null when the commune has no price.
- `gap_vs_france_eur` : price_mean_eur minus france_mean_eur (EUR/l); null when the commune has no price.
- `gap_vs_france_pct` : Same gap in percent of the France mean; null when the commune has no price.
- `cheapest_station_id` : Station id of the cheapest station of the commune for this fuel, null if none.
- `cheapest_station_address` : Address of that station.
- `cheapest_station_price_eur` : Price at that station (EUR/l).
- `nearby_radius_km` : Fixed radius of the neighbourhood, from the commune centre to station coordinates (10 km, straight line).
- `nearby_stations_with_price` : Stations with a geolocated price for this fuel within the radius (commune stations included); null if the commune has no coordinates.
- `nearby_cheapest_station_id` : Station id of the cheapest station within the radius, null if none.
- `nearby_cheapest_station_address` : Address of that station.
- `nearby_cheapest_station_city` : City of that station (may be another commune).
- `nearby_cheapest_station_price_eur` : Price at that station (EUR/l).
- `nearby_cheapest_station_distance_km` : Distance from the commune centre to that station (km).

Every record also carries `license` and `attribution` so you can republish with the required credit. Empty values are returned as `null` (never as 0).

### Call it from code

```python
from apify_client import ApifyClient
client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("phonic_lily/france-fuel-prices-by-commune").call(run_input={"departments": ["31"], "fuels": ["diesel"], "maxResults": 10})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

```bash
curl -X POST "https://api.apify.com/v2/acts/phonic_lily~france-fuel-prices-by-commune/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>" \
  -H "Content-Type: application/json" -d '{"departments": ["31"], "fuels": ["diesel"], "maxResults": 10}'
```

### Pricing

Pay per event: $0.004 per record returned, no start fee, nothing billed for an empty run.

| Records returned | Cost |
|---|---|
| 10 | $0.04 |
| 100 | $0.40 |
| 1,000 | $4.00 |
| 10,000 | $40.00 |

### Use it from an AI agent (MCP)

Add this Actor as a tool to Claude, Cursor or any MCP client through the Apify MCP server:

```
https://mcp.apify.com?tools=phonic_lily/france-fuel-prices-by-commune
```

The agent gets the input schema above and pays per record like any other run.

### FAQ

**Where does the data come from?** Two open datasets joined on the INSEE commune code. (1) Fuel stations and prices: CSV export of the dataset prix-carburants-quotidien (https://data.economie.gouv.fr/explore/dataset/prix-carburants-quotidien/), republished at https://www.data.gouv.fr/fr/datasets/prix-des-carburants-en-france-flux-quotidien-1/ under the Licence Ouverte (Etalab) (licence id fr-lo on data.gouv.fr, version not stated there; reuse with attribution is allowed). The feed holds the previous day's data (J-1) and prices are those reported to the ministry: they may differ from the pump. 9,952 stations; the test record (postal code 99999) is excluded; prices are used as reported, without outlier cleaning; 11 stations whose commune code is not in the commune list are counted in the department and France means but not in any commune. (2) Communes: the France Communes dataset (geo.api.gouv.fr and INSEE Filosofi 2023, Licence Ouverte 2.0), 34,969 communes. Calculation added: per commune and fuel, mean, min, median and max over the commune's stations that report a price; department and France means are means over priced stations (each price counts once), the gap is the commune mean minus that mean, in EUR/l and percent; the cheapest station of the commune; the cheapest station within 10 km, measured as a straight line from the commune centre point (not the town hall) to the station coordinates. Paris, Lyon and Marseille are single communes (arrondissement stations are counted in them). 5,452 communes have at least one price, 29,517 have none; where there is no station or no price the values are null, never 0, and gaps are computed on present prices only. Counts (station_count 0) are real counts of stations in the feed. The commune centre of a large commune may be far from its stations, which is why the 10 km neighbourhood is given next to the commune values. One row per commune and fuel (209,814 rows) so that the fuel, price and gap filters apply to a single number.

**How fresh is it?** Snapshot 2026-11-14T04:17Z (download time; source dataset last modified 2026-11-13T07:06Z; most recent price update 2026-11-13). The data is embedded in the Actor and updated when the publisher rebuilds it, so a run never depends on a live source and never fails because a site is down.

**What does a run cost?** $0.004 per returned record, nothing for runs that return no record. Apify free plan credit ($5) covers about 1,250 records.

**Do I need a proxy, an account on the source or a browser?** No: the Actor reads its own embedded file.

### Data and licence

Two open datasets joined on the INSEE commune code. (1) Fuel stations and prices: CSV export of the dataset prix-carburants-quotidien (https://data.economie.gouv.fr/explore/dataset/prix-carburants-quotidien/), republished at https://www.data.gouv.fr/fr/datasets/prix-des-carburants-en-france-flux-quotidien-1/ under the Licence Ouverte (Etalab) (licence id fr-lo on data.gouv.fr, version not stated there; reuse with attribution is allowed). The feed holds the previous day's data (J-1) and prices are those reported to the ministry: they may differ from the pump. 9,952 stations; the test record (postal code 99999) is excluded; prices are used as reported, without outlier cleaning; 11 stations whose commune code is not in the commune list are counted in the department and France means but not in any commune. (2) Communes: the France Communes dataset (geo.api.gouv.fr and INSEE Filosofi 2023, Licence Ouverte 2.0), 34,969 communes. Calculation added: per commune and fuel, mean, min, median and max over the commune's stations that report a price; department and France means are means over priced stations (each price counts once), the gap is the commune mean minus that mean, in EUR/l and percent; the cheapest station of the commune; the cheapest station within 10 km, measured as a straight line from the commune centre point (not the town hall) to the station coordinates. Paris, Lyon and Marseille are single communes (arrondissement stations are counted in them). 5,452 communes have at least one price, 29,517 have none; where there is no station or no price the values are null, never 0, and gaps are computed on present prices only. Counts (station_count 0) are real counts of stations in the feed. The commune centre of a large commune may be far from its stations, which is why the 10 km neighbourhood is given next to the commune values. One row per commune and fuel (209,814 rows) so that the fuel, price and gap filters apply to a single number.

Snapshot date: 2026-11-14T04:17Z (download time; source dataset last modified 2026-11-13T07:06Z; most recent price update 2026-11-13).

# Actor input Schema

## `query` (type: `string`):

Commune name (accent- and case-insensitive substring).

## `inseeCode` (type: `string`):

INSEE commune code (full or prefix) (accent- and case-insensitive substring).

## `departments` (type: `array`):

Department codes (e.g. 75, 2A). Records with an empty value never match.

## `fuels` (type: `array`):

Fuels (diesel, sp95, sp98, e10, e85, lpg). Records with an empty value never match.

## `minMeanPriceEur` (type: `number`):

Min commune mean price (EUR/l). Records with an empty value never match.

## `maxMeanPriceEur` (type: `number`):

Max commune mean price (EUR/l). Records with an empty value never match.

## `minGapVsDepartmentPct` (type: `number`):

Min gap to department mean (%). Records with an empty value never match.

## `maxGapVsDepartmentPct` (type: `number`):

Max gap to department mean (%). Records with an empty value never match.

## `minGapVsFrancePct` (type: `number`):

Min gap to France mean (%). Records with an empty value never match.

## `maxGapVsFrancePct` (type: `number`):

Max gap to France mean (%). Records with an empty value never match.

## `minNearbyCheapestPriceEur` (type: `number`):

Min cheapest price within 10 km (EUR/l). Records with an empty value never match.

## `maxNearbyCheapestPriceEur` (type: `number`):

Max cheapest price within 10 km (EUR/l). Records with an empty value never match.

## `minStations` (type: `number`):

Min stations in the commune. Records with an empty value never match.

## `maxStations` (type: `number`):

Max stations in the commune. Records with an empty value never match.

## `minPopulation` (type: `number`):

Min population. Records with an empty value never match.

## `maxPopulation` (type: `number`):

Max population. Records with an empty value never match.

## `minMedianIncomeEur` (type: `number`):

Min median income (EUR). Records with an empty value never match.

## `maxMedianIncomeEur` (type: `number`):

Max median income (EUR). Records with an empty value never match.

## `nearLatitude` (type: `number`):

Latitude of the search center (-90..90). Use with nearLongitude and radiusKm.

## `nearLongitude` (type: `number`):

Longitude of the search center (-180..180).

## `radiusKm` (type: `number`):

Search radius in km (max 20000). Results get a distance_km field and are sorted by distance.

## `minLatitude` (type: `number`):

South edge of a bounding box; give all four box values together.

## `maxLatitude` (type: `number`):

North edge of the bounding box.

## `minLongitude` (type: `number`):

West edge; if greater than max longitude the box crosses the antimeridian.

## `maxLongitude` (type: `number`):

East edge of the bounding box.

## `sortBy` (type: `string`):

Sort order of results. Default: file order (or distance when a radius is given).

## `maxResults` (type: `integer`):

Maximum records returned and billed (1..10000).

## Actor input object example

```json
{
  "departments": [
    "31"
  ],
  "fuels": [
    "diesel"
  ],
  "maxResults": 10
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset items returned by the run.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "departments": [
        "31"
    ],
    "fuels": [
        "diesel"
    ],
    "maxResults": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("phonic_lily/france-fuel-prices-by-commune").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "departments": ["31"],
    "fuels": ["diesel"],
    "maxResults": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("phonic_lily/france-fuel-prices-by-commune").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "departments": [
    "31"
  ],
  "fuels": [
    "diesel"
  ],
  "maxResults": 10
}' |
apify call phonic_lily/france-fuel-prices-by-commune --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,phonic_lily/france-fuel-prices-by-commune"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/f1D0VYTxJeccWpWMd/builds/yyOSYLttCgquvFrHB/openapi.json
