# Nylottery — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Access New York Lottery draw results, historical winning numbers, and scratch-off game information. Retrieve number frequency statistics, search for nearby retailers, and browse recent winners across all available games.

**Category:** Government & Public Data | **Website:** [nylottery.ny.gov/](https://nylottery.ny.gov/) | **Docs:** [parse.bot/marketplace/fcea17aa-08d4-47e2-955e-f77fe4d6a63d/nylottery-ny-gov-api](https://parse.bot/marketplace/fcea17aa-08d4-47e2-955e-f77fe4d6a63d/nylottery-ny-gov-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-nylottery-ny-gov-api-fcea17aa/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_game_draws

Get recent draw results for a specific lottery game. Returns the latest 10 draws with winning numbers (primary and secondary arrays), jackpot estimates, multipliers, and draw metadata. The draws array is ordered by draw time descending.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `game` | string | Yes | Name of the lottery game. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-nylottery-ny-gov-api-fcea17aa/get_game_draws \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"game":"<string>"}'
```

### get_historical_results

Fetch historical winning numbers for a game from data.ny.gov open data. Supports date range filtering and pagination via offset. Returns draw records ordered by draw_date descending. Each record contains draw_date, winning_numbers as a space-separated string, and game-specific bonus fields (mega_ball, cash_ball, multiplier, double_play_winning_numbers).

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `end_date` | string | No | End date filter in ISO format YYYY-MM-DD. |
| `game` | string | Yes | Name of the lottery game. |
| `limit` | integer | No | Maximum number of records to return. |
| `offset` | integer | No | Pagination offset (number of records to skip). |
| `start_date` | string | No | Start date filter in ISO format YYYY-MM-DD. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-nylottery-ny-gov-api-fcea17aa/get_historical_results \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"end_date":"<string>","game":"<string>","limit":"<integer>","offset":"<integer>","start_date":"<string>"}'
```

### get_latest_draws

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.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-nylottery-ny-gov-api-fcea17aa/get_latest_draws \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_number_frequency

Calculate the frequency of winning numbers for a specific game based on the most recent N historical draws. Returns sorted arrays of number frequency data for main and bonus numbers. Useful for identifying hot and cold numbers over a configurable lookback window.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `game` | string | Yes | Name of the lottery game. |
| `lookback` | integer | No | Number of recent draws to analyze. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-nylottery-ny-gov-api-fcea17aa/get_number_frequency \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"game":"<string>","lookback":"<integer>"}'
```

### get_recent_winners

Get a paginated list of recent lottery winners with prize details, winner name, location, date, and full story. Each winner entry includes the game logo, prize amount and type, and an HTML body with the full announcement. Pages are 0-indexed with 10 items per page.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `page` | integer | No | Page number for pagination (0-indexed). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-nylottery-ny-gov-api-fcea17aa/get_recent_winners \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"page":"<integer>"}'
```

### get_scratch_off_games

List all active scratch-off games with pricing, top prizes, odds, and remaining prize information. Returns the full catalog of available scratch-off tickets including game number, ticket price, top prize amount, number of top prizes remaining, and overall odds of winning.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-nylottery-ny-gov-api-fcea17aa/get_scratch_off_games \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### search_retailers

Find lottery retailers near a specific latitude and longitude. Returns paginated results with retailer name, street address, city, state, ZIP code, and geographic coordinates. The default search center is Manhattan, New York City.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `lat` | string | No | Latitude of the search center point. |
| `lon` | string | No | Longitude of the search center point. |
| `miles` | string | No | Search radius in miles. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-nylottery-ny-gov-api-fcea17aa/search_retailers \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lat":"<string>","lon":"<string>","miles":"<string>"}'
```
