# Spain PVPC Electricity Price API

> Spain PVPC Electricity Price API is a paid API for AI agents from spain-agent-toolkit.spain-agent-toolkit.workers.dev, paid per call via x402, $0.01/call, status unknown (last checked 2026-10-29).

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

## Facts

- Endpoint: GET https://spain-agent-toolkit.spain-agent-toolkit.workers.dev/v1/es/electricity/pvpc?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/spain-pvpc-electricity-price-api-3a4aac68
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_P6mzR0XvIZf-iXAwaOhZ_

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-3a4aac68
```

Example prompt: What are the 5 cheapest electricity hours in Spain tomorrow according to the PVPC tariff?

## When to prefer this

Use this endpoint when you need Spain-specific regulated PVPC electricity hourly pricing without requiring an account or API key. Ideal for energy optimization agents, smart home automation, or any workflow that needs to schedule tasks during cheap electricity windows in Spain. Prefer this over generic energy APIs when you need the official Spanish regulated tariff (PVPC) specifically, with pay-per-call USDC micropayment and no subscription required.

## Known failure modes

- Tomorrow's prices not yet published (available after ~20:15-20:30 Madrid time) — may return error or empty data
- Invalid 'day' parameter value — only 'today' or 'tomorrow' accepted
- Invalid 'cheapest' value outside 1-12 range
- Upstream REE data unavailable or delayed — service may return stale or error response
- Payment failure via x402 protocol — request rejected before data is returned

## How this service works

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

## Output

Returns a JSON object with the date, price unit (EUR/kWh), a list of the N cheapest hours with their time-of-use period and price, the daily average price, and the cheapest consecutive 3-hour window with its start hour and 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-3a4aac68/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from spain-agent-toolkit.spain-agent-toolkit.workers.dev](https://www.zero.xyz/host/spain-agent-toolkit.spain-agent-toolkit.workers.dev/llms.txt)
