API documentation
8 REST endpoints returning JSON. Base: https://whataweather.com/api/v1. Open CORS. Server cache 15-60 min. OpenAPI 3.0 spec: openapi.json.
Authentication
The API is public and no key is required to start. If you go over 60 req/min/IP, write to [email protected] for a free key that goes in the X-Api-Key header and raises the limit. Without a key, send no special header.
GET/api/v1/weather
Current weather + 7-day forecast. Open-Meteo proxy with 15-minute cache.
| Param | Type | Required | Description |
|---|---|---|---|
city | string | conditional | City name. If omitted, lat+lon required. |
lat | number | conditional | Decimal latitude. Required if no city. |
lon | number | conditional | Decimal longitude. Required if no city. |
GET/api/v1/reservoirs
Full list of Spanish basins and reservoirs with KPIs (capacity, current %, weekly delta). 60-minute cache.
GET/api/v1/reservoirs/{id}
Individual record by id or slug (e.g. alcantara, ebro, la-serena).
GET/api/v1/alerts
Active AEMET alerts filtered by Spanish autonomous community. Pending official scraping: currently returns placeholder data marked in attribution.
| Param | Type | Description |
|---|---|---|
ccaa | string | valencia, cataluna, madrid, andalucia, etc. |
GET/api/v1/lightning
Strikes in the last minutes within a bbox. Placeholder until Blitzortung is integrated.
| Param | Type | Description |
|---|---|---|
bbox | string | lat1,lon1,lat2,lon2 (SW -> NE order). |
minutes | integer | Window in minutes (default 10). |
GET/api/v1/wildfire-risk
Wildfire risk (Fire Weather Index + Ignition Risk Index).
| Param | Type | Description |
|---|---|---|
city | string | City. Also supports lat+lon. |
GET/api/v1/storms
Named storms (active + historical), backed by /data/named-storms.json.
GET/api/v1/snow-level
Current snow line + 24h/48h forecast per mountain range.
| Param | Type | Description |
|---|---|---|
range | string | pirineos | cantabrica | sierra_nevada | central | iberica. |
Rate limits
60 req/min/IP without key. If exceeded you will get 429 Too Many Requests. Wait 60 s or request a key by email to raise the limit to 600 req/min.
Error codes
- 400 bad request (missing required parameters).
- 404 not found (invalid slug, non-existing city).
- 429 rate limit exceeded.
- 500 internal or upstream error (Open-Meteo, MITECO).
All errors return JSON: { "error": "...", "message": "..." }.
Cache
Server caches each call in memory:
/weather: 15 minutes per (lat,lon)./reservoirs,/reservoirs/{id}: 60 minutes./storms,/snow-level: 60 minutes./alerts,/lightning: 5 minutes./wildfire-risk: 30 minutes.
We also send Cache-Control: public, max-age=300 so your CDN and browser cooperate.
Summary terms
- Required attribution: visible link to
https://whataweather.com. - No API reselling. You may sell products built on top.
- No mass scraping. Request a free key for more volume.
- No warranties: data provided "as is".