Skip to main content

Data hierarchy

Market data on SX Bet is organized in a hierarchy. Understanding this structure will help you navigate the API efficiently.
LevelEndpointDescriptionFilter by
SportsGET /sportsAll sports available on SX Bet
LeaguesGET /leagues/activeActive leagues for a given sportsportId
FixturesGET /fixture/activeActive games/events for a given leagueleagueId
MarketsGET /markets/activeBettable binary outcomes for a given fixturesportIds, eventId, leagueId, type, onlyMainLine
OrdersGET /ordersActive maker orders on a marketmarketHashes, maker, sportXeventId, orderHash

Try it yourself

Run the script below in your terminal. It walks you through the full hierarchy interactively — select a sport, then a league, then a fixture, and it will display all available main-line markets for that fixture.
import requests

BASE_URL = "https://api.sx.bet"  # Mainnet — use https://api.toronto.sx.bet for testnet

# Step 1: Fetch and display all sports
sports = requests.get(f"{BASE_URL}/sports").json()["data"]
print("=== Sports ===")
for s in sports:
    print(f"  [{s['sportId']}] {s['label']}")

sport_id = int(input("\nEnter a sport ID: "))

# Step 2: Fetch active leagues for the selected sport
leagues = requests.get(
    f"{BASE_URL}/leagues/active",
    params={"sportId": sport_id}
).json()["data"]

print("\n=== Active Leagues ===")
for l in leagues:
    print(f"  [{l['leagueId']}] {l['label']}")

league_id = int(input("\nEnter a league ID: "))

# Step 3: Fetch active fixtures for the selected league
fixtures = requests.get(
    f"{BASE_URL}/fixture/active",
    params={"leagueId": league_id}
).json()["data"]

print("\n=== Active Fixtures ===")
for f in fixtures:
    home = f.get("participantOneName", "N/A")
    away = f.get("participantTwoName", "N/A")
    print(f"  [{f['eventId']}] {home} vs {away}{f['startDate']}")

event_id = input("\nEnter an event ID: ")

# Step 4: Fetch main-line markets for the selected fixture
markets = requests.get(
    f"{BASE_URL}/markets/active",
    params={"eventId": event_id, "onlyMainLine": True}
).json()["data"]["markets"]

print(f"\n=== Markets ({len(markets)} found) ===")
for m in markets:
    print(f"  {m['outcomeOneName']} vs {m['outcomeTwoName']}")
    print(f"    marketHash: {m['marketHash']}")

Sports

SX Bet covers a wide range of sports. Each sport is identified by a numeric sportId. Pass a sportId to other endpoints (such as /leagues/active) to filter results by sport.
sportIdSport
1Basketball
2Hockey
3Baseball
4Golf
5Soccer
6Tennis
7Mixed Martial Arts
8Football
9E Sports
10Novelty Markets
11Rugby Union
12Racing
13Boxing
14Crypto
15Cricket
16Economics
17Politics
18Entertainment
20Rugby League
24Horse Racing
26AFL
This list may not be exhaustive. Query GET /sports for the full, up-to-date list.

Leagues

SX Bet supports many leagues across all sports. Each league is identified by a leagueId. There are two ways to fetch leagues:
  1. GET /leagues/active — Returns only leagues that currently have active fixtures. Pass a sportId to filter by sport.
  2. GET /leagues — Returns all leagues supported by SX Bet, including those without any active fixtures. Also accepts an optional sportId filter.

Fixtures

A fixture on SX Bet represents an individual game or event — for example, Toronto Raptors vs. Detroit Pistons on March 10th, 2026. Many markets exist for any given fixture. To fetch active fixtures, query GET /fixture/active with a leagueId. Each fixture is identified by a unique eventId. Example fixture response:
{
  "participantOneName": "William Jewell",
  "participantTwoName": "Indianapolis",
  "startDate": "2020-11-28T03:45:00.000Z",
  "status": 1,
  "leagueId": 2,
  "leagueLabel": "NCAA",
  "sportId": 1,
  "eventId": "L6217784"
}
The startDate field contains the scheduled start time of the game in UTC. The status field indicates the current state of the fixture:
Status IDNameDescription
1Not startedThe event has not started yet
2In progressThe event is live
3FinishedThe event has finished
4CancelledThe event has been cancelled
5PostponedThe event is postponed. If a new start time is confirmed within 48 hours, it will revert to “Not started”. Otherwise, it will be cancelled.
6InterruptedThe event has been interrupted (e.g. a rain delay). Coverage will resume under the same event ID.
7AbandonedThe event has been abandoned and will not resume (e.g. a player injury in tennis).
8Coverage lostCoverage for this event has been lost
9About to startThe event is about to start (shown up to 30 minutes before tip-off)
The following endpoints use sportXeventId instead of eventId as a query parameter: GET /trades/consolidated, GET /ordersThe following endpoints use sportXEventIds instead of eventId as a query parameter: GET /live-scores, GET /fixture/status

Markets

A market represents a single binary outcome you can bet on — for example, “Over 2.5 Total Goals” vs. “Under 2.5 Total Goals”. Many markets exist for any given fixture. Every market on SX Bet is identified by a unique marketHash, which is used throughout the API to fetch orderbooks, post orders, and query trades.

Fetch Markets

Learn how to query active markets from the SX Bet API