Guides
Pagination
The /v2/events endpoint can return thousands of results. Results are delivered in batches using cursor-based pagination.
How It Works
- Make a request. Each request returns up to
limititems. - If more items are available, the response includes a
nextCursorfield. - Repeat the request with
cursor=<nextCursor value>to get the next page. - Continue until no
nextCursoris returned — you've reached the end.
The cursor Parameter
- Always use the value exactly as returned — don't modify it.
- Don't change other query parameters between paginated requests.
- If you pass a
cursorand receive a 404, you've reached the end of the results.
The limit Parameter
- Default is
10if not specified. - Maximum is
300. - The effective limit may be lower depending on query complexity (e.g. including alt lines reduces it).
1 object = 1 event, regardless of how many odds markets are returned inside it. 10 events = 10 objects against your quota, even if each event contains hundreds of odds.
Example — Fetch All Open Kalshi Events
JavaScript
const allEvents = [];
let nextCursor = null;
let hasMore = true;
while (hasMore) {
try {
const params = new URLSearchParams({
bookmakerID: "kalshi",
oddsAvailable: "true",
limit: "100",
...(nextCursor ? { cursor: nextCursor } : {}),
});
const response = await fetch(
`https://api.sportsgameodds.com/v2/events?${params}`,
{ headers: { "x-api-key": YOUR_API_KEY } }
);
const data = await response.json();
allEvents.push(...data.data);
nextCursor = data.nextCursor;
hasMore = Boolean(nextCursor);
} catch {
hasMore = false;
}
}
console.log(`Fetched ${allEvents.length} events`);Python
import requests
all_events = []
next_cursor = None
has_more = True
while has_more:
params = {
"bookmakerID": "kalshi",
"oddsAvailable": "true",
"limit": 100,
}
if next_cursor:
params["cursor"] = next_cursor
data = requests.get(
"https://api.sportsgameodds.com/v2/events",
headers={"x-api-key": YOUR_API_KEY},
params=params
).json()
all_events.extend(data.get("data", []))
next_cursor = data.get("nextCursor")
has_more = next_cursor is not None
print(f"Fetched {len(all_events)} events")Always set limit as high as your use case allows before adding cursor pagination — fewer round trips means faster ingestion and fewer requests against your quota.