# Spain PVPC Electricity Price API

> Spain PVPC Electricity Price API is a paid API for AI agents from es.redtapeapi.com, paid per call via x402, $0.002/call, status unknown (last checked 2026-11-18).

Returns Spain's regulated PVPC electricity tariff prices for today or tomorrow, including cheapest hours and optimal 3-hour windows.

## Facts

- Endpoint: GET https://es.redtapeapi.com/v1/es/electricity/pvpc?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-18
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/spain-pvpc-electricity-price-api-7d09d288
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_evq3WliBc5XgVBs0CKqym

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-7d09d288
```

Example prompt: What are the 5 cheapest electricity hours in Spain tomorrow under the PVPC tariff, and when is the best 3-hour window to run heavy appliances?

## When to prefer this

Use this endpoint when you need Spain's official regulated PVPC electricity tariff prices to schedule energy usage, automate smart home decisions, or display real-time price information — particularly when you need cheapest-hour identification or optimal window analysis without storing any data or managing API credentials.

## Known failure modes

- Tomorrow's prices not yet available (published ~20:15–20:30 Madrid time): may return an error or empty data if requested too early
- Invalid 'day' value (not 'today' or 'tomorrow'): request rejected
- 'cheapest' parameter out of range (not 1–12): request rejected
- Upstream REE/ESIOS data feed unavailable: service may return an error
- Network timeout or x402 payment failure: call not completed

## How this service works

Pay-per-call Spain and EU utilities for AI agents over x402 (USDC). No accounts, no API keys. Public open data, live official checks (EU VIES) and offline computation; nothing is stored.

## Output

Returns a JSON object with the target date, price unit (EUR/kWh), a list of the N cheapest hours with their tariff period label and price, the average price across all hours, and the start hour of the cheapest consecutive 3-hour window with its average price.

## 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"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [],
     "properties": {
      "day": {
       "type": "string",
       "description": "today (default) or tomorrow. Tomorrow is published around 20:15-20:30 Madrid time."
      },
      "cheapest": {
       "type": "integer",
       "description": "How many cheapest hours to return (1-12, default 3)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "date": "2026-10-22",
  "unit": "EUR/kWh",
  "cheapest": [
   {
    "hour": 14,
    "period": "llano",
    "eurPerKWh": 0.01314
   }
  ],
  "averageEurPerKWh": 0.20774,
  "cheapestWindow3h": {
   "startHour": 14,
   "avgEurPerKWh": 0.01349
  }
 }
}
```

## More

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