How to Get Swedish Weather Data via API

Published · 5 min read

SMHI (Swedish Meteorological and Hydrological Institute) provides free weather data through their open API. But working with it directly means dealing with coordinate-based lookups, cryptic parameter codes, and deeply nested JSON structures.

This guide shows you how to get Swedish weather data the easy way — with a single API call that returns clean, developer-friendly JSON.

The Problem with SMHI's Raw API

SMHI's meteorological forecast API (opendata-download-metfcst) requires you to:

  1. Know exact GPS coordinates — there's no city name lookup. You need to convert "Stockholm" to lat=59.33&lon=18.07 yourself.
  2. Decode parameter codes — temperature is t, wind speed is ws, precipitation is pmean. There are 30+ parameters with non-obvious names.
  3. Parse nested time series — the response is a flat array of timesteps, each containing an array of parameter objects. No summary, no daily aggregation.

Raw SMHI API call

Request
curl "https://opendata-download-metfcst.smhi.se/api/category/pmp3g/version/2/geotype/point/lon/18.07/lat/59.33/data.json"
Response (abbreviated — actual response is 200KB+)
{
  "approvedTime": "2026-03-12T14:00:00Z",
  "referenceTime": "2026-03-12T12:00:00Z",
  "geometry": { "type": "Point", "coordinates": [[18.07, 59.33]] },
  "timeSeries": [
    {
      "validTime": "2026-03-12T15:00:00Z",
      "parameters": [
        { "name": "t", "levelType": "hl", "level": 2, "unit": "Cel", "values": [4.2] },
        { "name": "ws", "levelType": "hl", "level": 10, "unit": "m/s", "values": [3.1] },
        { "name": "pmean", "levelType": "hl", "level": 0, "unit": "kg/m2/h", "values": [0.0] },
        { "name": "Wsymb2", "levelType": "hl", "level": 0, "unit": "category", "values": [3] }
        // ... 20+ more parameters
      ]
    }
    // ... 100+ more timesteps
  ]
}

To get "What's the temperature in Stockholm?" you need to: find the right coordinates → make the request → loop through timeSeries → find the parameter where name === "t" → extract values[0]. That's a lot of boilerplate for a simple question.

The Apiverket Way

SMHI Direct

// 1. Geocode city name somehow
const lat = 59.33, lon = 18.07;

// 2. Fetch raw SMHI data
const res = await fetch(
  `https://opendata-download-metfcst
  .smhi.se/api/category/pmp3g
  /version/2/geotype/point
  /lon/${lon}/lat/${lat}
  /data.json`
);

// 3. Parse cryptic response
const data = await res.json();
const now = data.timeSeries[0];
const temp = now.parameters
  .find(p => p.name === "t")
  .values[0];

Apiverket

const res = await fetch(
  "https://apiverket.se/v1/weather" +
  "/Stockholm/forecast",
  {
    headers: {
      Authorization:
        "Bearer sk_live_YOUR_KEY"
    }
  }
);

const { data } = await res.json();
// data.current.temperature = 4.2
// data.current.description = "Partly cloudy"
// data.forecast = [{day, high, low, ...}]

One line vs. twenty. Apiverket handles geocoding, parameter mapping, and response formatting. You get city-name lookup, human-readable descriptions, and daily forecast summaries out of the box.

What You Get

The /v1/weather/{city}/forecast endpoint returns:

Example response

{
  "meta": {
    "request_id": "req_abc123",
    "api_version": "2026-02-15",
    "mode": "live",
    "sources": [{
      "agency": "smhi",
      "fetched_at": "2026-03-12T14:30:00Z",
      "cache_ttl": 600,
      "freshness": "live"
    }]
  },
  "data": {
    "city": "Stockholm",
    "coordinates": { "lat": 59.33, "lon": 18.07 },
    "current": {
      "temperature": 4.2,
      "feels_like": 1.8,
      "humidity": 72,
      "wind_speed": 3.1,
      "wind_direction": "SW",
      "description": "Partly cloudy",
      "symbol": 3
    },
    "forecast": [
      {
        "date": "2026-03-12",
        "high": 6.1,
        "low": 1.3,
        "precipitation_mm": 0.0,
        "description": "Partly cloudy"
      }
      // ... 9 more days
    ]
  }
}

Available Weather Endpoints

Endpoint Description
/v1/weather/{city}/forecast10-day forecast for any Swedish city
/v1/weather/{city}/currentCurrent conditions with observations
/v1/weather/alertsActive SMHI weather warnings
/v1/weather/forecast?lat=X&lon=YForecast by GPS coordinates

Try It Now

You can test with the sandbox key immediately — no signup needed:

curl -H "Authorization: Bearer sk_test_demo123" \
  https://apiverket.se/v1/weather/Stockholm/forecast

Test mode returns realistic sandbox data. When you're ready for live data, sign up for free and get a sk_live_ key with 200 requests per day.

Ready to build with Swedish weather data?

Get started in 30 seconds. No signup required for test mode.

Explore the API Docs

View pricing plans — free tier includes 200 requests/day