Skip to content

API Documentation for the Civil Service Database

REST API for programmatic access to data on units, employees and organisational changes in the Norwegian state administration.

API Documentation (Swagger UI)

Authentication

Some endpoints (marked with πŸ”’) require a Bearer token from AWS Cognito. Contact Forvaltningsdatabasen to obtain a clientId and clientSecret.

Step 1 – Fetch token

Make the following HTTP request to obtain an access token (valid for 1 hour):

curl -X POST https://eu-north-1w9zgiivaq.auth.eu-north-1.amazoncognito.com/oauth2/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials&client_id=<CLIENT_ID>&client_secret=<CLIENT_SECRET>&scope=default-m2m-resource-server-5jjsi0/read"

The response contains the access_token:

{
  "access_token": "eyJraWQiOiJH...",
  "token_type": "Bearer",
  "expires_in": 3600
}

Step 2 – Use the token in API calls

Include the token in the Authorization header:

curl https://forvaltningsdatabasen-api.sikt.no/api/v1/enheter/eval/enheteraar?y=2023 \
  -H "Authorization: Bearer eyJraWQiOiJH..."

In Swagger UI: click Authorize at the top of the page and paste only the token string (without the "Bearer " prefix).

API Endpoints

Units – bulk download πŸ”’

Machine-readable bulk exports intended for researchers and analysts who want to download the full dataset. All endpoints here require authentication (Bearer token from AWS Cognito).

Endpoints for machine-readable bulk export – requires Bearer token
MethodPathDescription
GET/api/v1/enheter/eval/enheteraar?y={year} πŸ”’All units active in a given year with attributes at year-end
GET/api/v1/enheter/eval/enheterkomplett πŸ”’All units with complete change history
GET/api/v1/enheter/eval/endringsrader πŸ”’All change rows – raw database records with change-code description and relations

Statistics

Aggregated data used by the statistics pages on forvaltningsdatabasen.sikt.no. Returns summarised figures per year, county, type of affiliation and ministry. These endpoints are open and do not require authentication.

Open statistics endpoints
MethodPathDescription
GET/api/v1/enheter/eval/departementer-med-struktur?y={year}Ministries with count of internal units and external agencies for a given year
GET/api/v1/enheter/eval/endringerperaarNumber of units established and dissolved per year
GET/api/v1/enheter/antall-endringer-per-aarNumber of units established and dissolved per year, excluding local offices, groups and units within the ministries (used by the statistics page)
GET/api/v1/enheter/eval/antall-per-grunnenhet?y={year}Number of active units per basic unit type on 1 January of a given year
GET/api/v1/enheter/eval/enheter-per-grunnenhet?y={year}&g={codes}Active units with the selected basic unit types (e.g. g=21,31) on 1 January of a given year
GET/api/v1/enheter/eval/enheterperaartilknytningNumber of active units per year grouped by type of affiliation
GET/api/v1/enheter/eval/fylkedataNumber of units per county and year
GET/api/v1/enheter/eval/fylkedetaljer?y={year}&fnr={county}Units in a specific county for a given year
GET/api/v1/enheter/eval/enheterperkommune?y={year}Number of units per municipality for a given year
GET/api/v1/enheter/eval/enheterperFylke?y={year}Number of units per county for a given year

Units (Enheter)

Search and detail lookups for individual units. These endpoints are open and do not require authentication.

Endpoints for units
MethodPathDescription
GET/api/v1/enheter?q={query}Search units by name or short name
GET/api/v1/enheter/{idnum}Full detail view of one unit
GET/api/v1/enheter/{idnum}/endringshistorieComplete change history incl. parliamentary cases and relations
GET/api/v1/enheter/{idnum}/ansatteYearly employee statistics for a unit
GET/api/v1/enheter/{idnum}/tildelingsbrevAllocation letters (tildelingsbrev) for a unit

Examples

All units active in a given year πŸ”’

Fetch all units that were active at any point during 2023 (requires Bearer token):

curl https://forvaltningsdatabasen-api.sikt.no/api/v1/enheter/eval/enheteraar?y=2023 \
  -H "Authorization: Bearer eyJraWQiOiJH..."
Accept: application/json

Example response:

[
  {
    "idnum": 100,
    "langtNavn": "Statsministerens kontor",
    "kortNavn": "SMK",
    "tilknytningsformKode": 10,
    "tilknytningsform": "Ministry",
    "grunntype": 0,
    "grunntypeNavn": "Ministry",
    "overordnetIdnum": null,
    "overordnetLangtNavn": null,
    "overordnetKortNavn": null
  },
  {
    "idnum": 5678,
    "langtNavn": "Direktoratet for hΓΈyere utdanning og kompetanse",
    "kortNavn": "HK-dir",
    "tilknytningsformKode": 33,
    "tilknytningsform": "Ordinary civil service organisation",
    "grunntype": 1,
    "grunntypeNavn": "National single body",
    "overordnetIdnum": 605,
    "overordnetLangtNavn": "Ministry of Education and Research",
    "overordnetKortNavn": "KD"
  }
]

Complete change history for all units πŸ”’

Fetch all units with their full change history (requires Bearer token):

curl https://forvaltningsdatabasen-api.sikt.no/api/v1/enheter/eval/enheterkomplett \
  -H "Authorization: Bearer eyJraWQiOiJH..."
Accept: application/json

Example response (abbreviated):

[
  {
    "idnum": 1234,
    "endringer": [
      {
        "endringskode": 101,
        "dato": "2008-01-01",
        "langtNavn": "Direktoratet for forvaltning og IKT",
        "kortNavn": "Difi",
        "tilknytningsformKode": 33,
        "tilknytningsform": "Ordinary civil service organisation",
        "overordnetIdnum": 610,
        "overordnetLangtNavn": "Ministry of Local Government and Modernisation",
        "overordnetKortNavn": "KMD",
        "relasjoner": null
      },
      {
        "endringskode": 306,
        "dato": "2020-01-01",
        "relasjoner": [9999]
      }
    ]
  }
]

Raw data – all change rows πŸ”’

Fetch all rows directly from the database, enriched with the change-code description and relations (requires Bearer token). The field idnumEndringRef is interpreted depending on the change code – e.g. for code 304 (Dissolved via splitting) it lists the units the dissolved unit was split into.

curl https://forvaltningsdatabasen-api.sikt.no/api/v1/enheter/eval/endringsrader \
  -H "Authorization: Bearer eyJraWQiOiJH..."
Accept: application/json

Example response (abbreviated):

[
  {
    "id": 1,
    "idnum": 100,
    "tekstEntall": "Ny enhet",
    "endringskode": 101,
    "tidspunkt": "1939-10-01",
    "kortNavn": "SMK",
    "langtNavn": "Statsministerens kontor",
    "engLangtNavn": "Office of the Prime Minister",
    "tilknytningsform": 10,
    "overordnetIdnum": -500
  },
  {
    "id": 4035,
    "idnum": 3500,
    "tekstEntall": "Nedlagt via splitting",
    "endringskode": 304,
    "tidspunkt": "2020-01-01",
    "idnumEndringRef": [4035, 4036],
    "kortNavn": "Difi",
    "langtNavn": "Direktoratet for forvaltning og IKT",
    "overordnetIdnum": 610
  }
]

Search units

Search for units with names containing "direktorat":

GET /api/v1/enheter?q=direktorat
Host: forvaltningsdatabasen-api.sikt.no
Accept: application/json

Example response:

[
  {
    "idnum": 1234,
    "navn": "Direktoratet for forvaltning og IKT",
    "kortNavn": "Difi",
    "tilknytningsformKode": 33,
    "tilknytningsform": "Ordinary civil service organisation",
    "opprettetAar": 2008,
    "nedlagtAar": 2020
  },
  {
    "idnum": 5678,
    "navn": "Direktoratet for hΓΈyere utdanning og kompetanse",
    "kortNavn": "HK-dir",
    "tilknytningsformKode": 33,
    "tilknytningsform": "Ordinary civil service organisation",
    "opprettetAar": 2021,
    "nedlagtAar": null
  }
]

Fetch unit by ID

GET /api/v1/enheter/1234
Host: forvaltningsdatabasen-api.sikt.no
Accept: application/json

Example response:

{
  "idnum": 1234,
  "navn": "Direktoratet for forvaltning og IKT",
  "kortNavn": "Difi",
  "tilknytningsformKode": 33,
  "tilknytningsform": "Ordinary civil service organisation",
  "gruntypeKode": 1,
  "grunntype": "National single body",
  "niva": 0,
  "overordnetIdnum": 610,
  "overordnetNavn": "Ministry of Local Government and Modernisation",
  "opprettetAar": 2008,
  "opprettetMaaned": 1,
  "nedlagtAar": 2020,
  "nedlagtMaaned": 1,
  "organisasjonsnummer": "985986217",
  "telefon": "+47 22 45 10 00",
  "postadresse": "P.O. Box 8115 Dep, 0032 Oslo",
  "nettside": "https://www.difi.no"
}

Change history

GET /api/v1/enheter/1234/endringshistorie
Host: forvaltningsdatabasen-api.sikt.no
Accept: application/json

Example response:

[
  {
    "id": 98001,
    "aar": 2008,
    "maaned": 1,
    "endringskode": 101,
    "endringsbeskrivelse": "Pure founding",
    "merknad": "Established by royal decree",
    "relatertIdnum": null,
    "relatertNavn": null
  },
  {
    "id": 98002,
    "aar": 2020,
    "maaned": 1,
    "endringskode": 306,
    "endringsbeskrivelse": "Terminated by merger",
    "merknad": "Merged with Uninett and Unit to form Sikt",
    "relatertIdnum": 9999,
    "relatertNavn": "Sikt – Norwegian Agency for Shared Services in Education and Research"
  }
]

Employees (yearly statistics)

GET /api/v1/enheter/1234/ansatte
Host: forvaltningsdatabasen-api.sikt.no
Accept: application/json

Example response:

[
  {
    "aar": 2019,
    "antallAnsatte": 312,
    "antallKvinner": 187,
    "antallMenn": 125
  },
  {
    "aar": 2018,
    "antallAnsatte": 298,
    "antallKvinner": 179,
    "antallMenn": 119
  }
]

Allocation letters

GET /api/v1/enheter/1234/tildelingsbrev
Host: forvaltningsdatabasen-api.sikt.no
Accept: application/json

Example response:

[
  {
    "id": 4401,
    "aar": 2019,
    "tittel": "Allocation letter 2019 – Direktoratet for forvaltning og IKT",
    "url": "https://www.regjeringen.no/contentassets/.../tildelingsbrev-difi-2019.pdf"
  },
  {
    "id": 4402,
    "aar": 2018,
    "tittel": "Allocation letter 2018 – Direktoratet for forvaltning og IKT",
    "url": "https://www.regjeringen.no/contentassets/.../tildelingsbrev-difi-2018.pdf"
  }
]

Hello! We would like to know for what purpose you use the website: