HWHeat Waves
    DashboardUtforsk
    Analyse
    Data Kilder
        • Category Codes
        • Filter Axes
        • Regions
        • Building Types
        • SSB Tables
        • API Examples
      • Catalog
      • Pipeline
      • Entrypoints
    • Design Rationale
    • Doc Map
    DocsSettings
    DashboardAtlasUtforsk
    Analyse
    Data Kilder
    1. Documentation
    2. Ingestion
    3. Adapter Mappings
    4. Ssb Pxwebapi Tables

    Loading documentation...

    SSB (Statistics Norway) — Adapter Reference

    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.


    Scope

    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>.


    SSB PxWebApi v0 — How the API works

    Base URL: https://data.ssb.no/api/v0/no/table/<table-id>

    Discover a table's dimensions

    GET https://data.ssb.no/api/v0/no/table/12058

    Returns a JSON object with:

    • title — human-readable table title
    • variables — array of dimensions, each with:
      • code — dimension identifier used in query bodies
      • text — human label for the dimension
      • values — array of option codes (e.g. municipality codes, year strings)
      • valueTexts — human labels matching values 1-to-1

    Query data

    POST 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.

    Region code conventions

    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:

    TableCounty-level selection
    12058National: 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.
    04914EAK = 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).
    03173Same as 06266.
    03158Same 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.


    Table Inventory

    Table 12058 — Brann- og ulykkesvern (grunnlagstall og nøkkeltall)

    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 codeLabelOptionsNotes
    KOKkommuneregion0000region891Municipality codes (current and historical) and EAK (Hele landet). HeatWaves uses EAK when no region filter is set; kommune breakdown uses explicit item codes.
    ContentsCodestatistikkvariabel34Fire and safety metrics — see variable list below.
    Tidår112015–2025

    Key ContentsCode values for HeatWaves:

    CodeLabelUnit
    KOSboligbranner0000Antall boligbrannerantall
    KOSboligbrprinnb0000Boligbranner per 1000 innbyggerantall
    KOSbygningsbrann0000Antall bygningsbrannerantall
    KOSbygningsbrpri0000Antall bygningsbranner per 1000 innbyggereantall
    KOSerstatnbygnin0000Anslått erstatning for bygningsbrannerkr
    KOSerstbygbrprin0000Anslått erstatning til bygningsbranner pr. innbyggerkr
    KOSutrykningerto0000Antall utrykningerantall
    KOSutrykntotprin0000Antall utrykninger per 1000 innbyggereantall
    KOSpiper0000Antall piperantall
    KOSandelpiperfei0000Andel piper feietprosent
    KOSaarsverkialtp0000Årsverk i brann- og ulykkesvern per 1000 innbyggereårsverk
    KOSBDUtot0000Brutto driftsutgifter til funksjon 338+339, konsern1000 kr
    KOSBDU3380000Brutto driftsutgifter til funksjon 338 (forebygging)1000 kr
    KOSBDU3390000Brutto driftsutgifter til funksjon 339 (beredskap)1000 kr
    KOSNDUtot0000Netto driftsutgifter til funksjon 338+3391000 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.
    • Data is annual only (KOSTRA reporting cycle). No monthly or quarterly breakdowns.
    • Year range: 2015–2025 (PxWeb rejects 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):

    Pathdim_codeStorageCode
    Ingest (Explore + admin)5 Bygningstypefact_yearlylib/data-model/adapters/ssb.ts — cats 501 / 502 only
    Native live read7 Nøkkeltallnone (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


    Table 04914 — Brann- og ulykkesvern, nøkkeltall (historisk)

    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 codeLabelOptionsNotes
    Regionregion480Mix of legacy municipality codes (4-digit pre-2020) and national aggregates (EAK, EAKUO).
    ContentsCodestatistikkvariabel18Rate/share metrics only — no absolute counts. Variable codes are internal CRC hashes.
    Tidår181999–2016

    ContentsCode values (all per-capita rates and shares):

    CodeLabelUnit
    CRC1172570820Antall A-objekterantall
    CRC3706540926Antall piper pr. innbyggerantall
    CRC1767885593Årsgebyr for feiing og tilsynkr
    CRC2884264936Anslått erstatning til bygningsbranner pr. innbyggerkr
    CRC3781029963Netto driftsutgifter til funksjon 338 pr. innbyggerkr
    CRC1116325597Netto driftsutgifter til funksjon 338 i prosent av 338+339prosent
    CRC56833651Årsverk til funksjon 338 pr. 1000 innbyggereårsverk
    CRC2894571505Andel A-objekter som har fått tilsynprosent
    CRC1909992147Andel piper feietprosent
    CRC4245910964Andel personer med kompetanse som fører tilsynprosent
    CRC1945362332Årsverk av feier pr. 1000 innbyggereårsverk
    CRC2020501240Antall bygningsbranner pr. 1000 innbyggereantall
    CRC3859477339Antall utrykninger pr. 1000 innbyggereantall
    CRC2130944737Netto driftsutgifter til funksjon 339 pr. innbyggerkr
    CRC3967106453Netto driftsutgifter pr. innbyggerkr
    CRC1757617042Årsverk til funksjon 339 pr. 1000 innbyggereårsverk
    CRC794165238Årsverk i brann- og ulykkesvern pr. 1000 innbyggereårsverk
    CRC3974555953Antall boligbranner pr. 1000 innbyggereantall

    Notes:

    • This table carries only rate/per-capita metrics, not raw absolute counts. It does not directly expose Antall boligbranner — only the per-1000-innbygger rate. To recover absolute counts you would need to join against population data.
    • Region codes are legacy four-digit codes (pre-2020 municipality structure). Many codes like "0101" (Halden, dissolved 2020) are flagged with year ranges in their valueTexts labels. Not compatible with the current 12058 municipality codes without a mapping.
    • Variable codes are CRC hashes (CRC…) — resolve from table metadata at ingest time.
    • Overlap with 12058: both tables cover 2015–2016. Use 04914 for anything before 2015; use 12058 for 2015 onwards.

    Table 06266 — Boliger etter bygningstype og bygningsår

    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 codeLabelOptionsNotes
    Regionregion994"0" = Hele landet. Current post-2020 municipality codes (4-digit) and county codes (2-digit).
    BygnTypebygningstype6RESIDENTIAL building types — see below.
    BygnArbygningsår13Construction year buckets — see below.
    ContentsCodestatistikkvariabel1Fixed: "Boliger" = Boliger (bebodde og ubebodde).
    Tidår212006–2026

    Building types (BygnType):

    CodeLabel
    01Enebolig
    02Tomannsbolig
    03Rekkehus, kjedehus og andre småhus
    04Boligblokk
    05Bygning for bofellesskap
    999Andre bygningstyper

    Construction year buckets (BygnAr):

    CodeLabel
    011900 og tidligere
    021901–1920
    031921–1940
    041941–1945
    061946–1960
    071961–1970
    081971–1980
    091981–1990
    101991–2000
    112001–2010
    122011–2020
    132021 og etter
    99Ukjent

    Notes:

    • This table is the key cross-reference for building-age normalization. BRASK uses its own 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.
    • Useful for computing fire rate per dwelling (numerator: 12058 KOSboligbranner0000; denominator: 06266 Boliger count), which normalizes across regions with different stock sizes.
    • Region code "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" } }

    Table 03173 — Eksisterende bygningsmasse (andre bygg enn boligbygg)

    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 codeLabelOptionsNotes
    Regionregion994Same as 06266: "0" = Hele landet, 2-digit county, 4-digit municipality.
    BygnTypebygningstype9Non-RESIDENTIAL types — see below.
    ContentsCodestatistikkvariabel1Fixed: "Bygninger" = Eksisterende bygninger.
    Tidår262001–2026

    Building types (BygnType):

    CodeLabel
    06Fritidsbygg, boliggarasje mv.
    07Industri- og lagerbygning
    08Fiskeri- og landbruksbygning
    09Kontor- og forretningsbygning
    10Samferdsels- og kommunikasjonsbygning
    11Hotell- og restaurantbygning
    12Undervisnings-, kultur- og forskningsbygning
    13Helsebygning
    14Fengsels-, beredskapsbygning mv.

    Notes:

    • Codes 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.
    • This table has no building-age dimension — unlike 06266, non-RESIDENTIAL stock is not broken down by construction year.
    • Useful for computing non-RESIDENTIAL fire incidence rates when combined with building fire count data (12058 KOSbygningsbrann0000 minus KOSboligbranner0000).

    Table 03158 — Eksisterende bygningsmasse (alle bygg)

    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 codeLabelOptionsNotes
    Regionregion994Same as 06266/03173.
    BygnTypebygningstype3High-level split — see below.
    ContentsCodestatistikkvariabel1Fixed: "Bygninger" = Eksisterende bygninger.
    Tidår301997–2026 — longest series of all five tables.

    Building types (BygnType):

    CodeLabelNotes
    01-05BoligbyggMatches BygnType codes 01–05 in 06266
    06-14Andre bygg enn boligbyggMatches BygnType codes 06–14 in 03173
    99Uoppgitt—

    Notes:

    • The two-category split (Boligbygg / Andre bygg) maps directly to the RESIDENTIAL / ALL_BUILDINGS distinction used throughout HeatWaves.
    • Year coverage starts in 1997 — this is the only table with data before 2001, making it useful for long-run trend analysis of building stock growth.
    • Use this table as the denominator for long-run fire-rate-per-building calculations at national or county level, then zoom into 06266 for RESIDENTIAL detail.

    Cross-table relationship

    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:

    • SSB has no dimension for fire cause, ignition source, area of origin, or object first ignited. It only counts incidents and buildings. All causal analysis must come from BRIS or BRASK.
    • Building types in SSB (06266 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.
    • Construction year buckets in 06266 (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.
    • All SSB tables are annual — no sub-annual granularity is available.
    • Region codes vary by table: 12058 uses current 4-digit municipality codes; 04914 uses legacy codes; 06266, 03173, 03158 use "0" for national and current 2-digit county + 4-digit municipality codes.