Skip to content
Navigation

Dwelling (Wohnung) records for one or more buildings, by EGID or by parcel EGRID

Every row of the federal dwelling register (gwr_dwelling, loaded monthly by the AV enrichment run's load_gwr_dwellings.sh) for the requested buildings, grouped per EGID. This is the only public source of per-dwelling floor/area/room data: geo.admin's GWR layer stops at the building, and housing-stat.ch forbids automated use.

Pass EXACTLY ONE of egid (1..25 comma-separated building ids - preferred, callers that already read the building register have them) or egrid (every EXISTING building on the parcel via gwr_register, which holds GSTAT = 1004 only, so a demolished building is reachable by EGID but not by EGRID). Rows are ordered egid, floor ASC NULLS LAST, ewid; a requested building with no dwellings still gets an entry with count: 0.

Caps → truncated. One 2,000-row cap across the whole answer (the largest building carries 460 dwellings), and 25 buildings per egrid (718 parcels carry more; the largest 586). Either cut sets truncated: true; never sum a truncated answer and present it as the parcel total. Every dwelling state is returned; filter wstat = 3004 for existing dwellings only.

Caching. Redis gwr:/res_api/gwr/dwellings?<sorted query> for 6 h with an X-Cache: HIT|MISS header. Unlike the other /gwr routes this key is NOT flushed by the loader (a shell script with no Redis client), so a monthly reload becomes visible within 6 h.

Auth: token header or ?token= (router-wide, before every /gwr route); real status codes, no X-RES-API-Version needed. CORS *.

GET
https://res.aireon.ch/res_api/gwr/dwellings

Authorization

  • ResApiToken
    optional
    API key in header
  • ResApiTokenQuery
    optional
    API key in query

Query parameters

  • egid
    optional
    string

    Comma-separated integer EGIDs, 1..25, de-duplicated. Mutually exclusive with egrid.

    pattern: ^[0-9]+(,[0-9]+)*$
  • egrid
    optional
    string

    Parcel EGRID CH + 12 digits (case-insensitive). Mutually exclusive with egid.

    pattern: ^[Cc][Hh][0-9]{12}$

Returns

200

Dwellings grouped by building.

JSON
  • egrid
    string | null
    required

    The requested EGRID, or null on the egid path.

  • vintage
    string | null
    required

    Latest wexpdat (register export date) across the returned rows; null when no row.

    format: date
  • count
    integer
    required

    Dwelling rows returned (≤ 2000).

  • truncated
    boolean
    required

    True when THIS ANSWER IS SHORT: the 2000-row cap cut the list, or the egrid parcel carries more than 25 buildings. Never present a truncated total as the parcel's.

  • buildings
    array of
    object
    required

    One entry per requested (or resolved) EGID, in request/ORDER BY egid order - including buildings with zero dwellings.

    • egid
      optional
      integer
    • count
      optional
      integer
    • dwellings
      optional
      array of
      object
      • ewid
        optional
        integer

        Eidgenössischer Wohnungsidentifikator.

      • edid
        optional
        integer | null

        Entrance id (Eingangsidentifikator).

      • whgnr
        optional
        string | null

        Administrative dwelling number.

      • weinr
        optional
        string | null

        Physical dwelling number.

      • wstwk
        optional
        integer | null

        Storey CODE (3100 ground floor, 3101.. upper floors, 3401.. basements).

      • floor
        optional
        integer | null

        Storey NUMBER derived from wstwk at load time: 0 ground, 1..99 up, -1..-19 down.

      • wbez
        optional
        string | null

        Location on the floor.

      • wmehrg
        optional
        integer | null

        Multi-storey dwelling flag code.

      • wbauj
        optional
        integer | null

        Year of construction.

      • wabbj
        optional
        integer | null

        Year of demolition.

      • wstat
        optional
        integer | null

        Dwelling status code (3004 = existing, 3007 = demolished).

      • warea
        optional
        number | null

        Living area, m².

      • wazim
        optional
        number | null

        Number of rooms.

      • wkche
        optional
        integer | null

        Kitchen flag code.

400

Both or neither of egid/egrid; a non-integer or unsafe EGID; more than 25 EGIDs; an EGRID that does not look like CH123456789012.
JSON
  • error
    string
    required

    Human-readable error description.

  • message
    optional
    string

    Optional underlying error message.

401

Missing token.
JSON
  • error
    string
    required

    Human-readable error description.

  • message
    optional
    string

    Optional underlying error message.

403

Wrong token.
JSON
  • error
    string
    required

    Human-readable error description.

  • message
    optional
    string

    Optional underlying error message.

500

{"error":"Internal Server Error"}.
JSON
  • error
    string
    required

    Human-readable error description.

  • message
    optional
    string

    Optional underlying error message.

503

gwr_dwelling table not loaded yet (Postgres 42P01) - {"error":"Dwelling register not loaded yet"}. Run load_gwr_dwellings.sh.
JSON
  • error
    string
    required

    Human-readable error description.

  • message
    optional
    string

    Optional underlying error message.

Type to search…

↑↓ navigate↵ selectEsc close