Skip to content

Developers

Public data API

A read-only REST API for historical Canadian draw results, frequency statistics and period comparisons. Data is historical only — nothing here predicts future draws.

Authentication

Every data endpoint requires an API key. Create one on your API keys page (sign-in required) and send it in the x-api-key header. Keys are stored hashed, can be revoked at any time, and usage is counted per key.

curl "https://aithelottery.ca/api/public/v1/draws?lottery=lotto-max&limit=5" \
  -H "x-api-key: ail_your_key_here"

Responses are JSON with permissive CORS, so browser clients work too. Errors return { error, status } with 401 (missing/invalid key), 403 (revoked), 400 (bad parameters) or 404 (no data).

GET/api/public/v1/lotteries

Game catalogue with number pools and draw days. No API key required.

ParameterDescription
No parameters
curl "https://aithelottery.ca/api/public/v1/lotteries"
GET/api/public/v1/draws

Historical draw results, newest first.

ParameterDescription
lotteryRequired. One of: lotto-max, lotto-649, daily-grand, ontario-49, encore
fromOptional YYYY-MM-DD lower bound on draw date
toOptional YYYY-MM-DD upper bound on draw date
limitOptional 1–2000, default 100
curl "https://aithelottery.ca/api/public/v1/draws?lottery=lotto-649&from=2024-01-01&limit=50" \
  -H "x-api-key: $AITHELOTTERY_KEY"
GET/api/public/v1/stats

Frequency index per number plus hot, cold and overdue rankings, odd/even, high/low and decade distributions, and sum ranges.

ParameterDescription
lotteryRequired game id
fromOptional YYYY-MM-DD lower bound
toOptional YYYY-MM-DD upper bound
takeOptional 1–50 size of hot/cold/overdue lists, default 10
curl "https://aithelottery.ca/api/public/v1/stats?lottery=lotto-max&take=15" \
  -H "x-api-key: $AITHELOTTERY_KEY"
GET/api/public/v1/compare

Side-by-side comparison of two date ranges: per-number frequency deltas, biggest risers and fallers, and distribution summaries for each period.

ParameterDescription
lotteryRequired game id
a_from / a_toRequired YYYY-MM-DD bounds for period A
b_from / b_toRequired YYYY-MM-DD bounds for period B
curl "https://aithelottery.ca/api/public/v1/compare?lottery=lotto-649\
&a_from=2023-01-01&a_to=2023-12-31\
&b_from=2024-01-01&b_to=2024-12-31" \
  -H "x-api-key: $AITHELOTTERY_KEY"

Fair use and accuracy

  • Up to 10 active keys per account; each request is logged against your key.
  • Responses are cached for 60 seconds — cache on your side where possible.
  • Always verify winning numbers with the official lottery operator before claiming any prize. This API is for analysis and education only.
  • Statistics describe past draws. No frequency, streak or overdue figure changes the odds of a future draw.

Important: This website does not guarantee winning numbers. AI-generated suggestions are based on historical statistics and probability analysis for informational and entertainment purposes only. Lottery results are random. Need support? Call ConnexOntario at 1-866-531-2600.