# Canada Open Data Catalog Search (open.canada.ca) (`loonieledger/canada-open-data-catalog`) Actor

Search open.canada.ca and export dataset metadata with direct CSV, JSON, XML, API and map download links. Filter by department, format and date.

- **URL**: https://apify.com/loonieledger/canada-open-data-catalog.md
- **Developed by:** [Keegan Carpentier](https://apify.com/loonieledger) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Canada Open Data Catalog Search (open.canada.ca) – Dataset Metadata & Download Links

Search the **Government of Canada Open Government Portal** and export clean dataset metadata, plus a **direct download link for every CSV, JSON, XML, GeoJSON, API or map resource**. On 29 Sep 2026 the portal listed 47,948 records, 36,000 of them under the Open Government Licence – Canada. Filter by keyword, department, file format, keyword tag and last-modified date.

- ✅ Uses the portal's official CKAN API. No scraping, no key
- ✅ Bilingual titles and keywords, plus portal links in EN and FR
- ✅ **OGL-only filter on by default**, so you only get records you can reuse commercially with attribution
- ✅ Handles paging for you (tested to 230+ records in one run)
- ✅ Plain-text descriptions (HTML removed). Personal contact fields (maintainer email, author and similar) are **left out**

### Who it's for

- **Data engineers and AI/RAG builders** who need a list of Canadian government datasets and their file URLs to ingest
- **Analysts and researchers** looking for "every StatCan or CMHC CSV about housing", or anything updated since a given date
- **Data-catalog, newsletter and monitoring services** that track new or changed federal datasets (sort by *Recently updated* and schedule it)

### Input

| Field | What it does | Default |
|---|---|---|
| `query` | Free-text search, same as the portal search box | `housing` (prefill) |
| `organizations` | Portal organization IDs, e.g. `statcan`, `cmhc-schl`, `hc-sc`, `nrcan-rncan`, `eccc`, `ircc`, `tc` | all |
| `formats` | Keep datasets with at least one resource in any of these formats (e.g. `CSV`, `JSON`, `GeoJSON`, `SHP`, `API`) | `["CSV"]` (prefill) |
| `keywords` | Required English keyword tags | none |
| `modifiedSince` | Metadata updated on or after this date | none |
| `sort` | Relevance, Recently updated, Recently created, or Title A–Z | Relevance |
| `onlyOpenGovernmentLicence` | Skip anything that isn't OGL-Canada | on |
| `includeResources` | Add the `resources` array (name, format, language, URL, last modified) | on |
| `maxItems` | Hard cap on results (and on cost) | 100 |

Example: "What did Statistics Canada update this month, in CSV?"

```json
{ "organizations": ["statcan"], "formats": ["CSV"], "modifiedSince": "2026-09-01",
  "sort": "metadata_modified desc", "maxItems": 500 }
```

### Output (real record, live test on 29 Sep 2026, resources shortened)

```json
{
  "datasetId": "ad17c1fe-ae10-45c3-8e8d-2dd69cc55759",
  "title": "Preliminary housing starts",
  "titleFr": "Données provisoires sur les mises en chantier",
  "description": "Preliminary housing starts in census metropolitan areas, urban centres of 10,000 and over, and all areas, seasonally adjusted at annual rates.",
  "organization": "Canada Mortgage and Housing Corporation",
  "organizationId": "cmhc-schl",
  "keywords": ["CMHC", "preliminary housing starts"],
  "frequency": "monthly",
  "metadataModified": "2026-09-16T15:16:46",
  "licence": "Open Government Licence - Canada",
  "portalUrl": "https://open.canada.ca/data/en/dataset/ad17c1fe-ae10-45c3-8e8d-2dd69cc55759",
  "resourceCount": 15,
  "formats": ["CSV", "HTML", "XML"],
  "resources": [{ "name": "Census metropolitan areas", "format": "CSV", "language": ["en"],
                  "url": "https://www150.statcan.gc.ca/n1/tbl/csv/34100147-eng.zip",
                  "lastModified": "2026-09-16T15:16:46" }],
  "attribution": "Contains information licensed under the Open Government Licence – Canada."
}
```

The full field list is in `.actor/dataset_schema.json`, and more real rows are in `sample_output.json`.

### Pricing

**Pay per result.** You're charged once for each dataset record written. `maxItems` and Apify's maximum cost per run are both honoured.

### Data source, licence and privacy

- Source: Open Government Portal CKAN API, `https://open.canada.ca/data/api/3/action/package_search`.
- Portal metadata and OGL datasets are under the **Open Government Licence – Canada** (https://open.canada.ca/en/open-government-licence-canada). The licence of each record is in the `licence` field. Keep `onlyOpenGovernmentLicence` on unless you check other licences yourself.
- The Actor returns **metadata and links only**. It doesn't download or re-host the files. Contact and maintainer fields are left out on purpose.
- **Unofficial tool**. It isn't affiliated with or endorsed by the Government of Canada.

# Actor input Schema

## `query` (type: `string`):

Free-text search, same as the search box on open.canada.ca (e.g. housing starts, wildfire, immigration Alberta). Leave empty to list everything that matches the filters.

## `organizations` (type: `array`):

Portal organization IDs, e.g. statcan, cmhc-schl, hc-sc, nrcan-rncan, eccc, ircc, tc. Leave empty for all.

## `formats` (type: `array`):

Keep datasets that have at least one resource in any of these formats (e.g. CSV, JSON, XLSX, XML, GeoJSON, SHP, API). Case-sensitive as used on the portal (usually upper-case).

## `keywords` (type: `array`):

Exact English keyword tags to require (e.g. 'housing', 'COVID-19').

## `modifiedSince` (type: `string`):

Only datasets whose metadata was updated on or after this date.

## `sort` (type: `string`):

Order of results. 'Relevance' works best with a search query; 'Recently updated' is best for monitoring.

## `onlyOpenGovernmentLicence` (type: `boolean`):

Recommended. Skips any record whose licence is not OGL-Canada.

## `includeResources` (type: `boolean`):

Adds a 'resources' array with name, format, language and download URL for each file/API.

## `maxItems` (type: `integer`):

Stop after this many datasets. Controls cost.

## Actor input object example

```json
{
  "query": "housing",
  "formats": [
    "CSV"
  ],
  "sort": "score desc, metadata_modified desc",
  "onlyOpenGovernmentLicence": true,
  "includeResources": true,
  "maxItems": 100
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset records written to the default dataset

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "housing",
    "formats": [
        "CSV"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("loonieledger/canada-open-data-catalog").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "query": "housing",
    "formats": ["CSV"],
}

# Run the Actor and wait for it to finish
run = client.actor("loonieledger/canada-open-data-catalog").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "housing",
  "formats": [
    "CSV"
  ]
}' |
apify call loonieledger/canada-open-data-catalog --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,loonieledger/canada-open-data-catalog"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/eN909WOPbVQtxyViV/builds/Fx7OBuhrGdtGC2YOp/openapi.json
