# Lottery Odds API
> Lottery combinatorics as an API, computed locally and deterministically and exactly — the real odds behind a ticket, the maths the jackpot poster never shows. The odds endpoint gives the jackpot odds of a pick-N game as the number of possible tickets, C(pool, picks), times the bonus-ball pool if there is one: a 6/49 game is 1 in 13,983,816, a 5/69-plus-1/26 Powerball-style game is 1 in 292,201,338, and every single line is equally unlikely. The match-odds endpoint gives the chance of matching exactly k of the main numbers — a prize tier — from the hypergeometric formula C(picks, k)·C(pool−picks, picks−k) ÷ C(pool, picks), so matching 3 of 6 in a 6/49 game is about 1 in 57. The expected-value endpoint turns a jackpot and ticket price into the expected value and the break-even jackpot (price × the odds), the threshold a jackpot must clear before a ticket is even theoretically worth it — before a shared jackpot, lump-sum and tax pull it back under. Everything is computed locally and deterministically, so it is instant and exact. Ideal for lottery and odds apps, gambling-education and responsible-play tools, probability teaching, and game back-ends. Pure local computation — no key, no third-party service, instant. Exact combinatorics. Live, nothing stored. 3 compute endpoints. Educational — not gambling advice; the odds are always against you.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/lottery-api/..."
```

## Pricing
- **Free** (Free) — 8,000 calls/Mo, 2 req/s
- **Starter** ($3/Mo) — 100,000 calls/Mo, 8 req/s
- **Pro** ($11/Mo) — 400,000 calls/Mo, 20 req/s
- **Mega** ($36/Mo) — 1,750,000 calls/Mo, 48 req/s

## Endpoints

### Lottery

#### `GET /v1/expected-value` — Expected value of a ticket

**Parameters:**
- `jackpot` (query, required, string) — Jackpot amount Example: `100000000`
- `ticket_price` (query, required, string) — Ticket price Example: `2`
- `pool` (query, required, string) — Numbers in the main pool Example: `49`
- `picks` (query, required, string) — Numbers you pick Example: `6`
- `bonus_pool` (query, optional, string) — Bonus-ball pool size

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/lottery-api/v1/expected-value?jackpot=100000000&ticket_price=2&pool=49&picks=6"
```

**Response:**
```json
{
    "data": {
        "note": "Expected value ≈ jackpot × win probability − ticket price, counting the jackpot only. The break-even jackpot is price × the odds — but even when EV turns positive, a shared jackpot, lump-sum discounting and tax usually pull it back negative, and the odds of actually winning stay vanishingly small.",
        "inputs": {
            "pool": 49,
            "picks": 6,
            "jackpot": 100000000,
            "ticket_price": 2
        },
        "expected_value": 5.1511,
        "breakeven_jackpot": 27967632,
        "jackpot_odds_one_in": 13983816
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:38.935Z",
        "request_id": "42129a93-4dea-4ce2-8e4e-4e527405aa9b"
    },
    "status": "ok",
    "message": "Expected value",
    "success": true
}
```

#### `GET /v1/match-odds` — Odds of matching exactly k numbers

**Parameters:**
- `pool` (query, required, string) — Numbers in the main pool Example: `49`
- `picks` (query, required, string) — Numbers you pick Example: `6`
- `match` (query, required, string) — Numbers matched Example: `3`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/lottery-api/v1/match-odds?pool=49&picks=6&match=3"
```

**Response:**
```json
{
    "data": {
        "note": "Probability of matching exactly k numbers = C(picks, k) × C(pool − picks, picks − k) ÷ C(pool, picks) — the hypergeometric distribution. For a 6/49 game, matching 3 is about 1 in 57. This counts the main numbers only; a bonus ball splits each tier further.",
        "inputs": {
            "pool": 49,
            "match": 3,
            "picks": 6
        },
        "odds_one_in": 56.66,
        "probability": 0.017650403866870102,
        "ways_to_match": 246820,
        "total_combinations": 13983816
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:39.024Z",
        "request_id": "e8ff8053-953c-4b1d-80ed-0b65995b5e28"
    },
    "status": "ok",
    "message": "Match odds",
    "success": true
}
```

#### `GET /v1/odds` — Jackpot odds of a pick-N game

**Parameters:**
- `pool` (query, required, string) — Numbers in the main pool Example: `49`
- `picks` (query, required, string) — Numbers you pick Example: `6`
- `bonus_pool` (query, optional, string) — Bonus-ball pool size
- `bonus_picks` (query, optional, string) — Bonus numbers picked (default 1)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/lottery-api/v1/odds?pool=49&picks=6"
```

**Response:**
```json
{
    "data": {
        "note": "Jackpot odds = the number of possible tickets, C(pool, picks), times the bonus-ball pool if there is one. A 6/49 game is 1 in 13,983,816; a 5/69 + 1/26 (Powerball-style) is 1 in 292,201,338. Every line is equally unlikely — past numbers, 'hot' numbers and lucky picks change nothing.",
        "inputs": {
            "pool": 49,
            "picks": 6,
            "bonus_pool": null
        },
        "odds_one_in": 13983816,
        "probability": 7.151123842018516e-8,
        "total_combinations": 13983816
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:39.116Z",
        "request_id": "6f7d76ae-6aa6-4f41-86ac-2f9ec9fe3e9f"
    },
    "status": "ok",
    "message": "Jackpot odds",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/lottery-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "notes": "Jackpot = C(pool,picks)×bonus; tier = C(picks,k)·C(pool−picks,picks−k)/C(pool,picks); EV = jackpot/odds − price. Exact combinatorics. Educational — not gambling advice.",
        "service": "lottery-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/odds": "Jackpot odds = C(pool, picks) × bonus pool.",
            "GET /v1/match-odds": "Odds of matching exactly k of the main numbers (a prize tier).",
            "GET /v1/expected-value": "Expected value and break-even jackpot of a ticket."
        },
        "description": "Lottery combinatorics: jackpot odds for a pick-N game, the odds of matching exactly k numbers, and the expected value of a ticket."
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:39.174Z",
        "request_id": "9302c5d5-239c-4504-a195-c4f6da948c80"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/lottery-api
OpenAPI spec: https://www.oanor.com/api/lottery-api/openapi.json
