Statistics Canada (StatCan) Web Data Service
statcan.gc.ca · Government
RESTful API providing access to Statistics Canada's statistical data including census, labour force survey, CPI, GDP, trade statistics, demographic estimates, and health surveys. Data is returned in SDMX-JSON or CSV format. No authentication required — fully open. Essential for actuarial analysis, market sizing, and demographic research in Canada. Covers federal datasets across 300+ statistical programs.
Authentication
Sample Requests
Returns the Consumer Price Index, total, all-items (table 18-10-0004-01). Use the Web Data Service API at /t1/tbl1/ to get structured JSON data for any StatCan table by PID.
Hover any highlighted part to learn what it does
curl -X GET "https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=1810000401"
import requests
response = requests.get(
"https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=1810000401",
)
print(response.json())const url = 'https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=1810000401'; const response = await fetch(url); const data = await response.json(); console.log(data);
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=1810000401"
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=1810000401")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=1810000401";
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));The StatCan Web Data Service (WDS) also exposes a programmatic endpoint. Use the getSeriesInfoFromCubePidCoordinate endpoint for structured time-series access.
Hover any highlighted part to learn what it does
curl -X GET "https://www150.statcan.gc.ca/t1/tbl1/en/https://www150.statcan.gc.ca/t1/tbl1/en/dtbl/downloaddatacsv?pid=1810000401&latestN=5?pid=1810000401&latestN=5"
import requests
params = {
"pid": "1810000401",
"latestN": "5"
}
response = requests.get(
"https://www150.statcan.gc.ca/t1/tbl1/en/https://www150.statcan.gc.ca/t1/tbl1/en/dtbl/downloaddatacsv?pid=1810000401&latestN=5",
params=params,
)
print(response.json())const url = new URL('https://www150.statcan.gc.ca/t1/tbl1/en/https://www150.statcan.gc.ca/t1/tbl1/en/dtbl/downloaddatacsv?pid=1810000401&latestN=5');
url.searchParams.set('pid', '1810000401');
url.searchParams.set('latestN', '5');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://www150.statcan.gc.ca/t1/tbl1/en/https://www150.statcan.gc.ca/t1/tbl1/en/dtbl/downloaddatacsv?pid=1810000401&latestN=5")
q := baseURL.Query()
q.Set("pid", "1810000401")
q.Set("latestN", "5")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://www150.statcan.gc.ca/t1/tbl1/en/https://www150.statcan.gc.ca/t1/tbl1/en/dtbl/downloaddatacsv?pid=1810000401&latestN=5")
uri.query = URI.encode_www_form({
"pid" => "1810000401",
"latestN" => "5"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://www150.statcan.gc.ca/t1/tbl1/en/https://www150.statcan.gc.ca/t1/tbl1/en/dtbl/downloaddatacsv?pid=1810000401&latestN=5?" . http_build_query([
"pid" => "1810000401",
"latestN" => "5"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- No API key needed — StatCan API is fully open and free
- Find table PIDs (Product IDs) at www150.statcan.gc.ca — each table has a unique 10-digit PID
- WDS API endpoint: https://www150.statcan.gc.ca/t1/tbl1/en — supports CSV and JSON download
- StatCan also offers a SPARQL endpoint for linked data access at statcan.gc.ca/sparql
- Key tables: Labour Force Survey (14-10-0287-01), CPI (18-10-0004-01), Population (17-10-0005-01)
- Data is in English and French — append /fr to paths for French responses
What can you build with Statistics Canada (StatCan) Web Data Service?
Statistics Canada (StatCan) Web Data Service is a Government API. Developers commonly use government APIs for:
- surfacing public datasets in citizen-facing apps
- building transparency and civic engagement tools
- accessing legislation, court records, and official data
- powering research and journalism tools
- creating compliance and regulatory monitoring dashboards
No authentication required. This API is open — no signup or key needed. Ideal for quick prototypes and public-facing features. Statistics Canada (StatCan) Web Data Service is free to use, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide · Learn about API keys · What is REST?