API v1

Ask the same questions from code

Everything on the map is available as JSON or CSV: the same questions, the same parameters, the same provenance. Open data needs no key; GVCdtLab licensed data needs an API key tied to an authorised account.

Interactive reference (OpenAPI) openapi.json Create account

Quick start

1 · List questions

curl -s https://geonia.warin.ca/api/v1/questions?lang=en

2 · Read parameters

curl -s https://geonia.warin.ca/api/v1/questions/macro-map

3 · Get the answer

curl -s "https://geonia.warin.ca/api/v1/questions/macro-map/answer?indicator=FP.CPI.TOTL.ZG&year=2024"

Worked examples

Python — world inflation in 2024, ranked

import requests

base = "https://geonia.warin.ca/api/v1"
ans = requests.get(f"{base}/questions/macro-map/answer",
                   params={"indicator": "FP.CPI.TOTL.ZG", "year": "2024", "lang": "en"}).json()
print(ans["headline"])
for row in ans["table"]["rows"][:10]:
    print(row["name"], row["value"])
for p in ans["provenance"]:
    print(p["name"], p["license"], p["fetched_at"], p["cache"])

R — Canada's trade redirection (licensed)

library(httr2)
ans <- request("https://geonia.warin.ca/api/v1/questions/trade-redirection/answer") |>
  req_url_query(dropped_importer = "United States", dropped_exporter = "China", product = "all") |>
  req_headers("X-API-Key" = Sys.getenv("GEONIA_API_KEY")) |>
  req_perform() |>
  resp_body_json()
ans$headline

SQL — query the warehouse directly (licensed)

curl -s -X POST https://geonia.warin.ca/api/v1/sql \
  -H "X-API-Key: $GEONIA_API_KEY" -H "Content-Type: application/json" \
  -d '{"query": "SELECT product_label, count(*) AS markets FROM cca_export WHERE cca_tau > 0 GROUP BY 1 ORDER BY 2 DESC LIMIT 10"}'

Raw live data

curl -s "https://geonia.warin.ca/api/v1/data/wdi/SP.POP.TOTL?countries=CAN;MEX;USA&date=2000:2024"
curl -s "https://geonia.warin.ca/api/v1/data/fred/DEXCAUS?start=2024-01-01"
curl -s "https://geonia.warin.ca/api/v1/data/imf/NGDP_RPCH?countries=CAN,USA"
curl -s "https://geonia.warin.ca/api/v1/data/bis/policy-rates?start=2024-01"

Endpoints

GET/api/v1/questions
Catalogue by research direction
GET/api/v1/questions/{id}
Parameters, sources, method and caveats
GET/api/v1/questions/{id}/options/{param}
Valid values of a dynamic parameter
GET/api/v1/questions/{id}/answer
Answer: headline, map, chart, table, notes, provenance (format=json|csv)
GET/api/v1/sources
Sources, licences and access classes
GET/api/v1/places/{level}/{code}
Indicators for a place at its level: world/WLD, region/SSF, economy/KEN, subnational/CA-QC (indicators=a,b,c)
GET/api/v1/geo/countries
Country boundaries (GeoJSON)
GET/api/v1/layers/ports · /layers/mines
Context layers (GeoJSON)
GET/api/v1/data/{wdi|fred|imf|bis}/…
Live pass-through to public sources, cached with provenance
GET/api/v1/local/summary · /firms · /employment · /supply-chain · /traffic?bbox=w,s,e,n
Street level: firms (REQ), industries & location quotients, Québec supply chains, estimated jobs grid, MTMD traffic
GET/api/v1/local/gdp?bbox=w,s,e,n&calibrate=true
Québec GDP per grid cell, downscaled from GDP by industry with REQ jobs and calibrated to StatCan GDP by CMA; cells refine with the box
GET/api/v1/units?bbox=w,s,e,n&level=da|ct|csd|iris|com&indicator=&sector=
Census units in view — Québec (REQ) or Île-de-France (SIRENE, IRIS and communes) — with indicators, estimated GDP, aggregate statistics and quarterly series
GET/api/v1/panel/sirene?level=idf|com|iris&uid=|bbox=&start=2000Q1&format=csv
Quarterly SIRENE establishment panel for Île-de-France (active, creations, closures, salaried jobs), newest first
GET/api/v1/panel/req?level=qc|csd|ct|da&uid=|bbox=&start=1996Q1&format=csv
Quarterly REQ panel (active, entries, exits, jobs) by census unit and sector, newest first
GET/api/v1/local/weather?lat=&lon=
Current weather and 3-day outlook (Open-Meteo)
GET/api/v1/live/vessels?bbox=
Live AIS ships (aisstream.io key required)
GET/api/v1/data/statcan/search?q= · /{table} · /{table}/metadata · /{table}/series?members=a|b
Any Statistics Canada table, as the statcanR package does it
GET/api/v1/sql/schema
Warehouse tables (licensed)
POST/api/v1/sql
One read-only SELECT, 5,000 rows, 15 s (licensed)

Principles