Skip to main content

PxWeb API instructions

Through the PxWeb API (Application Programming Interface) of the Natural Resources Institute Finland's Statistics database, it is possible to retrieve information in machine-readable formats, for example in xlsx, csv, json, json-stat, sdmx and px (PC-Axis) formats. 

The corresponding PxWeb API is also in use

Statistics Finland: https://pxdata.stat.fi/PxWeb/pxweb/en/StatFin/

Statistics Sweden: https://www.statistikdatabasen.scb.se/pxweb/en/ssd/

Using PxWeb API

Go to Luke's Statistics database page https://statdb.luke.fi/PXWeb/pxweb/fi/LUKE/ .

Select the subject area and database table you want to use. You can select a table by clicking on its title in the menu.

The image above shows "Egg Production" statistic as an example.

"Search in Statistics database" allows you to search for statistical tables based on the table names.

Creating a table

Clicking on the title of the statistics table opens a view where it is possible to create filtered statistics tables and graphs based on the tables. Make the necessary filters and click "Show table".

"Compact view" feature changes the layout of the selection boxes to a more compact list view.

Example case

In this case, the table "Egg production monthly (kg)" is used as an example. Using filtering, the production volumes of A and B quality class eggs for the year 2025 are searched.

Selections can be made either with the mouse or by using the buttons in the selection box. Once the selections are made, the user presses the "Show table" button. The statistics database then creates a table of the selected variables.

Table footnotes can be viewed at the bottom of the page.

API

The results of the query are displayed on "Show results" page. There the user can view, edit and save the results as various tables and images, as well as files and links. 

At the bottom of the page, after the table, there is a section "API query for this table", where the API interface can be found.

Clicking “API query for this table” will open the API section, which includes a URL and a JSON query code. These provide a machine-readable connection to the created database table.

The API-information generated by the database search in the example is as follows:

URL: https://statdb.luke.fi:443/PxWeb/api/v1/en/LUKE/maa/kanmun/0100_kanmun.px

JSON query: 

{
 "query": [
   {
     "code": "M",
     "selection": {
       "filter": "item",
       "values": [
         "2025M01",
         "2025M02",
         "2025M03",
         "2025M04",
         "2025M05",
         "2025M06",
         "2025M07",
         "2025M08",
         "2025M09",
         "2025M10",
         "2025M11",
         "2025M12"
       ]
     }
   },
   {
     "code": "LLUOKK_TUOTT",
     "selection": {
       "filter": "item",
       "values": [ "A_YHT", "B_YHT", "AB_YHT" ]
     }
   }
 ],
 "response": {
   "format": "px"
 }
}

Example 2

Stumpage prices of roundwood by week -statistic:  https://statdb.luke.fi/PxWeb/pxweb/en/LUKE/LUKE__met__metryv/0100_metryv.px 

The search shown in the image above returns the URL and QUERY corresponding to the search from PxWeb's API. The corresponding JSON query is sent to the resulting URL (below) using the POST method.

https://statdb.luke.fi:443/PxWeb/api/v1/en/LUKE/met/metryv/0100_metryv.px 

NOTE! Running only the URL in a browser will return the metadata for that px table.

{
 "query": [
   {
     "code": "W",
     "selection": {
       "filter": "item",
       "values": [
         "2026W21",
         "2026W22",
         "2026W23",
         "2026W24"
       ]
     }
   },
   {
     "code": "MPKH",
     "selection": {
       "filter": "item",
       "values": [
         "1",
         "3"
       ]
     }
   },
   {
     "code": "HAKT",
     "selection": {
       "filter": "item",
       "values": [
         "0"
       ]
     }
   },
   {
     "code": "PTL",
     "selection": {
       "filter": "item",
       "values": [ "N1", "N2", "N3" ]
     }
   }
 ],
 "response": {
   "format": "px"
 }
}

In addition to px, you can choose json, json-stat, xlsx or csv as the result format. The result format is selected in the query under "response": {"format": "XXX"}.

By leaving out the classifier (Price region / Felling method / Roundwood assortment) from the query, all its values ​​are included in the result. 

The information for the latest week can be obtained by selecting: "filter": "top", "values": ["1"] (or the desired number of weeks) and all weeks of 2025 can be obtained by selecting: "filter": "all", "values": ["2025*"].

Testing the interface

The operation of the interface can be tested using:

the Postman application, https://www.postman.com or 

with the Firefox browser's RESTClient extension, http://restclient.net.

API use case

The images on Luke’s statistics website have been implemented via the PxWeb API interface.

For example, weekly monitoring of roundwood trade produced by the Finnish Forest Industries Federation is found from the page: 

https://www.luke.fi/en/statistics/weekly-monitoring-of-roundwood-trade/weekly-monitoring-of-roundwood-trade  (image below)

The image is actually an html link that opens in an iframe on the page, 

statdb.luke.fi/charts/pages/charts/metsa/puukaupan_viikkoseuranta_01.html?lang=en

The image is reloaded every time the page is opened or updated. And when the database is updated, the image is automatically updated. All images on Luke’s statistics website have been created using JavaScript, but the data obtained via the interface can be utilized with many other technologies such as R, Java or Python.

More information about using the PxWeb API can be found at Statistics Sweden: 

https://www.scb.se/en/services/oppna-data/api-for-the-statistical-database/