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 Servers
- Production: https://forvaltningsdatabasen-api.sikt.no
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).
| Method | Path | Description |
|---|---|---|
| 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.
| Method | Path | Description |
|---|---|---|
| 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/endringerperaar | Number of units established and dissolved per year |
| GET | /api/v1/enheter/antall-endringer-per-aar | Number 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/enheterperaartilknytning | Number of active units per year grouped by type of affiliation |
| GET | /api/v1/enheter/eval/fylkedata | Number 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.
| Method | Path | Description |
|---|---|---|
| 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}/endringshistorie | Complete change history incl. parliamentary cases and relations |
| GET | /api/v1/enheter/{idnum}/ansatte | Yearly employee statistics for a unit |
| GET | /api/v1/enheter/{idnum}/tildelingsbrev | Allocation 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/jsonExample 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/jsonExample 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/jsonExample 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/jsonExample 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/jsonExample 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/jsonExample 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/jsonExample 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/jsonExample 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"
}
]