Mega Millions API
Get Mega Millions winning numbers within minutes of each draw on paid plans (about an hour after the draw on the free plan), with the jackpot, and on paid plans the cash value and next jackpot estimate. The Business tier and above includes every draw since 17 May 2002. There is no official public Mega Millions API; this data comes from official state lottery publications and is cross-checked against a second source.
Mega Millions is served by the Lottery API with game=megamillions.
Available endpoints:
- /v1/lottery - Latest draw, or any date with
date - /v1/lotteryhistorical - Past draws
- /v1/lotterycheck - Check a ticket
Mega Millions at a glance
| Format | 5 white balls from 1-70 + 1 Mega Ball from 1-24 |
|---|---|
| Draws | Tuesday and Friday, 11:00 pm ET |
| Ticket price | $5, with a built-in 2x-10x multiplier |
| Jackpot odds | 1 in 290,472,336 |
| Archive | From 17 May 2002 |
Number-format history
| Effective | Format |
|---|---|
| 2025-04-08 | 5 from 1-70 + Mega Ball 1-24; $5 with built-in multiplier |
| 2017-10-31 | 5 from 1-70 + Mega Ball 1-25 |
| 2013-10-22 | 5 from 1-75 + Mega Ball 1-15 |
| 2005-06-22 | 5 from 1-56 + Mega Ball 1-46 |
| 2002-05-15 | 5 from 1-52 + Mega Ball 1-52 |
https://api.api-ninjas.com/v1/lottery
Returns the latest draw for a game, the draw on a given date, or the latest draw of every game in a US state or a country. On paid plans results usually appear within minutes of the official publication; on the free plan they appear about 60 minutes later.
Full parameter and response reference: /v1/lottery.
Live Demo
Get a free API key to get started — no credit card required.
Code Examples
curl -X GET "https://api.api-ninjas.com/v1/lottery?game=megamillions" \
-H "X-Api-Key: YOUR_API_KEY"https://api.api-ninjas.com/v1/lotteryhistorical
Returns past draws for a game, newest first. The free plan gets the latest 10 draws (each visible about 60 minutes after the draw); Developer plans a rolling two years; Business tier and above the full archive.
Full parameter and response reference: /v1/lotteryhistorical.
Live Demo
Get a free API key to get started — no credit card required.
Code Examples
curl -X GET "https://api.api-ninjas.com/v1/lotteryhistorical?game=megamillions" \
-H "X-Api-Key: YOUR_API_KEY"Premium only
https://api.api-ninjas.com/v1/lotterycheck
Scores a ticket against a draw and returns the matched prize tier and prize. Supports Powerball (with Power Play and Double Play), Mega Millions (with the ticket's built-in multiplier) and Millionaire for Life. Ticket numbers are never stored. The result is not a prize claim.
Full parameter and response reference: /v1/lotterycheck.
Live Demo
Get a free API key to get started — no credit card required.
Code Examples
curl -X GET "https://api.api-ninjas.com/v1/lotterycheck?game=megamillions&date=2026-10-02&numbers=6,37,40,1,2&bonus=10" \
-H "X-Api-Key: YOUR_API_KEY"Frequently Asked Questions
Can I use the Mega Millions API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Mega Millions API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Mega Millions API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Mega Millions API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.Is there an official Mega Millions API?
No. Mega Millions does not publish a public developer API. The API Ninjas Lottery API provides Mega Millions results, jackpots and history from official state lottery publications. API Ninjas is not affiliated with or endorsed by Mega Millions.How do I get the latest Mega Millions winning numbers?
Call/v1/lottery?game=megamillions. The response includes the five white balls, the Mega Ball and the jackpot for that draw. Paid plans also get the cash value and the estimated jackpot for the next draw, within minutes of the draw; on the free plan results appear about an hour after the draw.How does the API handle the April 2025 Mega Millions changes?
Since 8 April 2025 tickets cost $5, the Mega Ball range is 1 to 24, and every ticket carries a built-in 2x to 10x multiplier instead of the optional Megaplier. Each draw'srules_versiontells you which rules applied. The ticket checker (paid plans) takes the ticket's printedmultiplier; without it, it returns the prize range.How far back does Mega Millions history go?
Our archive starts with the draw of 17 May 2002, covering every change of number format since. The full history is available on the Business tier and above; Developer plans get the last two years.
Explore API integration use cases for recommended APIs and workflow examples.
API Ninjas is not affiliated with or endorsed by any lottery operator. Powerball and Mega Millions are trademarks of their respective owners. Results are compiled from publicly available lottery results; in any discrepancy the official lottery's records prevail, so always verify winning tickets with the official lottery.