Open Government, Switzerland API

Free to Use Varies (check documentation)

Overview

The Switzerland Open Government Data API (opendata.swiss) provides a CKAN-based catalog of datasets from Swiss federal, cantonal, and municipal authorities. No API key is required, and it supports search, filtering, and direct dataset access. It is a reliable source for Swiss statistics, geography, and government records.

💡

Beginner Tip

Use the CKAN API endpoint at opendata.swiss/api/3/action/ — start with package_list to see all dataset IDs, then use package_show?id=DATASET_ID to get download links for a specific dataset.

Available Data

Open Government, Switzerland data via REST API
JSON-formatted response data
Freely accessible without authentication

Example Response

JSON Response
{
  "status": "success",
  "data": {
    "result": "Data from Open Government, Switzerland",
    "description": "Switzerland Government Open Data",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

success Indicates whether the API action completed successfully
result.results Array of dataset objects matching the search query
result.count Total number of datasets matching the query
result.results[].title Multilingual dataset title keyed by language code (de, fr, it, en)
result.results[].resources List of downloadable files with format, url, and description

Implementation Example

const url = "https://handbook.opendata.swiss/de/content/nutzen/";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

KeyError on result field in response The API returned success: false due to an invalid action or parameter name
Always check the success field first; valid actions include package_list, package_search, and package_show
Dataset description is in German, French, or Italian Switzerland is multilingual and metadata is published in official languages
Look for language-specific fields in the response; use the title.fr or title.de keys for specific languages
Rate limiting with many rapid requests The public API has undocumented rate limits to protect the server
Add a short delay (0.5 to 1 second) between requests and use pagination via the rows parameter to batch results efficiently

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 15/20
🔒 Security 15/15
🛠 Developer XP 15/20
✓ Reliability 7/15
Response Time 250ms

Fully tested on Apr 5, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Government
Difficulty Beginner
Verified: 2026-04-04

Similar APIs

View All →