# Precio de la luz PVPC hoy y mañana, por horas (España) (`rianone/spain-pvpc-retail`) Actor

Precio de la luz PVPC en España, hoy y mañana, hora a hora, desde REData de Red Eléctrica: EUR/MWh y EUR/kWh para Península. Dataset, CSV y Excel listos. ESIOS es opcional si aportas tu token. No oficial: no afiliado a Red Eléctrica.

- **URL**: https://apify.com/rianone/spain-pvpc-retail.md
- **Developed by:** [Riccardo Pongetti](https://apify.com/rianone) (community)
- **Categories:** Business, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 hourly prices

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

## Precio de la luz PVPC por horas (España)

Obtén el indicador horario PVPC de Red Eléctrica de España en un dataset listo para automatizar, además de archivos CSV y Excel. Consulta hoy, mañana o un periodo histórico de hasta 366 días sin aportar un token.

Está pensado para integradores, no para una consulta manual puntual: domótica/Home Assistant, desarrolladores, hojas de cálculo, webhooks, consultoras energéticas y aplicaciones que necesitan una serie limpia por hora.

### Qué obtienes

Cada fila representa un precio PVPC horario e incluye:

- Fecha y hora en horario de España.
- Zona consultada.
- Precio en EUR/kWh y EUR/MWh.
- Nombre del indicador PVPC.
- Fuente, enlace de origen y fecha de actualización.

La salida se entrega en el dataset de Apify y, si lo eliges, como CSV y Excel. La zona disponible y verificada actualmente es Península.

#### Ejemplo de salida (FICTICIO)

```json
{
  "date": "2026-10-01",
  "hour": "18",
  "geoName": "Península",
  "priceEurKwh": 0.1425,
  "priceEurMwh": 142.5,
  "indicatorName": "PVPC",
  "source": "redata"
}
```

### Empieza y prográmalo cada día

1. Ejecuta el actor y deja las fechas vacías para consultar hoy y mañana; elige CSV y/o Excel si los necesitas.
2. En Apify, crea un Schedule diario a partir de las 20:30 (hora de Madrid) para obtener los precios del día siguiente.
3. Conecta el dataset o los archivos a Google Sheets, un webhook o Home Assistant mediante las integraciones de Apify.

### Precio

Pagas solo por los precios horarios que recibes: 0,002 $ por hora de precio. Sin cargos por ejecución.

Por ejemplo, 24 horas x 30 días = 1,44 $/mes.

### Preguntas frecuentes

#### ¿Necesito un token?

No para la consulta predeterminada: usa REData de Red Eléctrica de España. El campo opcional `esiosToken` permite consultar ESIOS si ya dispones de un token personal.

#### ¿A qué hora se publican los precios de mañana?

La disponibilidad depende de la publicación de Red Eléctrica de España. Programa tu consulta diaria después de que la fuente publique los datos y revisa `sourceUpdatedAt` en la salida.

#### ¿Qué zonas hay disponibles?

Actualmente el actor ofrece Península, la combinación validada para esta fuente. No anuncia otras zonas hasta que sus parámetros y resultados estén verificados.

#### ¿Cuál es la diferencia entre EUR/MWh y EUR/kWh?

Un MWh equivale a 1.000 kWh. El mismo precio se incluye en ambas unidades para facilitar tanto análisis energéticos como cálculos domésticos.

#### ¿Es el importe completo de mi factura?

No. Es el indicador/precio PVPC horario de REE, no una factura completa ni una garantía de ahorro. Tu factura puede incluir otros conceptos, impuestos y condiciones contractuales.

### Fuente y aviso

Datos obtenidos de REData / Red Eléctrica de España. Cada fila conserva la fuente, el enlace y la fecha de actualización. Este actor no es oficial, no está afiliado ni respaldado por Red Eléctrica de España. Consulta el aviso legal de REE antes de reutilizar los datos para un fin concreto.

### English summary

Get Spain's hourly PVPC indicator in an automation-ready Apify dataset, CSV, or Excel file. The default REData query needs no token and currently supports the verified Peninsular area. Each row includes date, hour, zone, EUR/kWh, EUR/MWh, and source metadata. Schedule it daily and connect the output to Google Sheets, webhooks, or Home Assistant. This is an REE indicator, not a complete bill or savings guarantee; the actor is not official or affiliated with REE.

# Actor input Schema

## `startDate` (type: `string`):

Primer día a consultar (YYYY-MM-DD). Por defecto: hoy, hora de Madrid.

## `endDate` (type: `string`):

Último día a consultar (YYYY-MM-DD). Por defecto: mañana. Máximo 366 días por consulta.

## `zone` (type: `string`):

Zona disponible y validada actualmente para la consulta sin token.

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

Tope de filas devueltas. 0 = sin límite dentro del rango de fechas elegido.

## `exportFiles` (type: `array`):

Generar CSV y/o XLSX listos para abrir en el almacén de archivos.

## `exportLanguage` (type: `string`):

Idioma de los encabezados de los archivos exportados.

## `esiosToken` (type: `string`):

Opcional. Si lo aportas, se consulta ESIOS en lugar de REData. Consíguelo en https://www.esios.ree.es/es/token.

## Actor input object example

```json
{
  "zone": "peninsular",
  "maxResults": 48,
  "exportFiles": [
    "csv",
    "xlsx"
  ],
  "exportLanguage": "es"
}
```

# Actor output Schema

## `prices` (type: `string`):

Registros de precios horarios en el dataset por defecto.

# 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 = {
    "startDate": "",
    "endDate": "",
    "zone": "peninsular",
    "exportFiles": [
        "csv",
        "xlsx"
    ],
    "exportLanguage": "es"
};

// Run the Actor and wait for it to finish
const run = await client.actor("rianone/spain-pvpc-retail").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 = {
    "startDate": "",
    "endDate": "",
    "zone": "peninsular",
    "exportFiles": [
        "csv",
        "xlsx",
    ],
    "exportLanguage": "es",
}

# Run the Actor and wait for it to finish
run = client.actor("rianone/spain-pvpc-retail").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 '{
  "startDate": "",
  "endDate": "",
  "zone": "peninsular",
  "exportFiles": [
    "csv",
    "xlsx"
  ],
  "exportLanguage": "es"
}' |
apify call rianone/spain-pvpc-retail --silent --output-dataset

```

## MCP server setup

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

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/FhinHfmrMaMjJKHWR/builds/M8fSamYJdcKY9eQmJ/openapi.json
