# Spain Electricity Generation Mix API

> Spain Electricity Generation Mix 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-13).

Returns Spain's daily electricity generation breakdown by technology (wind, solar, nuclear, hydro, etc.) in MWh and percentage share, including total renewable percentage, sourced from Red Eléctrica de España.

## Facts

- Endpoint: POST https://api.vextorium.com/mix-electrico-espana-pago?utm_source=zero.xyz
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/spain-electricity-generation-mix-api-cb5b7e42
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Fc9JgpQ2KmhM70oLnJMyf

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-electricity-generation-mix-api-cb5b7e42 -d '<json body>'
```

Example prompt: What was Spain's electricity generation mix on 2025-03-15? I want to know how many MWh came from each source — wind, solar, nuclear, hydro, combined cycle — and what percentage of the total was renewable.

## When to prefer this

Use this endpoint when you need official, structured daily electricity generation data for Spain broken down by technology with renewable flagging. Prefer this over scraping REE's website directly or using generic energy databases, especially when you need machine-readable MWh figures and renewable percentages for a specific date.

## Known failure modes

- Date not yet available — REE data may lag by 1-2 days; defaults to yesterday if no date provided
- Invalid date format returns an error — must be YYYY-MM-DD
- Future dates return no data
- Very old historical dates may not be available

## How this service works

Spain's electricity generation mix for a day: MWh and share by technology (wind, solar, nuclear, combined cycle, hydro...) and renewable percentage. Red Electrica de Espana data.

## Output

A JSON object containing the queried date, data source attribution (Red Eléctrica de España), an array of technology entries each with name, MWh generated, percentage of total, and a renewable boolean flag, plus the overall total generation in MWh and aggregate renewable percentage.

## 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 (default yesterday)"
      }
     }
    },
    "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": {
      "fecha": {
       "type": [
        "string",
        "null"
       ]
      },
      "fuente": {
       "type": [
        "string",
        "null"
       ]
      },
      "tecnologias": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": [
         "null",
         "object"
        ],
        "properties": {
         "mwh": {
          "type": [
           "null",
           "number"
          ]
         },
         "renovable": {
          "type": [
           "boolean",
           "null"
          ]
         },
         "porcentaje": {
          "type": [
           "null",
           "number"
          ]
         },
         "tecnologia": {
          "type": [
           "null",
           "string"
          ]
         }
        }
       }
      },
      "renovable_pct": {
       "type": [
        "number",
        "null"
       ]
      },
      "generacion_total_mwh": {
       "type": [
        "number",
        "null"
       ]
      }
     }
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "fecha": "2026-10-01",
  "fuente": "Red Eléctrica de España (REE), sistema nacional",
  "tecnologias": [
   {
    "mwh": 181158,
    "renovable": false,
    "porcentaje": 22.41,
    "tecnologia": "Ciclo combinado"
   },
   {
    "mwh": 169114,
    "renovable": true,
    "porcentaje": 20.92,
    "tecnologia": "Solar fotovoltaica"
   },
   {
    "mwh": 165997.8,
    "renovable": false,
    "porcentaje": 20.53,
    "tecnologia": "Nuclear"
   },
   {
    "mwh": 136284.9,
    "renovable": true,
    "porcentaje": 16.86,
    "tecnologia": "Eólica"
   },
   {
    "mwh": 66579.2,
    "renovable": true,
    "porcentaje": 8.24,
    "tecnologia": "Hidráulica"
   },
   {
    "mwh": 36823.3,
    "renovable": false,
    "porcentaje": 4.55,
    "tecnologia": "Cogeneración"
   },
   {
    "mwh": 11469,
    "renovable": false,
    "porcentaje": 1.42,
    "tecnologia": "Turbina de vapor"
   },
   {
    "mwh": 10657.4,
    "renovable": true,
    "porcentaje": 1.32,
    "tecnologia": "Otras renovables"
   },
   {
    "mwh": 9104.5,
    "renovable": true,
    "porcentaje": 1.13,
    "tecnologia": "Solar térmica"
   },
   {
    "mwh": 8530.1,
    "renovable": false,
    "porcentaje": 1.06,
    "tecnologia": "Motores diésel"
   },
   {
    "mwh": 5086.5,
    "renovable": false,
    "porcentaje": 0.63,
    "tecnologia": "Carbón"
   },
   {
    "mwh": 3213,
    "renovable": false,
    "porcentaje": 0.4,
    "tecnologia": "Turbina de gas"
   },
   {
    "mwh": 2921.8,
    "renovable": false,
    "porcentaje": 0.36,
    "tecnologia": "Residuos no renovables"
   },
   {
    "mwh": 1510.6,
    "renovable": true,
    "porcentaje": 0.19,
    "tecnologia": "Residuos renovables"
   }
  ],
  "renovable_pct": 48.64,
  "generacion_total_mwh": 808450.1
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/spain-electricity-generation-mix-api-cb5b7e42/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)
