Kela’s Info TraySkip to content

Examples for using open data

The data are made available as datasets on Each dataset consists of the data in .csv format and metadata in .json format. The data can be used manually for example in Excel files or programmatically with various programming languages.

Manual use of the data

Both the data and the metadata can be downloaded by clicking on the Downlink link on the front page for the dataset. The data can be imported into Excel or some other program. The data are separated with commas, and the character encoding used is UTF-8.

Programmatic use of the data

The open data is machine readable. offers various alternatives for reading the data.

The following examples involve looking up data on labour market subsidy payments partially funded by the municipalities.

Accessing machine-readable data directly

The functions available in the ckanr ( in a new tab) library and in the ckanapi ( (Opens in a new tab)library can be used to read data from directly.

Example using R:


# Define CKAN
ckanr_setup(url = "")

# Look up all Kela datasets
x <- package_search(q = "Kela (Kansaneläkelaitos)")

# Retrieve the resources for the first dataset
resources <- x$results[[1]]$resources

# Download the data
dat <- read_csv(resources[[1]]$url)

# Download the metadata
meta <- fromJSON(txt = resources[[2]]$url)

Using the DataStore interface to retrieve data with an SQL search

The R library at ckanr ( (Opens in a new tab)also includes functions for performing a query using the DataStore interface. When using Python, the urllib ( in a new tab) library must be used.

Example using R:


# Define CKAN
ckanr_setup(url = "")

# Look up the correct dataset whose title ends with the word ‘kunnittain’ (by municipality)
x <- package_search(q = "Kela (Kansaneläkelaitos)", fq = "title:kunnittain$")

# Look up the data ID for the dataset
ID <- x$results[[1]]$resources[[1]]$id

# Look up the total amount of labour market subsidies paid over a period of one year in Helsinki and the number of beneficiaries
res <- ckanr::ds_search_sql(
   sql = glue("
         sum(maksettu_eur) as sum_maksettu_eur,
         sum(saaja_lkm) as sum_saaja_lkm
      FROM \"{ID}\"
      WHERE kunta_nimi = 'Helsinki'
         AND aikatyyppi = 'Kuukausi'
         AND tyomarkkinatukipaiva_luokka = 'Yhteensä'
      GROUP BY vuosikuukausi, kunta_nimi"),
   as = "table")

# equivalent to the following report:

Share this article

Share page to Twitter Share page to Facebook Share page to LinkedIn