---
title: "Which years one metric is published for"
method: GET
path: "/api/v1/variable-years"
tags: ["Metadata"]
---

# Which years one metric is published for

`GET /api/v1/variable-years`

## Request

- Base URL: `https://suomiatlas.com`
- URL: `https://suomiatlas.com/api/v1/variable-years`
- Auth: one of:
  - none
  - HTTP bearer

The years a metric has data for, **newest first**. Useful before asking for a year that does not exist. Also answers for crime rate codes and air-quality codes (`aq_*`): for those the years are the ones with served municipality data, and an unknown code answers an empty list. Free.

Example request: https://suomiatlas.com/api/v1/variable-years?variableCode=hr_mtu

## Query parameters

- `variableCode` string, required

## Response `200`

Years, newest first.

- VariableYears
  - `variableCode` string, required
  - `years` integer[], required: Newest first.
  - `scope` 'pks' | 'hr14': Absent for a national variable. Present when the variable exists only for this region (see `VariableMetadata.scope`); its values elsewhere are absent, not zero.

## Other responses

- `400`: A parameter was missing, malformed, or outside what this operation accepts. The message names the parameter.

---

[API](https://skmtc.dev/suomiatlas/apis/suomiatlas-read-api.md) · [All operations](https://skmtc.dev/suomiatlas/apis/suomiatlas-read-api/llms.txt) · [OpenAPI document](https://skmtc.dev/suomiatlas/apis/suomiatlas-read-api/revisions/b2627414938d?raw)
