Open Government - Canada

Government API · Government of Canada · Open data CKAN portal

TL;DR

The Government of Canada's Open Data portal provides a CKAN-based API to search and access over 80,000 federal datasets covering climate, health, immigration, economy, geography, and more. List all datasets, search by keyword, or retrieve specific dataset metadata including resources (CSV, JSON, GeoJSON), organization details, and update frequency. No API key required. This is the central discovery point for Canadian federal open data, managed by the Treasury Board of Canada Secretariat.

Quick start: http://open.canada.ca/data/en/dataset

No API key needed — Canadian open government!

How to Use This API

1. List All Dataset Packages

The CKAN API provides a package list endpoint:

https://open.canada.ca/data/api/3/action/package_list

2. Search Datasets by Keyword

https://open.canada.ca/data/api/3/action/package_search?q=climate+change

Returns datasets matching "climate change" with title, description, organization, resources, and metadata.

3. JavaScript — Search and Display Datasets

fetch('https://open.canada.ca/data/api/3/action/package_search?q=immigration&rows=5')
  .then(r => r.json())
  .then(data => {
    if (data.success) {
      data.result.results.forEach(ds => {
        console.log(ds.title);
        console.log('  Organization:', ds.organization?.title);
        console.log('  Updated:', ds.metadata_modified);
        console.log('  Resources:', ds.resources.length);
      });
    }
  });

4. Python — Get Dataset Details

import requests

# Get details about a specific dataset
r = requests.get(
  'https://open.canada.ca/data/api/3/action/package_show',
  params={'id': 'climate-change-indicators'}
)
if r.status_code == 200:
    ds = r.json()['result']
    print(f"Title: {ds['title']}")
    print(f"Description: {ds['notes'][:200]}...")
    for res in ds['resources']:
        print(f"  Download: {res['url']} ({res['format']})")
Search "climate": https://open.canada.ca/data/api/3/action/package_search?q=climate&rows=3

Frequently Asked Questions

What type of datasets are available?
Over 80,000 datasets covering climate, health, economics, immigration, geography, transportation, natural resources, public safety, and culture.
What is CKAN?
CKAN (Comprehensive Knowledge Archive Network) is an open-source data portal platform. Its API provides package_list, package_search, package_show, and other actions.
Are the datasets downloadable?
Yes — each dataset includes downloadable resources in various formats including CSV, JSON, GeoJSON, XLSX, SHP (shapefile), and XML.
Is there a rate limit?
The CKAN API is openly available with generous rate limits. For high-volume scraping, contact the Government of Canada open data team.
Does this include provincial data?
This portal covers federal datasets. Provinces like Ontario, BC, and Quebec have their own separate open data portals.
Are the datasets available in both English and French?
Yes — as required by Canadian law, all dataset metadata is available in both official languages. French data is under /data/fr/.

API Details

API URL
https://open.canada.ca/data/api/3/action
Documentation
open.canada.ca/en/api
Category
Government
Authentication
Not Required
Geographic Coverage
Canada — federal government datasets

What You Can Build