BYTETOOLS

Statistics Canada WDS API

Free Statistics Canada Web Data Service with no key: CPI, GDP, employment and any published table by vector id or product id. Read-only POST, tested example included.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-21

What is the Statistics Canada WDS API?

Statistics Canada's Web Data Service is a free API with no key that returns any published Canadian statistic. Series are addressed by vector id, and a read-only POST returns the most recent N observations for each requested vector.

StatCan models its catalogue as tables (product ids) containing series (vector ids). A vector id such as `32164132` uniquely identifies one series across the whole catalogue and never changes, which makes it a good primary key to store. Finding the vector for a series you want is done in the table viewer on the StatCan site — the API is for retrieval, not discovery.

The retrieval endpoints are POST requests carrying a JSON array, which looks like a write but is not: nothing is created or modified, and the body exists only because a request can name many vectors at once. The response has a per-item envelope, so `status` must be checked on each element rather than once. Two fields decide whether your number is right: `scalarFactorCode`, which says what power of ten the value is scaled by, and `symbolCode`, which flags suppressed or preliminary observations.

Quick facts

Base URL
https://www150.statcan.gc.ca/t1/wds/rest
Authentication
No key or registration. The service is read-only despite using POST for its retrieval endpoints.
Rate limit
StatCan asks callers to stay under 50 requests per second and to batch vectors rather than looping. Per-request vector caps are documented per endpoint in the user guide.
Pricing
Free.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the Statistics Canada WDS API

Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.

1. Last three observations of a Canadian statistical vector

POST https://www150.statcan.gc.ca/t1/wds/rest/getDataFromVectorsAndLatestNPeriods

curl
curl -X POST 'https://www150.statcan.gc.ca/t1/wds/rest/getDataFromVectorsAndLatestNPeriods' \
  -H 'Content-Type: application/json' \
  -d '[{"vectorId":32164132,"latestN":3}]'
JavaScript (fetch)
const res = await fetch("https://www150.statcan.gc.ca/t1/wds/rest/getDataFromVectorsAndLatestNPeriods", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify([{"vectorId":32164132,"latestN":3}]),
});
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

headers = {
    "Content-Type": "application/json",
}

payload = [{"vectorId":32164132,"latestN":3}]

res = requests.post("https://www150.statcan.gc.ca/t1/wds/rest/getDataFromVectorsAndLatestNPeriods", headers=headers, json=payload, timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200
[
  {
    "status": "SUCCESS",
    "object": {
      "responseStatusCode": 0,
      "productId": 35100003,
      "coordinate": "1.12.0.0.0.0.0.0.0.0",
      "vectorId": 32164132,
      "vectorDataPoint": [
        {
          "refPer": "2021-01-01",
          "refPer2": "2022-01-01",
          "refPerRaw": "2021-01-01",
          "refPerRaw2": "2022-01-01",
          "value": 29.09,
          "decimals": 2,
          "scalarFactorCode": 0,
          "symbolCode": 0,
          "statusCode": 0,
          "securityLevelCode": 0,
          "releaseTime": "2023-02-23T08:30",
          "frequencyCode": 12
        },
        {
          "refPer": "2022-01-01",
          "refPer2": "2023-01-01",
          "refPerRaw": "2022-01-01",
          "refPerRaw2": "2023-01-01",
          "value": 19.43,
          "decimals": 2,
          "scalarFactorCode": 0,
          "symbolCode": 0,
          "statusCode": 0,
          "securityLevelCode": 0,
          "releaseTime": "2025-09-23T08:30",
          "frequencyCode": 12
        },
        {
          "refPer": "2023-01-01",
          "refPer2": "2024-01-01",
          "refPerRaw": "2023-01-01",
          "refPerRaw2": "2024-01-01",
          "value": 16.74,
          "decimals": 2,
          "scalarFactorCode": 0,
          "symbolCode": 0,
          "statusCode": 0,
          "securityLevelCode": 0,
          "releaseTime": "2025-09-23T08:30",
          "frequencyCode": 12
        }
      ]
    }
  }
]

Parameters

ParameterTypeRequiredDescription
(body) vectorIdbodyRequiredNumeric vector id identifying one series. Stable across the whole catalogue. 32164132
(body) latestNbodyRequiredHow many of the most recent observations to return for that vector. 3
getDataFromVectorsAndLatestNPeriodspathRequiredThe retrieval endpoint. Takes a JSON array of vector-and-count objects.
getFullTableDownloadCSV/{productId}/{lang}pathOptionalReturns a signed URL for a full table download as zipped CSV. 35100003/en

Response fields

[].statusstring
Per-item result — `SUCCESS` or a failure code. Check it on every element, not once for the response.
[].object.vectorIdinteger
Echo of the vector requested.
[].object.productIdinteger
The table this vector belongs to.
[].object.coordinatestring
Position of the series within the table's dimension cube.
[].object.vectorDataPoint[].refPerstring
Reference period start for the observation.
[].object.vectorDataPoint[].valuenumber
The observation, before applying the scalar factor.
[].object.vectorDataPoint[].scalarFactorCodeinteger
Power of ten the value is scaled by. 0 means units; 3 means thousands. Apply it or your numbers are wrong by orders of magnitude.
[].object.vectorDataPoint[].symbolCode / statusCodeinteger
Flags for suppressed, preliminary or revised observations.
[].object.vectorDataPoint[].releaseTimestring
When StatCan published this observation.

What you can build with the Statistics Canada WDS API

  • Pull Canadian CPI or GDP into a dashboard by vector id
  • Fetch several related series in one request
  • Download a whole StatCan table as CSV through the signed-URL endpoint
  • Detect revisions by comparing `releaseTime` across fetches

Common errors and how to fix them

409

The endpoint was called with the wrong method or a missing path segment.

Fix: The retrieval endpoints are POST with a JSON array body. `getChangedSeriesList` needs a date path segment.

`status` not SUCCESS on one item

That vector id does not exist or is restricted.

Fix: The envelope is per-item, so a partial failure still returns HTTP 200. Check every element.

Values orders of magnitude off

`scalarFactorCode` was ignored.

Fix: Multiply by ten to the power of the code. A code of 3 means the value is in thousands.

Statistics Canada WDS API — frequently asked questions

Is the Statistics Canada API free?

Yes. The Web Data Service needs no key or registration. StatCan asks callers to stay under 50 requests per second and 25 vectors per request.

Why does a read-only API use POST?

Because a single request can name many vectors, which is easier to express as a JSON array body than as a query string. Nothing is created or modified — the endpoints are strictly retrieval.

What is a vector id?

A stable numeric identifier for one time series across the entire StatCan catalogue. Find it in the table viewer on the StatCan site, then store it — vector ids do not change.

What is the scalar factor code for?

It records the power of ten the stored value is scaled by, so raw values can be compact. A code of 3 means the number is in thousands. Apply it before displaying anything.

Tools that pair with this API

Statistics Canada WDS is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.