Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.
openapi: 3.2.0
info:
title: OpenSwissData — public read-only Communes API
version: 1.0.0
description: 'Read-only JSON endpoints over the official localities and streets directories (swisstopo), the combined commune and canton profiles (including the BFE one-time photovoltaic remuneration), a catalogue of approved open Swiss datasets (generic engine, filterable by canton, commune, postal code, NOGA code or year), the Swiss company fiche (company_check) and the public source registry. Free, no key, limited per network address. The company fiche is also available over MCP (`company_check`, see /mcp) without a key; the commune and canton profiles, the BFE data and the open datasets catalogue are REST-only. Unofficial copies: binding decisions belong to the official sources named in each `sources`/`source` entry.'
contact:
url: https://www.openswissdata.com/en/
servers:
- url: https://www.openswissdata.com
tags:
- name: Communes
paths:
/api/v1/communes/{bfs_id}:
get:
summary: Commune profile (combined dataset)
description: 'Name, canton, postal codes and localities (official localities directory), number of official streets (official streets directory) and `finma.entities_with_city_named_like_commune`: FINMA register rows whose city (a postal locality name) equals this commune''s name, or an exact and unique locality name of it (see `finma.matching`). A postal locality can extend into a neighbouring commune (Zürich, Genève and Zug are also postal locality names of neighbouring communes), so this is not proof of the registered seat. `finma.national_matching` gives the same counts nationally (matched/unmatched/ambiguous), plus `names_also_postal_locality_elsewhere` (matches made by commune name whose name is also a postal locality of another commune), each with its sources and directory editions. `finma.entities_with_seat_in_commune` and `finma.distinct_entities_with_seat_in_commune` combine the FINMA register (all authorisation categories, not filtered by entity_type) with the commercial register (LINDAS) for the EXACT registered seat by UID, legal persons only — whitelisted legal forms (see `finma.seat_matching`): the first counts FINMA authorisations (register rows), the second distinct UIDs. `finma.national_seats_known` is the national count of distinct UIDs with a known registered seat. These three counts are `null`, not zero, when the combined file is unavailable. No score, no ranking between communes.'
parameters:
- name: bfs_id
in: path
required: true
schema:
type: string
pattern: ^\d+$
description: Official BFS municipality number, e.g. 230
responses:
'200':
description: Commune profile
headers:
Cache-Control:
schema:
type: string
description: public, max-age=3600
'400':
description: bfs_id is not a number
'404':
description: Commune not found in any loaded directory
'429':
description: Rate limit exceeded for this network address (600 requests/hour, shared with /localities, /sources and /cantons)
tags:
- Communes
operationId: getApiV1CommunesByBfsId
x-operation-id-source: derived