# AEMET Meteoalerta: Weather Warnings and Forecasts (`innovito/aemet-avisos-predicciones`) Actor

Official AEMET Meteoalerta weather warnings (avisos meteorológicos AEMET) from the public CAP feed (no API key) and, optionally, municipal daily forecasts if you provide your own free AEMET OpenData key. Structured rows with attribution to AEMET.

- **URL**: https://apify.com/innovito/aemet-avisos-predicciones.md
- **Developed by:** [Asier Sanchez](https://apify.com/innovito) (community)
- **Categories:** Travel, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 weather warnings

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

## Spain AEMET Weather Warnings and Forecasts (Meteoalerta)

Get official **AEMET Meteoalerta weather warnings** (avisos meteorológicos AEMET) and, optionally, municipal daily forecasts as clean JSON or CSV rows.

**Warnings do not need an API key.** The Actor reads the official public CAP Atom feed and the individual CAP XML documents. **Municipal forecasts** use AEMET OpenData and require **your own free** OpenData key (`apiKey` in the input). This Actor never uses a shared key.

Ideal for civil protection, logistics, insurance, travel tools and AI/MCP or n8n agents that need official AEMET alerts.

### What you get

Warnings (`itemType` = `warning`):

| Field | Description |
|---|---|
| `headline`, `event`, `description` | Official warning text (Spanish or English) |
| `level` | AEMET colour (yellow / orange / red) |
| `severity`, `urgency`, `certainty` | CAP severity classes (Moderate ≈ yellow) |
| `area`, `geocode` | Affected area |
| `onset`, `expires` | Validity window |
| `webUrl` | Official link when present |
| `sourceAttribution` | Required © AEMET credit |

Forecast days (`itemType` = `forecast`), only if you provide a free OpenData key and INE municipality codes: `municipality`, `date`, `temperatureMax`, `temperatureMin`, sky, precipitation and wind by period.

### Input example (warnings, no API key)

```json
{
  "mode": "warnings",
  "language": "es",
  "areas": ["León", "Cataluña", "nieve"],
  "maxItems": 10
}
```

Set `mode` to `forecasts` or `both` only when you also pass `apiKey` and `municipalities` (e.g. `28079` for Madrid, `08019` for Barcelona).

### Output example (weather warning)

```json
{
  "itemType": "warning",
  "identifier": "ES-AEMET-672401-20261122",
  "status": "Actual",
  "msgType": "Alert",
  "event": "Nieve",
  "headline": "Aviso amarillo por nieve en León",
  "description": "Se prevén acumulaciones de nieve en zonas de montaña.",
  "language": "es",
  "urgency": "Expected",
  "severity": "Moderate",
  "certainty": "Likely",
  "level": "yellow",
  "onset": "2026-11-22T09:00:00+01:00",
  "expires": "2026-11-22T21:00:00+01:00",
  "area": "León",
  "geocode": "ES241",
  "webUrl": "https://www.aemet.es/es/eltiempo/prediccion/avisos",
  "sourceAttribution": "© AEMET. Información elaborada por la Agencia Estatal de Meteorología.",
  "scrapedAt": "2026-11-23T21:00:00+00:00"
}
```

### Python example (`apify-client`)

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("innovito/aemet-avisos-predicciones").call(
    run_input={
        "mode": "warnings",
        "language": "es",
        "areas": ["León", "Cataluña"],
        "maxItems": 10,
    }
)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["itemType"], item.get("headline") or item.get("municipality"), item.get("level"))
```

### Pricing

Pay-per-event: $4.00 per 1,000 weather warnings or municipal forecast days written to the dataset, plus $0.00005 per Actor start. You are not charged for platform compute.

### Data source and terms

- Warnings: official AEMET Meteoalerta CAP Atom feed (no key). Forecasts: [AEMET OpenData](https://opendata.aemet.es) with the user’s free key (~40–50 requests/min).
- Reuse is subject to the [AEMET legal notice](https://www.aemet.es/es/nota_legal). Credit «© AEMET» / «Información elaborada por la Agencia Estatal de Meteorología». Do not alter the meaning or present this Actor as an official AEMET product.

***

## Avisos meteorológicos AEMET (Meteoalerta) y predicciones

Obtiene los **avisos meteorológicos oficiales de AEMET (Meteoalerta)** y, si lo pides, las predicciones municipales diarias, en filas JSON o CSV.

**Los avisos no necesitan clave de API.** El Actor lee el canal CAP Atom oficial y los XML CAP individuales. **Las predicciones municipales** usan OpenData y exigen **tu propia** clave gratuita en el campo `apiKey`. Este Actor no utiliza ninguna clave compartida.

Ideal para protección civil, logística, seguros, viajes y agentes de IA, MCP o n8n que necesitan avisos oficiales de AEMET.

### Qué devuelve

Avisos (`itemType` = `warning`): titular, fenómeno, nivel de color AEMET (amarillo / naranja / rojo), severidad CAP, zona, ventana de validez, enlace oficial y atribución © AEMET.

Predicciones (`itemType` = `forecast`), solo con clave OpenData gratuita y códigos INE de municipio: municipio, fecha, temperaturas máxima y mínima, cielo, precipitación y viento por tramos.

### Ejemplo de entrada (avisos, sin clave)

```json
{
  "mode": "warnings",
  "language": "es",
  "areas": ["León", "Cataluña", "nieve"],
  "maxItems": 10
}
```

Usa `forecasts` o `both` solo si también indicas `apiKey` y `municipalities` (p. ej. `28079` Madrid, `08019` Barcelona).

### Ejemplo de salida (aviso meteorológico)

```json
{
  "itemType": "warning",
  "headline": "Aviso amarillo por nieve en León",
  "event": "Nieve",
  "level": "yellow",
  "severity": "Moderate",
  "area": "León",
  "onset": "2026-11-22T09:00:00+01:00",
  "expires": "2026-11-22T21:00:00+01:00",
  "sourceAttribution": "© AEMET. Información elaborada por la Agencia Estatal de Meteorología."
}
```

### Ejemplo en Python (`apify-client`)

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("innovito/aemet-avisos-predicciones").call(
    run_input={
        "mode": "warnings",
        "language": "es",
        "areas": ["León", "Cataluña"],
        "maxItems": 10,
    }
)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["itemType"], item.get("headline") or item.get("municipality"), item.get("level"))
```

### Precio

Pago por uso: 4,00 $ por cada 1.000 avisos meteorológicos o días de predicción municipal escritos en el dataset, más 0,00005 $ por arranque. No se cobra el cómputo de la plataforma.

### Origen y condiciones

- Avisos: canal CAP Atom oficial de Meteoalerta (sin clave). Predicciones: [AEMET OpenData](https://opendata.aemet.es) con la clave gratuita del usuario (~40–50 pet./min).
- Reutilización sujeta a la [nota legal de AEMET](https://www.aemet.es/es/nota_legal). Hay que citar «© AEMET» / «Información elaborada por la Agencia Estatal de Meteorología». No se debe alterar el sentido ni presentar este Actor como un producto oficial de AEMET.

# Actor input Schema

## `mode` (type: `string`):

warnings = official CAP Meteoalerta feed (no API key). forecasts = municipal daily forecasts (needs your free OpenData key and municipality codes). both = warnings first, then forecasts.

## `feedUrl` (type: `string`):

Official AEMET CAP Atom feed. Default is the national Meteoalerta feed for Spain. Must be a host under aemet.es.

## `language` (type: `string`):

CAP warnings include Spanish and English info blocks.

## `minSeverity` (type: `string`):

Keep warnings at this severity or higher. AEMET yellow ≈ Moderate, orange ≈ Severe, red ≈ Extreme.

## `areas` (type: `array`):

Keep warnings whose area, headline or description contains one of these words, e.g. <code>León</code>, <code>Tarragona</code>, <code>nieve</code>. Empty = all areas. Other typical filters: <code>Cataluña</code>, <code>Andalucía</code>, <code>viento</code>.

## `apiKey` (type: `string`):

Required only for municipal forecasts. Get a free key at <a href='https://opendata.aemet.es' target='_blank' rel='noopener'>opendata.aemet.es</a> (register and request the API key). Warnings do not use this field. The Actor never ships with a shared key.

## `municipalities` (type: `array`):

Five-digit INE municipality codes for daily forecasts, e.g. <code>28079</code> (Madrid), <code>08019</code> (Barcelona). Used only in forecasts or both modes.

## `maxItems` (type: `integer`):

Stop after this many dataset rows (warnings + forecast days). 0 = no limit.

## Actor input object example

```json
{
  "mode": "warnings",
  "language": "es",
  "minSeverity": "",
  "maxItems": 0
}
```

# Actor output Schema

## `items` (type: `string`):

Dataset of official AEMET Meteoalerta weather warnings and, optionally, municipal daily forecasts (one row per warning or forecast day).

## `runStats` (type: `string`):

RUN_STATS record: mode used, warnings and forecasts parsed and pushed, errors if a key is missing for forecasts.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("innovito/aemet-avisos-predicciones").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("innovito/aemet-avisos-predicciones").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 '{}' |
apify call innovito/aemet-avisos-predicciones --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,innovito/aemet-avisos-predicciones"
        }
    }
}
```

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/Zumh95WNbiC4FHBDQ/builds/fsOl5TdsbqEWxsGcP/openapi.json
