# Spain Fuel Prices – Cheapest Petrol Stations (Gasolineras) (`sn41lz/spain-fuel-prices`) Actor

Current and historical prices of every petrol station in Spain from the official Ministry data: petrol, diesel, LPG, AdBlue and more. Find the cheapest stations near you, by province, town or brand.

- **URL**: https://apify.com/sn41lz/spain-fuel-prices.md
- **Developed by:** [Sergi Espí Zamora](https://apify.com/sn41lz) (community)
- **Categories:** Travel, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 station saveds

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

## Spain Fuel Prices – Cheapest Petrol Stations (Gasolineras)

Get **the price of every petrol station in Spain** (about 11,500 stations) from the **official data of the Spanish Ministry for the Ecological Transition**, updated every 30 minutes: petrol 95 and 98, diesel, premium diesel, LPG (autogás), CNG/LNG, hydrogen, AdBlue and more.

Find **the cheapest stations near any location**, in a province or town, or of a given brand. You can also get **the prices of any past day** for price analysis.

### Who is it for?

- **Fleets, logistics and transport companies** that want their drivers to refuel where it's cheapest.
- **Apps and websites** that show fuel prices or route costs.
- **Analysts and journalists** tracking fuel prices by region, brand or over time.
- **Anyone** who wants a daily list of the cheapest stations around them.

### What data do you get?

| Field | Example |
|---|---|
| `brand` | PLENOIL |
| `price_gasolina95`, `price_diesel`, … | 1.749 (€/litre, one column per fuel you choose) |
| `prices` | all fuels the station sells, e.g. `{"gasolina95": 1.799, "diesel": 1.749, "adblue": 0.89}` |
| `address`, `postalCode`, `locality`, `municipality`, `province`, `region` | Calle Mayor 1, 28001, Madrid, Madrid, Madrid, Madrid |
| `latitude`, `longitude` | 40.4168, -3.7038 |
| `distanceKm` | 1.37 (when you give a location) |
| `schedule`, `open24h` | L-D: 24H, true |
| `saleType` | `public` or `restricted` (members only) |
| `pricesDate` | 2026-09-26T11:10:26 (when the Ministry published these prices) |

### How to use it

**Cheapest diesel in your province:** choose *Diésel* as the first fuel, add your province (e.g. `Madrid`) and keep *Sort by: Cheapest first*. Set *Max results* to 10 for the top 10.

**Cheapest stations near you:** fill *latitude*, *longitude* and a *radius* (e.g. 5 km). Each station gets its distance, and you can sort by price or by distance.

**Only some brands:** add brands such as `Plenoil`, `Ballenoil`, `Repsol` or `Cepsa`.

**Past prices:** set a *Date* (e.g. `2025-01-01`) to get that day's prices instead of today's.

**Schedule it:** run it daily from the *Schedules* tab and send the result to Google Sheets, email or Slack from *Integrations*.

### How much does it cost?

$0.001 per station (**$1 per 1,000 stations**). Filters are applied first, so you only pay for the stations you get:

- Top 10 cheapest in a province: **$0.01**
- Stations within 5 km of a city centre: usually **a few cents**
- A whole province: from a few cents to under $1
- All of Spain (~11,300 stations): about **$11**

### Data source

All prices come from the Spanish government's official open-data service for fuel prices (Ministerio para la Transición Ecológica y el Reto Demográfico), which petrol stations are legally required to keep up to date. The Actor reads that public service; it does not scrape any private website.

***

### En español: precios de gasolineras en España

Obtén **el precio de todas las gasolineras de España** con los **datos oficiales del Ministerio**, actualizados cada 30 minutos: gasolina 95 y 98, diésel, GLP, GNC, hidrógeno, AdBlue y más. Encuentra **las más baratas cerca de ti**, por provincia, municipio o marca, o consulta **los precios de cualquier día pasado**. Ideal para flotas, empresas de transporte, apps y análisis de precios. Cuesta 1 $ por cada 1.000 gasolineras: el top 10 de tu provincia sale por 0,01 $.

# Actor input Schema

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

Fuels to include as price columns. Results are filtered and sorted by the first one.

## `provinces` (type: `array`):

e.g. "Madrid", "Valencia". Leave empty for all of Spain.

## `municipality` (type: `string`):

Only stations in this town, e.g. "Getafe".

## `latitude` (type: `number`):

Your location, e.g. 40.4168. Adds the distance to each station.

## `longitude` (type: `number`):

Your location, e.g. -3.7038.

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

Only stations within this distance of your location.

## `brands` (type: `array`):

Only these brands, e.g. "Repsol", "Cepsa", "Plenoil", "Ballenoil".

## `maxPrice` (type: `number`):

Only stations where the first fuel costs at most this.

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

Cheapest first uses the first fuel in the list. Nearest first needs a location.

## `date` (type: `string`):

Get the prices of a past day instead of today's. Format YYYY-MM-DD.

## `includeRestricted` (type: `boolean`):

Also include stations that only sell to members (cooperatives, fleets).

## `maxItems` (type: `integer`):

Stop after this many stations. 0 = no limit.

## Actor input object example

```json
{
  "fuels": [
    "gasolina95",
    "diesel"
  ],
  "provinces": [
    "Madrid"
  ],
  "sortBy": "price",
  "includeRestricted": false,
  "maxItems": 50
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

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

No description

# 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 = {
    "provinces": [
        "Madrid"
    ],
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("sn41lz/spain-fuel-prices").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 = {
    "provinces": ["Madrid"],
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("sn41lz/spain-fuel-prices").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 '{
  "provinces": [
    "Madrid"
  ],
  "maxItems": 50
}' |
apify call sn41lz/spain-fuel-prices --silent --output-dataset

```

## MCP server setup

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

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/Jlhhsx4fIBgvESnqK/builds/C5fQ9gYHyXtjAjWnw/openapi.json
