Odds & Markets API
Quickstart
From an Odds & Markets API key to a priced market and its implied probabilities in five steps.
Get a key
Keys for the Odds & Markets API are issued by the ALT Sports Data account team. There is no self-serve sign-up. Your account team also sets up which competitions the key returns. See Authentication.
export ALTSPORTSDATA_API_KEY="your_key_here"
export ODDS_BASE_URL="https://api.altsportsdata.com/api/v1/public"Call this API from your server. It does not answer browser calls from other websites (CORS), and a key in a browser or mobile app is visible to anyone who looks.
List the sports your key can see
GET /sports returns every sport and competition on your key, with the markets each one supports.
curl -s "$ODDS_BASE_URL/sports" -H "X-API-Key: $ALTSPORTSDATA_API_KEY"import os
import httpx
BASE = os.environ.get("ODDS_BASE_URL", "https://api.altsportsdata.com/api/v1/public")
HEADERS = {"X-API-Key": os.environ["ALTSPORTSDATA_API_KEY"]}
def get(path: str, params: dict | None = None):
resp = httpx.get(f"{BASE}{path}", headers=HEADERS, params=params, timeout=30)
resp.raise_for_status()
body = resp.json()
return body["data"] if isinstance(body, dict) and "data" in body else body
for sport in get("/sports"):
print(sport["competitionKey"], sport["competitionName"], sport["supportedMarkets"])const BASE = process.env.ODDS_BASE_URL ?? "https://api.altsportsdata.com/api/v1/public";
async function get(path: string, params?: URLSearchParams) {
const url = new URL(`${BASE}${path}`);
if (params) url.search = params.toString();
const resp = await fetch(url, { headers: { "X-API-Key": process.env.ALTSPORTSDATA_API_KEY! } });
if (!resp.ok) throw new Error(`HTTP ${resp.status} ${await resp.text()}`);
const body = await resp.json();
return body.data ?? body;
}
const sports = await get("/sports");
for (const s of sports) console.log(s.competitionKey, s.competitionName, s.supportedMarkets);Pick a competitionKey (for example wsl) whose supportedMarkets includes eventWinner. The response may
arrive wrapped in an object with the rows in data; the helpers above unwrap it either way.
List upcoming events for one competition
Send eventStatus in the array form, eventStatus[]=UPCOMING, even for a single status. A plain
eventStatus=UPCOMING has been observed to return 400.
curl -s -G "$ODDS_BASE_URL/events" \
--data-urlencode "competition=wsl" \
--data-urlencode "eventStatus[]=UPCOMING" \
--data-urlencode "sortOrder=ASC" \
-H "X-API-Key: $ALTSPORTSDATA_API_KEY"events = get("/events", {"competition": "wsl", "eventStatus[]": ["UPCOMING"], "sortOrder": "ASC"})
for event in events:
print(event["id"], event["name"], event["eventStatus"], event["startDate"])const params = new URLSearchParams({ competition: "wsl", sortOrder: "ASC" });
params.append("eventStatus[]", "UPCOMING");
const events = await get("/events", params);
for (const e of events) console.log(e.id, e.name, e.eventStatus, e.startDate);Event IDs are UUIDs, often prefixed with the sport key (for example nrx:2127ea10-…). Pass them back exactly
as returned. Check eventStatus on each event as well. More in Events and status.
Get the winner market for one event
GET /events/{eventId}/eventWinner returns one row per athlete with a decimal price, a probability and a
market status.
EVENT_ID="<id from step 3>"
curl -s "$ODDS_BASE_URL/events/$EVENT_ID/eventWinner" \
-H "X-API-Key: $ALTSPORTSDATA_API_KEY"event_id = events[0]["id"]
market = get(f"/events/{event_id}/eventWinner")
rows = market["eventWinner"]
for row in rows:
print(row["athlete"]["lastName"], row["odds"], row["status"])const eventId: string = events[0].id;
const market = await get(`/events/${eventId}/eventWinner`);
const rows: Array<{ athlete: { lastName: string }; odds: number; status: string }> = market.eventWinner;
for (const r of rows) console.log(r.athlete.lastName, r.odds, r.status);A 404 here means the event has no odds for that market yet. Accept bets only on rows whose status is
OPEN. See Markets and money lines for every oddType.
Convert decimal odds to implied probability
Odds are decimal. Implied probability is 1 / odds. Because the price includes a margin, the implied
probabilities of a full market add up to a little more than 1. Divide each by the total to remove it.
implied = {row["athlete"]["lastName"]: 1 / row["odds"] for row in rows if row["odds"]}
total = sum(implied.values())
print(f"margin: {total - 1:.2%}")
for name, p in implied.items():
print(f"{name}: implied {p:.1%}, margin-free {p / total:.1%}")const implied = rows.filter((r) => r.odds).map((r) => ({ name: r.athlete.lastName, p: 1 / r.odds }));
const total = implied.reduce((sum, x) => sum + x.p, 0);
console.log(`margin: ${((total - 1) * 100).toFixed(2)}%`);
for (const x of implied) {
console.log(`${x.name}: implied ${(x.p * 100).toFixed(1)}%, margin-free ${((x.p / total) * 100).toFixed(1)}%`);
}Next steps
- Authentication: how the key works and how to keep it safe.
- Errors and limits: the error body, status codes and polling.
- API reference: one page per endpoint, generated from the live spec.