smhi.se APIsmhi.se ↗
Access SMHI weather forecasts, current conditions, observations, and active warnings for any Swedish location. 5 endpoints covering 10-day hourly data.
curl -X GET 'https://api.parse.bot/scraper/59cbac26-14c5-46e0-8e23-da063f04e411/search_locations?query=Stockholm' \ -H 'X-API-Key: $PARSE_API_KEY'
Search for locations in Sweden by name. Returns a list of matching places with geonameid, coordinates, and administrative metadata. Results include nearby cities for larger metro areas.
| Param | Type | Description |
|---|---|---|
| queryrequired | string | The city or place name to search for (e.g. 'Stockholm', 'Göteborg'). |
{
"type": "object",
"fields": {
"data": "array of location objects with geonameid, place, lat, lon, type, municipality, county, country, district, population",
"status": "string, always 'success'"
},
"sample": {
"data": [
{
"lat": 59.3294681359869,
"lon": 18.0626392364502,
"type": [
"PPLC"
],
"place": "Stockholm",
"county": "Stockholms län",
"country": "Sverige",
"district": "Stockholms domkyrkodistrikt",
"timezone": "Europe/Stockholm",
"geonameid": 2673730,
"population": 1253309,
"municipality": "Stockholm"
}
],
"status": "success"
}
}About the smhi.se API
The SMHI API provides 5 endpoints for retrieving meteorological data across Sweden, including 10-day hourly forecasts, current conditions, MESAN model observations, and active weather warnings. The get_forecast endpoint alone returns three levels of forecast breakdown — 10-day, 24-hour, and 6-hour — along with temperature, precipitation, wind, and weather symbol codes. Location lookup is handled by search_locations, which returns geonameids needed by all other endpoints.
Location Search and Identifiers
All forecast and observation endpoints require a geonameid, which you obtain from search_locations. Pass a Swedish place name as the query parameter and you get back an array of matching locations, each with geonameid, lat, lon, municipality, county, district, and population. Larger metro areas also include nearby cities in the result set. Hold on to the geonameid — every other endpoint in this API is keyed off it.
Forecast and Current Conditions
get_forecast accepts a geonameid and returns a data object with a place metadata block plus three forecast arrays: forecast10d (hourly data for the next 10 days), forecast24h (24-hour summaries), and a 6-hour breakdown. Each forecast entry carries temperature, precipitation, wind fields, and wSymb2 weather symbol codes. get_current_weather returns a lighter response focused on the next hour: t (temperature in Celsius), wSymb2, refTime (ISO reference timestamp), and place metadata — useful for dashboards that only need a single current reading.
Observations and Warnings
get_analysis returns MESAN model analysis data — gridded observational output rather than a forecast. The response includes approvedTime, referenceTime, and a days array with hourly measurements covering temperature, wind, humidity, and visibility for recent hours. This is the right endpoint when you need what actually happened rather than what was predicted.
get_warnings takes no parameters and returns all currently active weather warnings across Sweden. Each warning object includes warningLevel, eventDescription, affectedAreas, approximateStart, approximateEnd, geographic polygons, and descriptions in both Swedish and English. If no warnings are active the array is empty.
- Display a 10-day hourly weather widget for any Swedish city using
get_forecasttemperature and precipitation fields - Trigger alerts in a logistics app when
get_warningsreturns warnings with highwarningLevelvalues - Show real-time temperature and weather symbol on a transit or event app using
get_current_weather - Compare MESAN model observations against forecast data to validate prediction accuracy over past hours
- Build a location autocomplete for Swedish places backed by
search_locationsresults including municipality and county metadata - Render warning area polygons on a map using the geographic data returned by
get_warnings - Power a climate monitoring dashboard using humidity and visibility fields from
get_analysis
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 250 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does SMHI have an official developer API?+
What does `get_analysis` return that `get_forecast` does not?+
get_analysis returns MESAN model output — observed and analyzed weather measurements for recent hours, including humidity and visibility alongside temperature and wind. get_forecast is forward-looking, covering the next 10 days. The approvedTime and referenceTime fields in get_analysis let you know exactly when the observational run was approved and what reference period it covers.Does the API cover locations outside Sweden?+
search_locations is scoped to Swedish places and returns Swedish administrative metadata (municipality, county). No non-Swedish locations are exposed. You can fork this API on Parse and revise it to add coverage from another source if you need Nordic or European locations.Can I retrieve historical weather data through this API?+
get_current_weather), the 10-day forward forecast (get_forecast), recent observational hours (get_analysis), and active warnings (get_warnings). Long-range historical climate records are not exposed. You can fork this API on Parse and revise it to add a historical data endpoint pointing at SMHI's open data archive.How fresh is the data returned by `get_warnings`?+
approximateStart and approximateEnd ISO timestamps. If no warnings are currently active the array returned is empty. There is no pagination — all active warnings for all of Sweden are returned in a single response.