Loading documentation...
This file documents all SSB PxWebApi tables used or relevant to HeatWaves, how the API works, and how each table relates to the fire-statistics data model.
Verified smoke request for table 12058: source-api-request-examples.md Dataset 10 (Oslo boligbranner; pinned response in .live_responses/). Implementations: ingest lib/data-model/adapters/ssb.ts, native read lib/data-model/native/, shared client lib/data-model/upstream/pxweb-table-12058.ts.
Endpoint: HeatWaves uses PxWebApi v0 only — POST https://data.ssb.no/api/v0/no/table/<id>.
Base URL: https://data.ssb.no/api/v0/no/table/<table-id>
GET https://data.ssb.no/api/v0/no/table/12058
Returns a JSON object with:
title — human-readable table titlevariables — array of dimensions, each with:
code — dimension identifier used in query bodiestext — human label for the dimensionvalues — array of option codes (e.g. municipality codes, year strings)valueTexts — human labels matching values 1-to-1POST https://data.ssb.no/api/v0/no/table/12058 Content-Type: application/json
{ "query": [ { "code": "<dimension-code>", "selection": { "filter": "<filter-type>", "values": ["<v1>", "<v2>"] } } ], "response": { "format": "json-stat2" } }
Selection filter types:
"item" — explicit list of codes; e.g. { "filter": "item", "values": ["0301"] }."all" — wildcard; { "filter": "all", "values": ["*"] } returns every available code."top" — most recent N values; { "filter": "top", "values": ["10"] } returns the 10 most recent years.Selection filter
"agg:KommFylker"returns HTTP 400 on v0. Use"item"with explicit region codes.
Response format — json-stat2:
dimension — object keyed by each requested dimension code; each has a .category.label map of code → human label.value — flat array of numbers in row-major order over the Cartesian product of all dimensions.updated — ISO timestamp of last data refresh.Omitted dimensions default to { "filter": "all" }. HeatWaves query bodies specify every dimension explicitly.
Stored region (table 12058): PxWeb KOKkommuneregion0000 selection → fact_yearly.region_code — see filter-axes-native-to-filter-id.md §4 and pipeline-slices-idempotency-and-triggers.md §4.3 (EAK → NULL; kommune item codes → matching filters.id).
SSB uses four-digit municipality codes as the primary level. County aggregates are available in some tables but their codes differ per table:
| Table | County-level selection |
|---|---|
| 12058 | National: EAK (Hele landet) on KOKkommuneregion0000. Municipalities: { "filter": "item", "values": ["0301", …] }. The dimension includes current and historical municipality codes; EAK is SSB’s published national aggregate. |
| 04914 | EAK = Landet (national), EAKUO = Landet uten Oslo. County aggregates use legacy two-digit codes (e.g. "01" = Østfold). |
| 06266 | "0" = Hele landet. County codes are the current two-digit system (e.g. "31" = Østfold). |
| 03173 | Same as 06266. |
| 03158 | Same as 06266. |
Oslo is represented as "0301" (municipality = county) in tables that use current codes, and as "0301" or "EAK/01" equivalents in legacy tables.
Title: Brann- og ulykkesvern - grunnlagstall og nøkkeltall, etter region, statistikkvariabel og år
Source: KOSTRA (municipal reporting to SSB)
HeatWaves use: Primary fire statistics table. Used in source-api-request-examples.md Dataset 10.
Confirmed endpoint: POST https://data.ssb.no/api/v0/no/table/12058
Dimensions:
| Dimension code | Label | Options | Notes |
|---|---|---|---|
KOKkommuneregion0000 | region | 891 | Municipality codes (current and historical) and EAK (Hele landet). HeatWaves uses EAK when no region filter is set; kommune breakdown uses explicit item codes. |
ContentsCode | statistikkvariabel | 34 | Fire and safety metrics — see variable list below. |
Tid | år | 11 | 2015–2025 |
Key ContentsCode values for HeatWaves:
| Code | Label | Unit |
|---|---|---|
KOSboligbranner0000 | Antall boligbranner | antall |
KOSboligbrprinnb0000 | Boligbranner per 1000 innbygger | antall |
KOSbygningsbrann0000 | Antall bygningsbranner | antall |
KOSbygningsbrpri0000 | Antall bygningsbranner per 1000 innbyggere | antall |
KOSerstatnbygnin0000 | Anslått erstatning for bygningsbranner | kr |
KOSerstbygbrprin0000 | Anslått erstatning til bygningsbranner pr. innbygger | kr |
KOSutrykningerto0000 | Antall utrykninger | antall |
KOSutrykntotprin0000 | Antall utrykninger per 1000 innbyggere | antall |
KOSpiper0000 | Antall piper | antall |
KOSandelpiperfei0000 | Andel piper feiet | prosent |
KOSaarsverkialtp0000 | Årsverk i brann- og ulykkesvern per 1000 innbyggere | årsverk |
KOSBDUtot0000 | Brutto driftsutgifter til funksjon 338+339, konsern | 1000 kr |
KOSBDU3380000 | Brutto driftsutgifter til funksjon 338 (forebygging) | 1000 kr |
KOSBDU3390000 | Brutto driftsutgifter til funksjon 339 (beredskap) | 1000 kr |
KOSNDUtot0000 | Netto driftsutgifter til funksjon 338+339 | 1000 kr |
KOSfeiingtilsyn0000 | Årsgebyr for feiing og tilsyn (ekskl. mva.) | kr |
Notes:
KOSboligbranner0000 and KOSbygningsbrann0000 are the two main fire-count series. KOSboligbranner0000 → RESIDENTIAL building_type filter (see filter-axes-native-to-filter-id.md §2). KOSbygningsbrann0000 is all building fires → stored on the building_type_code IS NULL total slice (no filter row); its cross-tab dimension-total category is ALL_BUILDINGS (dim 5) in category-native-to-cat-code.md.KOSerstatnbygnin0000 is the SSB-side equivalent of BRASK erstatningsbelop (value=kr). SSB reports estimated insurance replacement value sourced from insurance companies, not from BRASK directly — they share the same origin data but may differ slightly due to timing and methodology.Tid outside this set; Explore ingest clamps the URL year window — see clampSsbTable12058YearWindow in lib/data-model/upstream/pxweb-table-12058.ts).HeatWaves catalog split (table 12058):
| Path | dim_code | Storage | Code |
|---|---|---|---|
| Ingest (Explore + admin) | 5 Bygningstype | fact_yearly | lib/data-model/adapters/ssb.ts — cats 501 / 502 only |
| Native live read | 7 Nøkkeltall | none (is_native_only) | lib/data-model/native/ — remaining 34 ContentsCode variables (seed migration 20260602140000_ssb_native_catalog.sql) |
Explore (dim 7 only): The console Emne control sets URL param cat_standard (semantic group standard_code, e.g. GROSS_OPEX). Default FIRE_AND_COMPENSATION. Each group loads catalog rows sharing that standard_code via lib/data-model/ssb-nokkelgrupper.ts; upstream PxWeb still uses per-row native_name (ContentsCode). UX and URL rules: explore-fire-data-slice-probe-and-ingest.md (native-only branch).
Shared PxWeb client: lib/data-model/upstream/pxweb-table-12058.ts.
Working request body and pinned Oslo 2016–2025 totals: Dataset 10 in source-api-request-examples.md
Title: P. Brann- og ulykkesvern - nøkkeltall (K) etter region, statistikkvariabel og år
Source: KOSTRA (older series, "P" prefix = avsluttet/discontinued)
HeatWaves use: Not currently used. Relevant for historical continuity — this table covers 1999–2016, overlapping with 12058 from 2015.
Confirmed endpoint: POST https://data.ssb.no/api/v0/no/table/04914
Dimensions:
| Dimension code | Label | Options | Notes |
|---|---|---|---|
Region | region | 480 | Mix of legacy municipality codes (4-digit pre-2020) and national aggregates (EAK, EAKUO). |
ContentsCode | statistikkvariabel | 18 | Rate/share metrics only — no absolute counts. Variable codes are internal CRC hashes. |
Tid | år | 18 | 1999–2016 |
ContentsCode values (all per-capita rates and shares):
| Code | Label | Unit |
|---|---|---|
CRC1172570820 | Antall A-objekter | antall |
CRC3706540926 | Antall piper pr. innbygger | antall |
CRC1767885593 | Årsgebyr for feiing og tilsyn | kr |
CRC2884264936 | Anslått erstatning til bygningsbranner pr. innbygger | kr |
CRC3781029963 | Netto driftsutgifter til funksjon 338 pr. innbygger | kr |
CRC1116325597 | Netto driftsutgifter til funksjon 338 i prosent av 338+339 | prosent |
CRC56833651 | Årsverk til funksjon 338 pr. 1000 innbyggere | årsverk |
CRC2894571505 | Andel A-objekter som har fått tilsyn | prosent |
CRC1909992147 | Andel piper feiet | prosent |
CRC4245910964 | Andel personer med kompetanse som fører tilsyn | prosent |
CRC1945362332 | Årsverk av feier pr. 1000 innbyggere | årsverk |
CRC2020501240 | Antall bygningsbranner pr. 1000 innbyggere | antall |
CRC3859477339 | Antall utrykninger pr. 1000 innbyggere | antall |
CRC2130944737 | Netto driftsutgifter til funksjon 339 pr. innbygger | kr |
CRC3967106453 | Netto driftsutgifter pr. innbygger | kr |
CRC1757617042 | Årsverk til funksjon 339 pr. 1000 innbyggere | årsverk |
CRC794165238 | Årsverk i brann- og ulykkesvern pr. 1000 innbyggere | årsverk |
CRC3974555953 | Antall boligbranner pr. 1000 innbyggere | antall |
Notes:
Antall boligbranner — only the per-1000-innbygger rate. To recover absolute counts you would need to join against population data."0101" (Halden, dissolved 2020) are flagged with year ranges in their valueTexts labels. Not compatible with the current 12058 municipality codes without a mapping.CRC…) — resolve from table metadata at ingest time.Title: Boliger, etter region, bygningstype, bygningsår, statistikkvariabel og år
Source: Matrikkelen (Norwegian property register) via SSB
HeatWaves use: Not currently used. Highly relevant for building-age normalization and exposure-rate calculations — this is the denominator table for fire-rate-per-dwelling analysis by building age.
Confirmed endpoint: POST https://data.ssb.no/api/v0/no/table/06266
Dimensions:
| Dimension code | Label | Options | Notes |
|---|---|---|---|
Region | region | 994 | "0" = Hele landet. Current post-2020 municipality codes (4-digit) and county codes (2-digit). |
BygnType | bygningstype | 6 | RESIDENTIAL building types — see below. |
BygnAr | bygningsår | 13 | Construction year buckets — see below. |
ContentsCode | statistikkvariabel | 1 | Fixed: "Boliger" = Boliger (bebodde og ubebodde). |
Tid | år | 21 | 2006–2026 |
Building types (BygnType):
| Code | Label |
|---|---|
01 | Enebolig |
02 | Tomannsbolig |
03 | Rekkehus, kjedehus og andre småhus |
04 | Boligblokk |
05 | Bygning for bofellesskap |
999 | Andre bygningstyper |
Construction year buckets (BygnAr):
| Code | Label |
|---|---|
01 | 1900 og tidligere |
02 | 1901–1920 |
03 | 1921–1940 |
04 | 1941–1945 |
06 | 1946–1960 |
07 | 1961–1970 |
08 | 1971–1980 |
09 | 1981–1990 |
10 | 1991–2000 |
11 | 2001–2010 |
12 | 2011–2020 |
13 | 2021 og etter |
99 | Ukjent |
Notes:
bygningsalder dimension (13 native buckets, documented in filter-axes-native-to-filter-id.md §3). The 06266 BygnAr buckets are coarser and do not align 1-to-1 with BRASK's — a mapping table would be needed for cross-source comparison.BygnType uses a 5-category RESIDENTIAL taxonomy that does not match the BRIS Matrikkel leaf-ID list in BOLIG_IDS or the BRASK naering = 0 (Beboelse) concept directly. It can be used to understand the composition of the RESIDENTIAL stock by type.KOSboligbranner0000; denominator: 06266 Boliger count), which normalizes across regions with different stock sizes."0" returns the national total. County codes are 2-digit (e.g. "31" = Østfold) using the post-2020 system.Example request — enebolig stock, Hele landet, last 5 years:
{ "query": [ { "code": "Region", "selection": { "filter": "item", "values": ["0"] } }, { "code": "BygnType", "selection": { "filter": "item", "values": ["01"] } }, { "code": "BygnAr", "selection": { "filter": "all", "values": ["*"] } }, { "code": "Tid", "selection": { "filter": "top", "values": ["5"] } } ], "response": { "format": "json-stat2" } }
Title: Eksisterende bygningsmasse. Andre bygg enn boligbygg, etter region, bygningstype, statistikkvariabel og år
Source: Matrikkelen via SSB
HeatWaves use: Not currently used. Non-RESIDENTIAL building stock — complementary to 06266 for ALL_BUILDINGS exposure calculations.
Confirmed endpoint: POST https://data.ssb.no/api/v0/no/table/03173
Dimensions:
| Dimension code | Label | Options | Notes |
|---|---|---|---|
Region | region | 994 | Same as 06266: "0" = Hele landet, 2-digit county, 4-digit municipality. |
BygnType | bygningstype | 9 | Non-RESIDENTIAL types — see below. |
ContentsCode | statistikkvariabel | 1 | Fixed: "Bygninger" = Eksisterende bygninger. |
Tid | år | 26 | 2001–2026 |
Building types (BygnType):
| Code | Label |
|---|---|
06 | Fritidsbygg, boliggarasje mv. |
07 | Industri- og lagerbygning |
08 | Fiskeri- og landbruksbygning |
09 | Kontor- og forretningsbygning |
10 | Samferdsels- og kommunikasjonsbygning |
11 | Hotell- og restaurantbygning |
12 | Undervisnings-, kultur- og forskningsbygning |
13 | Helsebygning |
14 | Fengsels-, beredskapsbygning mv. |
Notes:
06–14 correspond directly to the "andre bygg" segment in table 03158. The two tables can be used together: 03158 gives the top-level Boligbygg/Andre bygg split, 03173 gives the detail within Andre bygg.KOSbygningsbrann0000 minus KOSboligbranner0000).Title: Eksisterende bygningsmasse. Alle bygg, etter region, bygningstype, statistikkvariabel og år
Source: Matrikkelen via SSB
HeatWaves use: Not currently used. Top-level building stock split between Boligbygg and Andre bygg — longest time series of all four tables.
Confirmed endpoint: POST https://data.ssb.no/api/v0/no/table/03158
Dimensions:
| Dimension code | Label | Options | Notes |
|---|---|---|---|
Region | region | 994 | Same as 06266/03173. |
BygnType | bygningstype | 3 | High-level split — see below. |
ContentsCode | statistikkvariabel | 1 | Fixed: "Bygninger" = Eksisterende bygninger. |
Tid | år | 30 | 1997–2026 — longest series of all five tables. |
Building types (BygnType):
| Code | Label | Notes |
|---|---|---|
01-05 | Boligbygg | Matches BygnType codes 01–05 in 06266 |
06-14 | Andre bygg enn boligbygg | Matches BygnType codes 06–14 in 03173 |
99 | Uoppgitt | — |
Notes:
Boligbygg / Andre bygg) maps directly to the RESIDENTIAL / ALL_BUILDINGS distinction used throughout HeatWaves.Fire incidents (numerator) Building stock (denominator)
───────────────────────────────── ─────────────────────────────────────────
12058 KOSboligbranner0000 06266 Boliger by BygnType + BygnAr
(Boligbranner, 2015–2025) (RESIDENTIAL, 2006–2026)
↕ fire rate per dwelling
12058 KOSbygningsbrann0000 03158 BygnType 01-05 + 06-14
(Bygningsbranner, 2015–2025) (all buildings, 1997–2026)
minus boligbranner = ↓
non-RESIDENTIAL count 03173 BygnType 06-14 detail
(non-RESIDENTIAL, 2001–2026)
Historical rates (no raw counts, 1999–2016):
04914 CRC-coded per-capita rates
Key limitations for HeatWaves ETL:
BygnType, 03173 BygnType) use a 5- or 9-category taxonomy that does not map directly to BRIS Matrikkel leaf IDs or BRASK naering values. A manual concordance is required.BygnAr) do not align with BRASK's bygningsalder dimension. They are coarser (12 periods vs BRASK's 13 fine-grained buckets). See filter-axes-native-to-filter-id.md §3 for BRASK's native buckets."0" for national and current 2-digit county + 4-digit municipality codes.