How to Get Swedish Weather Data via API

Published · 5 min read

SMHI gives you excellent weather data. The hard part is using it in an app. You have to work with coordinate-based lookups, short parameter codes, and deeply nested JSON before you get to the actual forecast.

This guide shows the shorter path: one API call, city-name lookup, and JSON shaped for the thing you are building.

The Problem with SMHI's Raw API

SMHI's meteorological forecast API (opendata-download-metfcst) asks you to do a few chores first:

  1. Find exact GPS coordinates — there is no city-name lookup. "Stockholm" has to become lat=59.33&lon=18.07 before you call the API.
  2. Translate parameter codes — temperature is t, wind speed is ws, precipitation is pmean. There are 30+ of these.
  3. Walk the time series — each timestep has its own parameter array. No ready-made current summary. No daily view.

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
  ]
}

So a simple question like "what is the temperature in Stockholm?" turns into a small parsing project: coordinates, request, timeSeries, parameter lookup, then values[0].

A lot of work for one number.

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 request instead of a parsing project. Apiverket handles geocoding, parameter mapping, and response formatting. You get city-name lookup, readable descriptions, and daily forecast summaries.

What You Get

Call /v1/weather/{city}/forecast and you get the pieces most apps need:

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 try it with the sandbox key now. No signup needed.

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

Test mode returns sandbox data with the same shape as live responses. When you want live SMHI data, sign up for free and use a sk_live_ key.

Build with Swedish weather data

Start in test mode first. Switch to live data when you are ready.

Open the API docs

View pricing plans — free tier includes 200 requests/day