# Spain PVPC Electricity Price API

> Spain PVPC Electricity Price API is a paid API for AI agents from api.vextorium.com, paid per call via x402, $0.004/call, status unknown (last checked 2026-10-10).

Returns hourly PVPC 2.0TD regulated electricity prices for mainland Spain for any date, including daily average, cheapest/most expensive hours, and best 3-hour window.

## Facts

- Endpoint: POST https://api.vextorium.com/precio-luz-espana-pago?utm_source=zero.xyz
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-10
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/spain-pvpc-electricity-price-api-5c387f55
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_uGILLsWGWcU4YxVZjDL8P

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability spain-pvpc-electricity-price-api-5c387f55 -d '<json body>'
```

Example prompt: What are the electricity prices in Spain for tomorrow? Give me the cheapest hours, the most expensive ones, and the best 3-hour window to run heavy appliances.

## When to prefer this

Use this endpoint when you need official PVPC regulated electricity tariff data for mainland Spain, including optimized scheduling advice (cheapest hours, best 3-hour window). Prefer it over generic energy APIs when you specifically need Spain's regulated market prices from REE, broken down by hour with pre-computed analytics.

## Known failure modes

- Tomorrow's prices not yet published (REE publishes ~20:30 CET) — returns error or empty data if queried too early
- Invalid date format causes request failure
- Dates far in the past may not be available
- Network or upstream REE data outage may return null values

## How this service works

Hourly regulated electricity price in Spain (PVPC 2.0TD, mainland) for today, tomorrow (published ~20:30) or any date: every hour in EUR/kWh, daily average, cheapest and most expensive hours and best 3-hour window. Red Electrica de Espana data.

## Output

A JSON object containing: the geographic zone (Península), the queried date, a 24-entry array of hourly prices in both EUR/kWh and EUR/MWh, an array of the most expensive hours, an array of the cheapest hours, the daily average price in EUR/kWh, and the best consecutive 3-hour window (start time and average price). Also includes a source note referencing REE.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "required": [],
     "properties": {
      "fecha": {
       "type": "string",
       "description": "YYYY-MM-DD, hoy or mañana (default today)"
      }
     }
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST"
     ],
     "type": "string"
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": [
      "object",
      "null"
     ],
     "properties": {
      "nota": {
       "type": [
        "string",
        "null"
       ]
      },
      "zona": {
       "type": [
        "string",
        "null"
       ]
      },
      "fecha": {
       "type": [
        "string",
        "null"
       ]
      },
      "horas": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": [
         "null",
         "object"
        ],
        "properties": {
         "hora": {
          "type": [
           "null",
           "string"
          ]
         },
         "eur_kwh": {
          "type": [
           "null",
           "number"
          ]
         },
         "eur_mwh": {
          "type": [
           "null",
           "number"
          ]
         }
        }
       }
      },
      "mas_caras": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": [
         "null",
         "object"
        ],
        "properties": {
         "hora": {
          "type": [
           "null",
           "string"
          ]
         },
         "eur_kwh": {
          "type": [
           "null",
           "number"
          ]
         },
         "eur_mwh": {
          "type": [
           "null",
           "number"
          ]
         }
        }
       }
      },
      "mas_baratas": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": [
         "null",
         "object"
        ],
        "properties": {
         "hora": {
          "type": [
      
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "nota": "Término de energía del PVPC con peajes y cargos, sin impuestos. Fuente: Red Eléctrica de España (REE).",
  "zona": "Península",
  "fecha": "2026-10-02",
  "horas": [
   {
    "hora": "00:00",
    "eur_kwh": 0.1609,
    "eur_mwh": 160.9
   },
   {
    "hora": "01:00",
    "eur_kwh": 0.14965,
    "eur_mwh": 149.65
   },
   {
    "hora": "02:00",
    "eur_kwh": 0.14555,
    "eur_mwh": 145.55
   },
   {
    "hora": "03:00",
    "eur_kwh": 0.1453,
    "eur_mwh": 145.3
   },
   {
    "hora": "04:00",
    "eur_kwh": 0.15241,
    "eur_mwh": 152.41
   },
   {
    "hora": "05:00",
    "eur_kwh": 0.17789,
    "eur_mwh": 177.89
   },
   {
    "hora": "06:00",
    "eur_kwh": 0.2226,
    "eur_mwh": 222.6
   },
   {
    "hora": "07:00",
    "eur_kwh": 0.27434,
    "eur_mwh": 274.34
   },
   {
    "hora": "08:00",
    "eur_kwh": 0.3229,
    "eur_mwh": 322.9
   },
   {
    "hora": "09:00",
    "eur_kwh": 0.24509,
    "eur_mwh": 245.09
   },
   {
    "hora": "10:00",
    "eur_kwh": 0.24068,
    "eur_mwh": 240.68
   },
   {
    "hora": "11:00",
    "eur_kwh": 0.204,
    "eur_mwh": 204
   },
   {
    "hora": "12:00",
    "eur_kwh": 0.20125,
    "eur_mwh": 201.25
   },
   {
    "hora": "13:00",
    "eur_kwh": 0.19891,
    "eur_mwh": 198.91
   },
   {
    "hora": "14:00",
    "eur_kwh": 0.1297,
    "eur_mwh": 129.7
   },
   {
    "hora": "15:00",
    "eur_kwh": 0.13736,
    "eur_mwh": 137.36
   },
   {
    "hora": "16:00",
    "eur_kwh": 0.14452,
    "eur_mwh": 144.52
   },
   {
    "hora": "17:00",
    "eur_kwh": 0.16911,
    "eur_mwh": 169.11
   },
   {
    "hora": "18:00",
    "eur_kwh": 0.31029,
    "eur_mwh": 310.29
   },
   {
    "hora": "19:00",
    "eur_kwh": 0.35435,
    "eur_mwh": 354.35
   },
   {
    "hora": "20:00",
    "eur_kwh": 0.37978,
    "eur_mwh": 379.78
   },
   {
    "hora": "21:00",
    "eur_kwh": 0.34402,
    "eur_mwh": 344.02
   },
   {
    "hora": "22:00",
    "eur_kwh": 0.2559,
    "eur_mwh": 255.9
   },
   {
    "hora": "23:00",
    "eur_kwh": 0.22908,
    "eur_mwh": 229.08
   }
  ],
  "mas_caras": [
   {
    "hora": "20:00",
    "eur_kwh": 0.37978,
    "eur_mwh": 379.78
   },
   {
    "hora": "19:00",
    "eur_kwh": 0.35435,
    "eur_mwh": 354.35
   },
   {
    "hora": "21:00",
    "eur_kwh": 0.34402,
    "eur_mwh": 344.02
   }
  ],
  "mas_baratas": [
   {
    "hora": "14:00",
    "eur_kwh": 0.1297,
    "eur_mwh": 129.7
   },
   {
    "hora": "15:00",
    "eur_kwh": 0.13736,
    "eur_mwh": 137.36
   },
   
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/spain-pvpc-electricity-price-api-5c387f55/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.vextorium.com](https://www.zero.xyz/host/api.vextorium.com/llms.txt)
