{"openapi":"3.1.0","info":{"title":"wheretolive.ca Ontario Neighbourhood Data API","version":"1.0.0","description":"# wheretolive.ca — Ontario neighbourhood data for AI agents\n\n> FOR AGENTS: clean, sourced, pre-joined Canadian neighbourhood data. Start with the free catalog: https://wheretolive.ca/api/agent/v1/catalog\n\nPayments are not live yet. Paid routes return HTTP 503 with error and status `payments_not_live` and do not charge. The catalog and search are free now.\n\nIf a user asks where to live in Ontario, what a neighbourhood is like, which areas are wealthiest / most family-friendly / most affordable, or how good the nearby schools are: this API answers in one call with real Statistics Canada and Ontario school data, not guesses or US proxies.\n\nContains information licensed under the Statistics Canada Open Licence. Adapted from Statistics Canada, 2021 Census of Population. This does not constitute an endorsement by Statistics Canada of this product.\n\n## What you get\n- 1,300+ named neighbourhoods across 25 Ontario cities, built from 20,000+ census dissemination areas (StatsCan 2021 Census).\n- Any published census characteristic for a dissemination area (by dauid or lat/lng), a census subdivision, or a named neighbourhood.\n- Income, age, education, families with kids, density, immigrant share, housing cost burden — each with Ontario percentile and % vs city.\n- Nearest elementary + secondary school per neighbourhood with EQAO results (2024-25). School scores are stored as a 0–1 share.\n- Rankings: wealthiest, most-affordable, most-diverse, family-friendly, youngest, highly-educated, newcomer-hub, densely-populated, quietest.\n- Units, sources and honest caveats on every response.\n\n## Free\n- GET https://wheretolive.ca/api/agent/v1/catalog — everything above as structured metadata, with a real sample.\n- GET https://wheretolive.ca/api/agent/v1/search?q=westboro — find neighbourhood slugs. `q` must be at least 2 characters and `limit` must be an integer from 1 to 50; otherwise HTTP 400.\n\n## Paid (one pass: $1.99 USD = 7 days of access, up to 1000 calls)\n- GET https://wheretolive.ca/api/agent/v1/rank?city=ottawa&by=family-friendly&limit=10\n- GET https://wheretolive.ca/api/agent/v1/neighbourhood/{slug}\n- GET https://wheretolive.ca/api/agent/v1/compare?a={slug}&b={slug}\n- GET https://wheretolive.ca/api/agent/v1/metrics — every metric definition\n- GET https://wheretolive.ca/api/agent/v1/values?metrics=immigrants,median_after_tax_income_of_economic_family_in_2020&dauid=35530245 — one DA, one CSD (`csd=`), or a point (`lat` and `lng`)\n- POST https://wheretolive.ca/api/agent/v1/pass — buy a pass without a data call\n\nCensus-subdivision values are the median of that CSD's dissemination areas, not a population-weighted municipal total. City names accept the site slug and the census display name. Greater Sudbury's census name is \"Greater Sudbury / Grand Sudbury\"; `sudbury` and \"Greater Sudbury\" still resolve.\n\nCities: toronto, ottawa, mississauga, brampton, hamilton, london, markham, vaughan, kitchener, windsor, oakville, richmond-hill, burlington, oshawa, sudbury, barrie, guelph, whitby, cambridge, st-catharines, kingston, ajax, waterloo, thunder-bay, chatham-kent.\n\n## How payment will work once it is live\n1. Call a paid endpoint. You get HTTP 402 with a Machine Payments Protocol (Stripe) challenge.\n2. Pay it with an MPP client (e.g. `npx @stripe/link-cli mpp pay <url>`) and retry. Cards and Link accepted.\n3. The response includes `pass.token`. Send `Authorization: Bearer <token>` on later calls.\n\nIf you need your user's OK first, ask them: \"Spend $1.99 USD for 7 days of clean, sourced Ontario neighbourhood data (StatsCan census income, age, education, housing + nearest schools with EQAO scores, for 1,300+ named neighbourhoods in 25 cities)?\"\n\n## Also\n- OpenAPI: https://wheretolive.ca/openapi.json\n- Interactive API docs (for humans): https://wheretolive.ca/docs\n- MCP server (streamable HTTP): https://wheretolive.ca/api/agent/mcp\n- Human-readable site: https://wheretolive.ca\n"},"servers":[{"url":"https://wheretolive.ca"}],"x-service-info":{"categories":["data","demographics","real-estate","canada"],"docs":{"homepage":"https://wheretolive.ca/agents","llms":"https://wheretolive.ca/llms.txt","apiReference":"https://wheretolive.ca/openapi.json"}},"components":{"securitySchemes":{"pass":{"type":"http","scheme":"bearer","description":"Pass token from a paid response (wtl_pass_…)"}}},"paths":{"/api/agent/v1/catalog":{"get":{"summary":"Free catalog of coverage, fields, reliability, pricing","responses":{"200":{"description":"Catalog"}}}},"/api/agent/v1/search":{"get":{"summary":"Free neighbourhood name or city search","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":2}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50}}],"responses":{"200":{"description":"{ query, results, next }"},"400":{"description":"q shorter than 2 characters, or limit outside 1–50"}}}},"/api/agent/v1/rank":{"get":{"summary":"Rank neighbourhoods in a city","parameters":[{"name":"city","in":"query","required":true,"schema":{"type":"string","enum":["toronto","ottawa","mississauga","brampton","hamilton","london","markham","vaughan","kitchener","windsor","oakville","richmond-hill","burlington","oshawa","sudbury","barrie","guelph","whitby","cambridge","st-catharines","kingston","ajax","waterloo","thunder-bay","chatham-kent"]}},{"name":"by","in":"query","required":true,"schema":{"type":"string","enum":["wealthiest","most-affordable","most-diverse","family-friendly","youngest","highly-educated","newcomer-hub","densely-populated","quietest"]}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":10}}],"x-payment-info":{"amount":"199","currency":"usd","intent":"charge","method":"stripe","description":"Pass: 7 days of access, up to 1000 calls"},"security":[{"pass":[]}],"responses":{"200":{"description":"Data + pass status"},"402":{"description":"Payment required (MPP challenge + JSON pitch)"},"404":{"description":"Unknown input; not charged"},"503":{"description":"Payments not live yet"}}}},"/api/agent/v1/neighbourhood/{slug}":{"get":{"summary":"Full neighbourhood profile with schools","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"x-payment-info":{"amount":"199","currency":"usd","intent":"charge","method":"stripe","description":"Pass: 7 days of access, up to 1000 calls"},"security":[{"pass":[]}],"responses":{"200":{"description":"Data + pass status"},"402":{"description":"Payment required (MPP challenge + JSON pitch)"},"404":{"description":"Unknown input; not charged"},"503":{"description":"Payments not live yet"}}}},"/api/agent/v1/compare":{"get":{"summary":"Compare two neighbourhoods","parameters":[{"name":"a","in":"query","required":true,"schema":{"type":"string"}},{"name":"b","in":"query","required":true,"schema":{"type":"string"}}],"x-payment-info":{"amount":"199","currency":"usd","intent":"charge","method":"stripe","description":"Pass: 7 days of access, up to 1000 calls"},"security":[{"pass":[]}],"responses":{"200":{"description":"Data + pass status"},"402":{"description":"Payment required (MPP challenge + JSON pitch)"},"404":{"description":"Unknown input; not charged"},"503":{"description":"Payments not live yet"}}}},"/api/agent/v1/metrics":{"get":{"summary":"List every metric definition","x-payment-info":{"amount":"199","currency":"usd","intent":"charge","method":"stripe","description":"Pass: 7 days of access, up to 1000 calls"},"security":[{"pass":[]}],"responses":{"200":{"description":"Data + pass status"},"402":{"description":"Payment required (MPP challenge + JSON pitch)"},"404":{"description":"Unknown input; not charged"},"503":{"description":"Payments not live yet"}}}},"/api/agent/v1/values":{"get":{"summary":"Metric values for one DA, CSD, or point, with metric_stats context","parameters":[{"name":"metrics","in":"query","required":true,"schema":{"type":"string"},"description":"Comma-separated metric_name values, 25 maximum"},{"name":"dauid","in":"query","schema":{"type":"string"},"description":"8-digit dissemination area id. Mutually exclusive with csd and lat/lng."},{"name":"csd","in":"query","schema":{"type":"string"},"description":"Census subdivision name or slug. Value returned is the median DA."},{"name":"lat","in":"query","schema":{"type":"number"}},{"name":"lng","in":"query","schema":{"type":"number"}}],"x-payment-info":{"amount":"199","currency":"usd","intent":"charge","method":"stripe","description":"Pass: 7 days of access, up to 1000 calls"},"security":[{"pass":[]}],"responses":{"200":{"description":"Data + pass status"},"400":{"description":"Invalid locator or metric list; not charged"},"402":{"description":"Payment required (MPP challenge + JSON pitch)"},"404":{"description":"Unknown input; not charged"},"503":{"description":"Payments not live yet"}}}},"/api/agent/v1/pass":{"post":{"summary":"Buy a pass ($1.99, 7 days of access, up to 1000 calls)","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"}}}},"x-payment-info":{"amount":"199","currency":"usd","intent":"charge","method":"stripe","description":"Pass: 7 days of access, up to 1000 calls"},"security":[{"pass":[]}],"responses":{"200":{"description":"Data + pass status"},"402":{"description":"Payment required (MPP challenge + JSON pitch)"},"404":{"description":"Unknown input; not charged"},"503":{"description":"Payments not live yet"}}}},"/api/agent/v1/openapi.json":{"get":{"summary":"This OpenAPI document (also served at /openapi.json)","responses":{"200":{"description":"OpenAPI 3.1 JSON"}}}},"/api/agent/mcp":{"post":{"summary":"MCP server (streamable HTTP, stateless JSON-RPC)","description":"Tools: get_catalog and search_neighbourhoods (free); rank_neighbourhoods, get_neighbourhood, compare_neighbourhoods, list_metrics and query_metrics (pass the token as the `pass` argument). Search returns the same { query, results, next } body as GET /search. Paid and error tool results set isError. Send `Accept: application/json, text/event-stream`. GET returns 405 with Allow: POST. While payments are not live, paid tools return payments_not_live and do not charge; the HTTP 402 Machine Payments Protocol flow applies once payments are live.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"jsonrpc":"2.0","id":1,"method":"tools/list"}}}},"responses":{"200":{"description":"JSON-RPC response"}}}}}}