Getting started
From subscribing on RapidAPI to running in production.
Subscribe on RapidAPI
Sign in to RapidAPI, open USA Lottery Result (All State) API and pick a plan on the pricing page. The Basic plan is free and includes 500 requests a month. RapidAPI then shows your key in the playground and in your app's security settings.
Base URL
https://usa-lottery-result-all-state-api.p.rapidapi.com/All endpoints are GET, return application/json and require HTTPS.
Authentication
Send two headers with every request. Keep the key on your server; never put it in a browser or mobile app.
| Header | Value |
|---|---|
x-rapidapi-key | Your RapidAPI application key |
x-rapidapi-host | usa-lottery-result-all-state-api.p.rapidapi.com |
curl --request GET \
--url 'https://usa-lottery-result-all-state-api.p.rapidapi.com/lottery-results/states' \
--header 'x-rapidapi-host: usa-lottery-result-all-state-api.p.rapidapi.com' \
--header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY'const res = await fetch("https://usa-lottery-result-all-state-api.p.rapidapi.com/lottery-results/states", {
method: "GET",
headers: {
"x-rapidapi-key": process.env.RAPIDAPI_KEY,
"x-rapidapi-host": "usa-lottery-result-all-state-api.p.rapidapi.com"
}
});
const json = await res.json();
console.log(json.data);$ch = curl_init("https://usa-lottery-result-all-state-api.p.rapidapi.com/lottery-results/states");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"x-rapidapi-host: usa-lottery-result-all-state-api.p.rapidapi.com",
"x-rapidapi-key: " . getenv("RAPIDAPI_KEY"),
],
]);
$data = json_decode(curl_exec($ch), true)["data"];import os, requests
r = requests.get(
"https://usa-lottery-result-all-state-api.p.rapidapi.com/lottery-results/states",
params={},
headers={
"x-rapidapi-key": os.environ["RAPIDAPI_KEY"],
"x-rapidapi-host": "usa-lottery-result-all-state-api.p.rapidapi.com",
},
)
print(r.json()["data"])Quota & limits
Every call counts as one request against your plan's monthly quota. All plans have a hard limit: when the quota is used up, requests are refused until the next billing month or until you upgrade. The free Basic plan also allows at most 1,000 requests an hour. RapidAPI's usage dashboard shows how many requests you have left.
Response format
Every response uses the same envelope. Your data is always in data, either an object or an array.
{
"status": "success",
"message": "ok",
"systemTime": 1762732800,
"rowCount": 7,
"data": [ … ]
}| Field | Meaning |
|---|---|
status | success or failure |
message | Human-readable message |
systemTime | Server Unix time of the response |
rowCount | Number of rows in data |
Errors
Check the HTTP status first. On an API-level failure, status is failure and message explains why.
| HTTP | Meaning | What to do |
|---|---|---|
| 400 | Missing or invalid parameter | Check that state is a two-letter code and gameID is a number |
| 401 / 403 | Key missing or wrong, or no active subscription | Send both RapidAPI headers and subscribe to a plan, even the free one |
| 429 | Monthly quota used up or hourly limit reached | Wait, cache more, or move to a larger plan |
| 5xx | Temporary service problem | Retry with backoff |
IDs & workflow
stateCode comes from State List and drives State Game List. gameID is the id in State Game List and drives every game endpoint. drawID comes from Past Draws and opens a specific draw in Drawing Result.
Multi-state games have one gameID per selling state; statesWithMultiDraws lists the states that share the same draw. The historical endpoints use their own gameIDs from the historical Game List.
History coverage
Past Draws covers the last 365 days of every game. The historical endpoints (Game List and Historical Data Result) hold older results, up to 13 November 2023.
Dates & timezones
drawDate and drawTime are in the game's local time; drawTimezone holds the IANA zone, such as America/New_York. Use drawTimestamp (Unix seconds) to compare draws across states. claimDeadline is the number of days a winner has to claim.
Protect your key
Call the API from your own server and pass only the data on to your users. Store the key in an environment variable, not in your code repository. If a key leaks, generate a new one in your RapidAPI app settings; the old key stops working.
Caching
Lottery results change only after a draw. Cache State List and game lists for a day, and fetch Drawing Result a few minutes after each game's drawTime. A single-state results site fits comfortably in the Pro plan this way.