opendata.swiss API
Free Swiss open data API with no key: federal, cantonal and municipal datasets across transport, health, environment and statistics via CKAN. Tested.
Endpoint tested and returned HTTP 200 on 2026-08-20
What is the opendata.swiss API?
opendata.swiss is the free, key-free CKAN-based API for Switzerland's national open data portal, aggregating datasets from federal offices, cantons and municipalities across transport, health, environment, statistics and more.
Switzerland's federal structure means data is published by many separate bodies. opendata.swiss aggregates federal, cantonal and municipal datasets into one searchable catalogue using the standard CKAN API.
Metadata is multilingual across German, French, Italian and English, reflecting Switzerland's official languages. Titles come as language-keyed objects, so you select a language rather than reading a plain string.
Quick facts
- Base URL
https://opendata.swiss/api/3/action- Authentication
- No API key required for reading public datasets.
- Rate limit
- No published hard limit; fair use expected.
- Pricing
- Free open data; individual datasets carry their own licences.
- CORS
- Enabled — callable directly from browser JavaScript
- Official docs
- Read the docs
How to use the opendata.swiss API
Every request below was executed against the live API on 2026-08-20, and the response shown is the real body it returned — not an illustration.
1. Search Swiss open datasets
GET https://opendata.swiss/api/3/action/package_search?rows=1
curl 'https://opendata.swiss/api/3/action/package_search?rows=1'const res = await fetch("https://opendata.swiss/api/3/action/package_search?rows=1");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://opendata.swiss/api/3/action/package_search?rows=1", timeout=20)
res.raise_for_status()
print(res.json()){
"help": "https://ckan.opendata.swiss/api/3/action/help_show?name=package_search",
"success": true,
"result": {
"count": 16383,
"facets": {},
"results": [
{
"accrual_periodicity": "http://publications.europa.eu/resource/authority/frequency/MONTHLY",
"author": null,
"author_email": null,
"conforms_to": [],
"contact_points": [
{
"email": "idd@bag.admin.ch",
"name": "Bundesamt für Gesundheit, Abteilung Übertragbare Krankheiten"
}
],
"creator_user_id": "af084126-f711-4016-a585-70354e997796",
"description": {
"de": "Daten zur Verbreitung und zeitlichen Entwicklung von Syphilis Erkrankungsfällen in der Schweiz und im Fürstentum Liechtenstein. Sie finden Daten zu Fällen aus dem obligatorischen Meldesystem.",
"fr": "Données concernant la propagation et l’évolution temporelle des cas du syphilis en Suisse et dans la Principauté de Liechtenstein. Vous trouverez des donnés sur les cas provenant du système de déclaration obligatoire.",
"it": "Dati della diffusione e dell’evoluzione temporale dei casi di sifilide in Svizzera e nel Principato del Liechtenstein. Qui trovate dati dei casi basate sul sistema di dichiarazione obbligatoria.",
"en": "Data on the spread and development of syphilis infections and cases in Switzerland and the Principality of Liechtenstein. You will find data on cases from the mandatory reporting system."
},
"display_name": {
"de": "Syphilis",
"fr": "SyphilisParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
package_search | path | Optional | Search datasets. package_search |
q | string | Optional | Search query. verkehr |
rows | integer | Optional | Results per page. 10 |
fq | string | Optional | Solr filter query, e.g. by organisation or format. res_format:CSV |
package_show?id= | string | Optional | Full metadata for one dataset. package_show?id=... |
Response fields
successboolean- Whether the action succeeded — check before reading result.
result.countinteger- Total datasets matching.
result.results[].titleobject- Title keyed by language — de, fr, it, en.
result.results[].organizationobject- Publishing body.
result.results[].resourcesarray- Downloadable files with format and URL.
result.results[].license_idstring- Dataset licence.
What you can build with the opendata.swiss API
- Search Swiss federal and cantonal datasets programmatically
- Automate downloads of regularly updated Swiss statistics
- Build multilingual civic tools for Switzerland
- Monitor a canton for newly published data
Common errors and how to fix them
Title is an object, not a string
Metadata is multilingual.
Fix: Read title.en or title.de — there is no single plain-string title.
success: false
The CKAN action failed.
Fix: CKAN returns HTTP 200 for logical failures; check the success field.
Mixed languages in results
Publishers use their own language.
Fix: Not every dataset has an English title; fall back through de, fr, it.
opendata.swiss API — frequently asked questions
Is opendata.swiss free?
Yes, reading public datasets requires no API key. Individual datasets carry their own licences, most of them open.
Why are titles objects rather than strings?
Switzerland has four official languages, so metadata is keyed by language code. Read title.en where available and fall back to de, fr or it.
Does it cover cantonal data?
Yes, it aggregates federal offices, cantons and municipalities into one catalogue — which is the main reason to use it rather than individual portals.
Does the same code work on other CKAN portals?
Yes. The action endpoints are identical to data.gov.uk and hundreds of others; only the hostname and the multilingual metadata differ.
Tools that pair with this API
JSON Formatter
Format, beautify and minify JSON online with 2-space, 4-space or tab indentation. Sort keys alphabetically and catch syntax errors instantly — free and private.
CSV to JSON Converter
Convert CSV to a JSON array of objects online. Header-row detection, comma/semicolon/tab delimiters and pretty-printed output — 100% in your browser.
opendata.swiss is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-20; always check the official documentation before relying on this API in production, as terms and limits can change.