Met.no API Endpoints: Weather Data Access
The Norwegian Meteorological Institute's public API at api.met.no is one of the most useful free weather data sources available — no API key required, global coordinate coverage for most endpoints, generous usage terms, and genuinely high-quality forecast data for Norway and Northern Europe. It is also occasionally misconfigured by developers who miss the User-Agent requirement, misread the coordinate format, or hit undocumented rate limits. This page covers the key endpoints, the locationforecast response structure, the terms of use (including the User-Agent rule that gets requests blocked), and practical integration notes from direct API use. The broader developer notes section covers related API integration work. For DNS-level API infrastructure considerations, DNS SRV record usage is adjacent reference material.
API overview and terms
The MET Norway API is free to use under the Norwegian Licence for Open Government Data (NLOD) and Creative Commons Attribution 4.0. There is no API key or registration requirement. The mandatory condition is a descriptive User-Agent header on every request, formatted as AppName/version contact@email.com or similar. Requests with missing or generic User-Agent values (including default library user agents like python-requests/2.x) are rate-limited or blocked. This is enforced in practice, not just in policy.
The API covers weather data for any geographic coordinate globally for the general forecast endpoints, with higher-resolution nowcast data available for Norway only. All responses are JSON. There are no tiered pricing plans or premium data features — what's in the public API is what's available.
Key endpoints
locationforecast/2.0
The primary endpoint for general weather forecasts. Takes latitude and longitude, returns hourly forecast data for approximately 10 days.
# Required: descriptive User-Agent with contact information
curl -H "User-Agent: MyWeatherApp/1.0 developer@example.com" \
"https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=59.9139&lon=10.7522"
# 'compact' variant returns a smaller subset of properties
# 'complete' variant returns all available data including more detail
The response contains a timeseries array of hourly data points, each with instant observations (current-moment values) and forecast summaries for the next 1, 6, and 12 hours. The 6-hour and 12-hour summary blocks include precipitation amounts, which are not available in the instant block.
{
"type": "Feature",
"geometry": { "type": "Point", "coordinates": [10.7522, 59.9139, 17] },
"properties": {
"meta": {
"updated_at": "2025-03-13T06:00:00Z",
"units": { "air_temperature": "celsius", "wind_speed": "m/s", ... }
},
"timeseries": [
{
"time": "2025-03-13T07:00:00Z",
"data": {
"instant": {
"details": {
"air_temperature": 4.2,
"wind_speed": 3.1,
"relative_humidity": 78.5,
"cloud_area_fraction": 56.0
}
},
"next_1_hours": {
"summary": { "symbol_code": "partlycloudy_day" },
"details": { "precipitation_amount": 0.0 }
}
}
}
]
}
}
nowcast/2.0
Short-range precipitation nowcast for Norway, using radar data. Provides very high temporal resolution (5-minute intervals) and high spatial resolution but covers only Norwegian territory.
sunrise/3.0
Sunrise, sunset, solar noon, and twilight times. Takes coordinates and a date parameter. Useful for augmenting weather data with daylight context without separately calculating sun position geometry.
curl -H "User-Agent: MyWeatherApp/1.0 developer@example.com" \
"https://api.met.no/weatherapi/sunrise/3.0/sun?lat=59.9139&lon=10.7522&date=2025-03-13&offset=%2B01:00"
oceanforecast/2.0
Wave height, water temperature, and ocean current data for Norwegian coastal waters. Coverage is limited to Norwegian marine areas. Useful for maritime applications but not relevant for general weather use cases.
Caching and the If-Modified-Since header
The locationforecast API updates on a schedule — typically every hour or less frequently depending on the forecast model run times. Making requests more frequently than the update interval returns identical data and counts against undocumented usage limits. The API includes Expires and Last-Modified headers in responses. Implementing conditional GET requests using If-Modified-Since reduces both API load and response size: a 304 Not Modified response is returned when the data has not changed, avoiding transfer of the full JSON payload.
# Store the Last-Modified value from a prior response:
LAST_MOD="Thu, 13 Mar 2025 06:00:00 GMT"
curl -H "User-Agent: MyWeatherApp/1.0 developer@example.com" \
-H "If-Modified-Since: $LAST_MOD" \
"https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=59.9139&lon=10.7522"
# Returns 304 if data unchanged, 200 with new data if updated
Common problems
The most common block reason is a missing or generic User-Agent. The API's Terms of Service require a User-Agent that includes an application name and a contact address or URL. Requests from python-requests/2.28.0, curl/7.88.1, or similar generic strings get throttled or blocked. The fix is trivial — add a custom User-Agent string — but the block response is not obviously informative, which leads to debugging the wrong things first.
Coordinate precision matters. The API uses WGS84 coordinates. Providing coordinates with more than 4 decimal places is unnecessary (sub-metre precision is far beyond forecast grid resolution) and some older API versions silently truncated to 4 decimal places before grid lookup. Using 4 decimal places consistently avoids any edge cases. The coordinate order in the URL query string is lat then lon — opposite to the GeoJSON convention used in the response geometry, which is lon then lat.
The locationforecast API moved from version 1.9 to 2.0 in 2020. The v1.9 XML-based endpoint was retired. Version 2.0 uses JSON throughout and changed the data structure substantially — applications built for the v1.9 XML format require full reimplementation, not a simple format conversion. If existing code uses XML parsing for Met.no data, it is targeting the retired endpoint.
Practical integration notes
Weather symbols in the API use string codes like clearsky_day, lightrainshowers_night, heavysnow. Met Norway provides icon sets matching these codes under the same open licence. Mapping symbol codes to human-readable descriptions requires maintaining a lookup table; the codes are self-descriptive but not guaranteed to be stable across API versions.
Altitude matters for forecast accuracy in mountainous terrain. The locationforecast endpoint accepts an optional altitude parameter in metres. Providing the actual elevation of a location significantly improves forecast accuracy for mountain locations compared to using sea-level default interpolation.