NY APInylottery.ny.gov ↗
Access NY Lottery draw results, historical winning numbers, scratch-off games, retailer locations, and recent winners via a structured JSON API.
What is the NY API?
This API covers 7 endpoints against nylottery.ny.gov, returning structured data for draw results, historical winning numbers, scratch-off game catalogs, retailer locations, and recent winner announcements. The get_game_draws endpoint returns the latest 10 draws per game including primary and secondary number arrays, jackpot estimates, and draw timestamps. Supported games include Powerball, Mega Millions, Cash4Life, Lotto, Take5, Win4, Numbers, Pick10, and QuickDraw.
No input parameters required.
curl -X GET 'https://api.parse.bot/scraper/9211b077-5bb6-4e8f-88f3-6e88cadf6d85/get_latest_draws' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace nylottery-ny-gov-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: NY Lottery SDK — bounded, re-runnable; every call capped."""
from parse_apis.new_york_lottery_api import NYLottery, LotteryGame, NotFoundError
nylottery = NYLottery()
# Get all games' latest draws at once
all_draws = nylottery.games.all_draws()
if all_draws.powerball:
print(all_draws.powerball.game_id, all_draws.powerball.next_draw)
if all_draws.megamillions:
print(all_draws.megamillions.game_id, all_draws.megamillions.last_draw)
# Get recent draws for a single game via constructible Game resource
game = nylottery.game(name=LotteryGame.POWERBALL)
draws_report = game.draws()
print(draws_report.game_id, draws_report.next_draw, draws_report.last_draw)
for draw in draws_report.draws[:3]:
print(draw.draw_number, draw.draw_time, draw.estimated_jackpot)
if draw.results:
for result in draw.results:
print(result.primary, result.secondary, result.multiplier)
# Analyze number frequency for Mega Millions
mega = nylottery.game(name=LotteryGame.MEGAMILLIONS)
freq = mega.number_frequency(lookback=100)
print(freq.game, freq.total_records_analyzed)
for num in freq.main_numbers[:5]:
print(num.number, num.count, num.frequency)
# List scratch-off games
for ticket in nylottery.scratchoffgames.list(limit=3):
print(ticket.title, ticket.ticket_price, ticket.overall_odds)
# Search for nearby retailers
for retailer in nylottery.retailers.search(lat="40.7128", lon="-74.0060", miles="2", limit=3):
print(retailer.title, retailer.field_street_address, retailer.field_city)
# Browse recent winners with typed error handling
try:
winner = nylottery.winners.list(limit=1).first()
if winner:
print(winner.name, winner.prize, winner.prize_type, winner.date, winner.location)
except NotFoundError as exc:
print(f"not found: {exc}")
print("exercised: games.all_draws / game.draws / game.number_frequency / scratchoffgames.list / retailers.search / winners.list")
Get latest draw results and jackpot information for all New York Lottery draw games. Returns a map of game names to their latest draws data including cash4life, powerball, lotto, megamillions, million4life, pick10, numbers, take5, win4, quickdraw, and raffle. Each game entry contains a draws array, next_draw timestamp, and last_draw timestamp.
No input parameters required.
{
"type": "object",
"fields": {
"lotto": "object with draws array, next_draw and last_draw timestamps for NY Lotto game",
"cash4life": "object with draws array, next_draw and last_draw timestamps for Cash4Life game",
"powerball": "object with draws array, next_draw and last_draw timestamps for Powerball game",
"megamillions": "object with draws array, next_draw and last_draw timestamps for Mega Millions game"
},
"sample": {
"data": {
"powerball": {
"draws": [
{
"status": 4,
"drawTime": 1781064000000,
"gameName": "powerball",
"drawNumber": 1958,
"estimatedJackpot": 238000000
}
],
"gameId": "15",
"last_draw": 1780970415000,
"next_draw": 1781143215000
},
"megamillions": {
"draws": [
{
"status": 4,
"drawTime": 1781236800000,
"gameName": "megamillions",
"drawNumber": 2513,
"estimatedJackpot": 413000000
}
],
"gameId": "12",
"last_draw": 1781056815000,
"next_draw": 1781316015000
}
},
"status": "success"
}
}About the NY API
Draw Results and Jackpots
get_latest_draws returns a map of game names to their current draw data — no parameters needed. Each game object includes a draws array plus next_draw and last_draw as Unix timestamps in milliseconds. For deeper per-game data, get_game_draws accepts a game string and returns the 10 most recent draws ordered descending by drawTime, with each draw object containing drawNumber, status, results.primary, results.secondary, and estimatedJackpot where applicable.
Historical Data and Frequency Analysis
get_historical_results pulls from the data.ny.gov open data dataset and supports start_date and end_date filters in YYYY-MM-DD format alongside limit and offset for pagination. Each item in the items array includes draw_date, winning_numbers as a space-separated string, and game-specific bonus fields. get_number_frequency builds on that history: supply a game name and optional lookback count to get main_numbers and bonus_numbers arrays sorted by frequency descending, each entry carrying number, count, and frequency. The response also includes total_records_analyzed so you know exactly how much data the calculation covers.
Scratch-Offs and Retailers
get_scratch_off_games returns the full active catalog via a rows array. Each row includes title, ticket_price, game_number, top_prize_amount, top_prize_remaining, and overall_odds — enough to filter by price tier or remaining top prizes. search_retailers accepts lat, lon, and miles parameters and returns paginated retailer records with title, field_street_address, field_city, field_state, field_zipcode, and field_geofield coordinates. The pager object reports total_items, total_pages, and items_per_page.
Recent Winners
get_recent_winners returns a paginated list of winner announcements. Each row includes name, prize, prize_type, date, location, a body field containing the full HTML announcement text, and image URLs for the game logo. Pages are 0-indexed with 10 items per page; the pager object provides navigation context.
The NY API is a managed, monitored endpoint for nylottery.ny.gov — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when nylottery.ny.gov changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official nylottery.ny.gov API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a lottery results dashboard that surfaces the latest jackpot estimates and winning numbers across all NY Lottery games using get_latest_draws.
- Create a number-frequency tracker that identifies statistically common draw numbers over a configurable lookback window with get_number_frequency.
- Populate a scratch-off comparison tool showing ticket prices, overall odds, and remaining top prizes from get_scratch_off_games.
- Build a retail store locator that returns nearby NY Lottery retailers within a given radius using search_retailers with lat/lon parameters.
- Archive historical Powerball or Mega Millions draw records with date-range filtering via get_historical_results for statistical analysis.
- Display a recent-winners feed with prize amounts, locations, and full announcement text pulled from get_recent_winners.
- Power a game-specific results page with the 10 most recent draw outcomes, multipliers, and draw status via get_game_draws.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.