# Calgary Open Data API

> City of Calgary open data: 400+ datasets, from traffic incidents to transit routes, with SoQL

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

## About

## Calgary Open Data API

The open data portal of the City of Calgary (data.calgary.ca, run on Socrata): about 413 datasets such as traffic incidents, building permits, business licences, waste collection schedules, traffic cameras and transit routes. Search the portal's datasets by keyword, category or tag, read any dataset row by row with SoQL filters, sorting, paging and aggregates, and get a dataset's column names, types and descriptions.

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

Typical flow: `/datasets?q=permits&amp;limit=5` for a dataset `id`, then `/columns?dataset=` for its field names and `/rows?dataset=&amp;$limit=10&amp;$order=...`.

### Routes

#### GET `/datasets` - Datasets
| Param | In | Type | Required | Description |
|---|---|---|---|---|
| q | query | string | no | Keyword, e.g. `permits`. |
| categories | query | string | no | Portal category, e.g. `Public Safety`. |
| tags | query | string | no | Tag. |
| order | query | string | no | `page_views_total`, `updatedAt` or `name`. |
| limit | query | number | no | Datasets per page (up to 100). |
| offset | query | number | no | Datasets to skip, for paging. |

Returns: `resultSetSize` and `results`: `resource` (`id`, `name`, `description`, `updatedAt`, `columns_name`, `columns_field_name`, `page_views`), `classification` (`domain_category`, `domain_tags`), `permalink` and `link`.

#### GET `/rows` - Rows
| Param | In | Type | Required | Description |
|---|---|---|---|---|
| dataset | path | string | yes | Dataset `id` (4x4, e.g. `ydr8-5enu`) from `/datasets`. |
| $limit | query | number | no | Rows to return (default 1,000). |
| $offset | query | number | no | Rows to skip, for paging. |
| $where | query | string | no | SoQL filter, e.g. `issue_date &gt; '2026-01-01'` (field names from `/columns`). |
| $select | query | string | no | Columns or aggregates, e.g. `count(*)`. |
| $order | query | string | no | e.g. `issue_date DESC`. |
| $q | query | string | no | Full-text search across the row. |

Returns: array of rows, each an object keyed by the dataset's column field names.

#### GET `/columns` - Columns
| Param | In | Type | Required | Description |
|---|---|---|---|---|
| dataset | path | string | yes | Dataset `id` from `/datasets`. |

Returns: the dataset's metadata: `name`, `description`, `attribution`, `rowsUpdatedAt`, `license` where set, and `columns` (`fieldName`, `name`, `dataTypeName`, `description`).

### Caveats

- Without an app token the portal throttles heavy use; page with `$limit` and `$offset`.
- Some datasets name individuals (licence holders, employees, drivers, arrestees) as published by the government; handle them under applicable privacy law.
- Each dataset keeps the terms shown on the portal; credit the City of Calgary.
- Upstream responses can change over time. Verify fields before relying on them.
- Not affiliated with or endorsed by data.calgary.ca.

## 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/calgaryopendataapi/datasets`
- Public query params: `q` (string), `categories` (string), `tags` (string), `order` (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/calgaryopendataapi/rows`
- Public query params: `$limit` (number), `$offset` (number), `$where` (string), `$select` (string), `$order` (string), `$q` (string), `dataset` (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 /columns — Columns
- Gateway: `GET https://api.apiclay.com/v1/api/calgaryopendataapi/columns`
- Public query params: `dataset` (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.

## Call example

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

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