# Switzerland Open Data API

> opendata.swiss: 16,208 open government datasets, searchable, with DataStore table queries

- Vendor: `switzerlandopendataapi` · version 1.0 · category Government Data · tags opendata swiss api, opendata swiss open data api, ckan api, government open data api, open datasets api, public data catalog api
- Datasource: custom HTTP routes
- Marketplace page: https://apiclay.com/api/switzerlandopendataapi
- This document: https://apiclay.com/docs/switzerlandopendataapi.md
- OpenAPI 3.1: https://apiclay.com/api/switzerlandopendataapi/openapi.json
- MCP: connect https://api.apiclay.com/v1/mcp (see https://apiclay.com/llms.txt), then `apiclay_describe_api` with vendor `switzerlandopendataapi`
- Updated: 2026-11-18

## About

## Switzerland Open Data API

The open data catalog of the Swiss federal, cantonal and municipal administrations (ckan.opendata.swiss, run on CKAN): about 16,208 datasets, for example road marking data. Search datasets by keyword or filter, read any dataset with its resources and download links, list the publishing organisations, and query tables loaded in the DataStore row by row.

Data comes from **ckan.opendata.swiss** (https://ckan.opendata.swiss). Every route calls the source's own public API and returns it unchanged.

Typical flow: `/datasets?q=&amp;rows=5`, then `/dataset?id=` for its resources and `/rows?resource_id=&amp;limit=10` for a DataStore table.

### Routes

#### GET `/datasets` - Datasets
| Param | In | Type | Required | Description |
|---|---|---|---|---|
| q | query | string | no | Keyword search, e.g. `flood`. |
| fq | query | string | no | Solr filter, e.g. `organization:` or `res_format:CSV`. |
| rows | query | number | no | Datasets per page (default 10; keep it small, records carry every resource). |
| start | query | number | no | Datasets to skip, for paging. |
| sort | query | string | no | e.g. `metadata_modified desc`. |

Returns: `result.count` and `result.results`: datasets with `name`, `title`, `notes`, `organization`, `tags`, `metadata_modified`, `license_title` and `resources` (`id`, `name`, `format`, `url`, `datastore_active`).

#### GET `/dataset` - Dataset
| Param | In | Type | Required | Description |
|---|---|---|---|---|
| id | query | string | yes | Dataset `name` or `id` from `/datasets`. |

Returns: `result`: the full dataset record with all its `resources` and download URLs.

#### GET `/organizations` - Organizations
| Param | In | Type | Required | Description |
|---|---|---|---|---|
| all_fields | query | string | no | `true` for titles and dataset counts. |
| limit | query | number | no | Organisations per page. |
| offset | query | number | no | Organisations to skip. |

Returns: `result`: publishing organisations (`name`, `title`, `package_count` with `all_fields=true`).

#### GET `/rows` - Rows
| Param | In | Type | Required | Description |
|---|---|---|---|---|
| resource_id | query | string | yes | A resource `id` whose `datastore_active` is true in `/dataset`. |
| q | query | string | no | Full-text search in the table. |
| filters | query | string | no | JSON object of exact matches, e.g. `{"year":"2026"}`. |
| limit | query | number | no | Rows to return (default 100). |
| offset | query | number | no | Rows to skip, for paging. |
| sort | query | string | no | e.g. `_id desc`. |
| fields | query | string | no | Comma-separated column names. |

Returns: `result.total`, `result.fields` (column `id` and `type`) and `result.records`.

### Caveats

- Dataset records are verbose; keep `rows` small and read resources with `/dataset`.
- Some datasets name individuals (licence holders, employees, drivers, arrestees) as published by the government; handle them under applicable privacy law.
- Each dataset carries its own licence (`license_title`); credit the Swiss federal, cantonal and municipal administrations.
- Upstream responses can change over time. Verify fields before relying on them.
- Not affiliated with or endorsed by ckan.opendata.swiss.

## Pricing

- Pay as you go: 0.0012 credits/request
- Trial: 1 free requests per buyer
- Billing order: trial requests -> subscribed plan requests -> pay as you go. 1 credit's USD value is shown on the marketplace page.

## HTTP routes

Only the public, buyer-facing parts of each route are listed; vendor-side credentials stay on the gateway.

### GET /datasets — Datasets
- Gateway: `GET https://api.apiclay.com/v1/api/switzerlandopendataapi/datasets`
- Public query params: `q` (string), `fq` (string), `rows` (number), `start` (number), `sort` (string)
- Upstream proxy: ApiClay proxy paid by the vendor (data cap 2 MB per call). Fetched through an ApiClay proxy paid by the vendor; a response larger than the route's data cap fails with 502 and is refunded in full.

### GET /dataset — Dataset
- Gateway: `GET https://api.apiclay.com/v1/api/switzerlandopendataapi/dataset`
- Public query params: `id` (string, required)
- Upstream proxy: ApiClay proxy paid by the vendor (data cap 2 MB per call). Fetched through an ApiClay proxy paid by the vendor; a response larger than the route's data cap fails with 502 and is refunded in full.

### GET /organizations — Organizations
- Gateway: `GET https://api.apiclay.com/v1/api/switzerlandopendataapi/organizations`
- Public query params: `all_fields` (string), `limit` (number), `offset` (number)
- Upstream proxy: ApiClay proxy paid by the vendor (data cap 2 MB per call). Fetched through an ApiClay proxy paid by the vendor; a response larger than the route's data cap fails with 502 and is refunded in full.

### GET /rows — Rows
- Gateway: `GET https://api.apiclay.com/v1/api/switzerlandopendataapi/rows`
- Public query params: `resource_id` (string, required), `q` (string), `filters` (string), `limit` (number), `offset` (number), `sort` (string), `fields` (string)
- Upstream proxy: ApiClay proxy paid by the vendor (data cap 2 MB per call). Fetched through an ApiClay proxy paid by the vendor; a response larger than the route's data cap fails with 502 and is refunded in full.

## Call example

```bash
curl -X GET "https://api.apiclay.com/v1/api/switzerlandopendataapi/datasets" \
  -H "token: <YOUR_APICLAY_TOKEN>"
```

Index of every published API: https://apiclay.com/llms.txt
