MET Norway (Yr) API
Free weather data from the Norwegian Meteorological Institute, no key needed (identify via User-Agent).
What it does
MET Norway’s API (the data behind Yr.no) provides free global weather forecasts — the locationforecast product gives hourly then 6-hourly data out to ~10 days — plus sunrise/sunset, Nordic radar nowcasts, ocean forecasts, air quality and more.
Base URL
Authentication
None — but a genuine, identifying User-Agent header is mandatory (your app name, version and a contact URL or email). You must also honour the Expires and Last-Modified caching headers and not poll faster than the data changes.
Code examples
curl -s "https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=59.91&lon=10.75" \ -H "User-Agent: larzos-weather/1.0 (https://larzos.com)"
import requests
H = {"User-Agent": "larzos-weather/1.0 (https://larzos.com)"}
r = requests.get("https://api.met.no/weatherapi/locationforecast/2.0/compact",
params={"lat": 51.5, "lon": -0.12}, headers=H, timeout=10)
ts = r.json()["properties"]["timeseries"][0]
print(ts["time"], ts["data"]["instant"]["details"]["air_temperature"])Rate limits & quotas
No key and no hard per-user quota, but abuse is blocked: cap requests at a few per second, round coordinates to ~4 decimals (over-precise coordinates are rejected), send If-Modified-Since, and cache until Expires. Ignoring the User-Agent rule gets you a 403 and can lead to an IP block.
Key response fields
| properties.timeseries[] | Forecast steps, each with a time |
| ….data.instant.details.air_temperature | Temperature at that moment (°C) |
| ….data.next_1_hours.summary.symbol_code | Condition symbol (e.g. partlycloudy_day) |
| ….data.next_1_hours.details.precipitation_amount | mm of precipitation |
| Expires header | Do not re-request before this time |
Common errors
| 403 Forbidden | Missing or fake User-Agent — the number-one mistake. |
| 422 | Coordinates too precise — round to 4 decimal places. |
| 429 | Polling too fast — add caching and slow down. |
| 203 | Deprecation warning — you are calling an old product version. |
When to use it (and alternatives)
Excellent free global forecasts for apps that respect the rules (identify yourself, cache). For a no-headers, CORS-friendly option use Open-Meteo; for the US, weather.gov is authoritative.
FAQ
Why am I getting a 403?
You did not send an identifying User-Agent, or you sent a generic one like python-requests/2.x. Include your app name and a contact address; this is a firm requirement, not a suggestion.
How often can I call it?
As often as the data updates — roughly hourly. Cache each location’s response until the Expires header and use If-Modified-Since to get cheap 304s.
What is the difference between 'compact' and 'complete'?
compact returns the common parameters; complete adds probabilities, radiation and more. Use compact unless you need the extras.
New to APIs?
Short guides for working with this API — and any other.