IPMA (Portugal) API
Free Portuguese weather API with no key: five-day city forecasts from the national meteorological institute, plus seismic and warning datasets. Tested example included.
Endpoint tested and returned HTTP 200 on 2026-08-21
What is the IPMA (Portugal) API?
IPMA, Portugal's national meteorological institute, publishes open forecast data as static JSON files with no API key. A city's daily forecast returns minimum and maximum temperature, precipitation probability, wind direction and speed class, and a weather type code per day.
There is no query API here in the usual sense — IPMA publishes pre-generated JSON files at predictable paths, one per city, and you fetch the one you want. That is an unfashionable design that turns out to be a considerable virtue: the files sit behind a CDN, they never time out under load, and there is nothing to rate limit.
The catch is that everything is coded. `idWeatherType` is an integer that means nothing on its own; you must fetch the separate weather-type table to map 2 to "partly cloudy". `classWindSpeed` is likewise a band rather than a speed in any unit, and `classPrecInt` grades precipitation intensity the same way. Fetch those lookup tables once at startup and cache them. Note also that the numeric values arrive as strings — `"16.9"` rather than 16.9 — so parse before comparing, and that the city id in the path comes from a separate district list file.
Quick facts
- Base URL
https://api.ipma.pt/open-data- Authentication
- No API key and no registration. IPMA asks for attribution when the data is republished.
- Rate limit
- No published limit. Files are static and CDN-served, regenerated a few times a day.
- Pricing
- Free. Portuguese government open data.
- CORS
- Enabled — callable directly from browser JavaScript
- Official docs
- Read the docs
How to use the IPMA (Portugal) API
Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.
1. Fetch a five-day city forecast
GET https://api.ipma.pt/open-data/forecast/meteorology/cities/daily/1110600.json
curl 'https://api.ipma.pt/open-data/forecast/meteorology/cities/daily/1110600.json'const res = await fetch("https://api.ipma.pt/open-data/forecast/meteorology/cities/daily/1110600.json");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://api.ipma.pt/open-data/forecast/meteorology/cities/daily/1110600.json", timeout=20)
res.raise_for_status()
print(res.json()){
"owner": "IPMA",
"country": "PT",
"data": [
{
"precipitaProb": "0.0",
"tMin": "16.9",
"tMax": "25.6",
"predWindDir": "N",
"idWeatherType": 2,
"classWindSpeed": 2,
"longitude": "-9.1286",
"forecastDate": "2026-08-21",
"latitude": "38.7660"
},
{
"precipitaProb": "0.0",
"tMin": "16.0",
"tMax": "26.8",
"predWindDir": "SW",
"idWeatherType": 1,
"classWindSpeed": 2,
"longitude": "-9.1286",
"forecastDate": "2026-08-22",
"latitude": "38.7660"
},
{
"precipitaProb": "90.0",
"tMin": "17.0",
"tMax": "24.1",
"predWindDir": "S",
"idWeatherType": 7,
"classWindSpeed": 2,
"longitude": "-9.1286",
"forecastDate": "2026-08-23",
"classPrecInt": 1,
"latitude": "38.7660"
},
{
"precipitaProb": "100.0",
"tMin": "18.2",
"tMax": "24.4",
"predWindDir": "S",
"idWeatherType": 6,
"classWindSpeed": 2,
"longitude": "-9.1286",
"forecastDate": "2026-08-24",
"classPrecInt": 2,
"latitude": "38.7660"
},
{
"precipitaProb": "67.0",
"tMin": "18.5",
"tMax": "24.2",
"predWindDir": "SW",
"idWeatherType": 7,
"classWindSpeed": 2,
"longitude": "-9.1286",
"forecastDate": "2026-08-25",
"classPrecInt": 1,
"latitude": "38.7660"
}
],
"globalIdLocal": 1110600,
"dataUpdate": "2026-08-21T07:31:02"
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
(city id) | path | Required | Global city identifier, from IPMA's district list file. 1110600 is Lisbon. 1110600 |
/distrito/nazoes-do-pais/distrito-ilha.json | path | Optional | The city list, mapping names to the ids the forecast paths take. |
/weather-type-classe.json | path | Optional | Lookup table decoding `idWeatherType` into descriptions. |
/wind-speed-daily-classe.json | path | Optional | Lookup table for the `classWindSpeed` bands. |
Response fields
owner / countrystring- Publisher (`IPMA`) and country code, present on every file.
dataarray- One entry per forecast day, chronological.
data[].forecastDatestring- The day being forecast, `YYYY-MM-DD`.
data[].tMin / tMaxstring- Minimum and maximum temperature in Celsius, serialised as strings.
data[].precipitaProbstring- Precipitation probability as a percentage string, `"0.0"` through `"100.0"`.
data[].predWindDirstring- Predominant wind direction as a compass abbreviation such as `N` or `SW`.
data[].classWindSpeedinteger- Wind speed band, not a speed. Decode it with the wind-speed classes file.
data[].idWeatherTypeinteger- Weather type code. Meaningless without the weather-type lookup table.
data[].classPrecIntinteger- Precipitation intensity class. Absent on days with no expected rain.
data[].latitude / longitudestring- Coordinates of the forecast point, as strings.
What you can build with the IPMA (Portugal) API
- Build a Portuguese weather app on official national data
- Show a five-day forecast for a specific Portuguese city
- Combine forecasts with IPMA's seismic and warning datasets
- Serve forecast data with no rate limiting concerns behind a CDN
Common errors and how to fix them
Weather type shows as a number
`idWeatherType` is a code, not a description.
Fix: Fetch `/weather-type-classe.json` once and cache the mapping. The same applies to wind and precipitation classes.
Numeric comparison fails
Temperatures and probabilities are strings.
Fix: Parse to float before comparing. `"9.0"` sorts before `"16.9"` as a string.
404 on a city id
The identifier was guessed rather than taken from the district list.
Fix: Read the district list file and use the `globalIdLocal` values it publishes.
classPrecInt missing
The field only appears on days with expected precipitation.
Fix: Treat absence as no meaningful intensity rather than as an error.
IPMA (Portugal) API — frequently asked questions
Is the IPMA API free?
Yes, free with no key or registration. It is Portuguese government open data, and IPMA asks for attribution when you republish it.
Why are the weather conditions just numbers?
IPMA separates codes from descriptions so it can publish them in several languages. Fetch the weather-type, wind-speed and precipitation-class lookup files once and cache them locally.
How do I find the right city id?
From IPMA's district list file, which maps place names to the `globalIdLocal` values the forecast paths use. Guessing ids will give you 404s.
Why are numbers returned as strings?
That is simply how these files are serialised. Every numeric field — temperatures, probabilities, coordinates — needs parsing before you compare or calculate with it.
Tools that pair with this API
Unit Converter
Convert between units of length, weight, temperature, area, volume, speed, time and data storage instantly, with a swap button and common conversion tables.
Date Format Converter
Convert any date between ISO 8601, US, European, RFC 2822 and custom token formats. Includes a bulk mode that reformats a whole pasted list at once.
IPMA (Portugal) is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.