SX BetSX BetBlog
Beginnerpython

SX Bet API Quickstart: Fetch Live Sports Odds in 5 Minutes (No API Key Needed)

Fetch live sports odds from SX Bet's free public API in under 5 minutes — no API key, no registration. Python and curl examples included.

5 minutes · 6 min read · April 9, 2026 · by Declan

SX Bet API Quickstart: Fetch Live Sports Odds in 5 Minutes (No API Key Needed)

TL;DR SX Bet's read-only API requires no key and no account. You can fetch live markets, odds, and orderbook data with a single HTTP call. Base URL: https://api.sx.bet. Full docs: docs.sx.bet. This guide gets you from zero to live data in under 5 minutes.


Most sports betting APIs make you register, wait for approval, and manage an API key before you see a single odds number. SX Bet's public API works differently: read-only endpoints are fully open, with no key, no OAuth token, and no registration required.

This quickstart walks through:

  1. Why the SX Bet API requires no key for read access
  2. Your first API call — fetching active markets in Python and curl
  3. Fetching best odds for a specific market
  4. Reading the response structure
  5. Using the testnet for safe development
  6. Next steps: adding write access for placing bets

Why No API Key Is Needed

SX Bet is a peer-to-peer sports prediction market. Market data — prices, orderbook depth, trades — is genuinely public information, the same way on-chain data is public on any blockchain. Restricting read access would only slow down integrations without providing any real business benefit.

Practically, this means:

  • No account creation for data access
  • No rate limit tiers tied to your account status (rate limits apply globally — see docs.sx.bet/developers/rate-limits)
  • No key rotation or expiry to manage
  • No billing setup before you can build

Write access — placing and cancelling orders — requires signing with your Ethereum wallet private key. But if you are building an odds feed, an arbitrage scanner, or any read-only analytics tool, you are ready to start right now.


Step 1: Your First API Call

Base URL: https://api.sx.bet

Testnet (for development): https://api.toronto.sx.bet

Fetch all active NFL markets:

curl

curl "https://api.sx.bet/markets/active?sportIds=1"

Python

import requests

BASE_URL = "https://api.sx.bet"

def get_active_markets(sport_id: int) -> list:
    url = f"{BASE_URL}/markets/active"
    params = {"sportIds": sport_id}
    response = requests.get(url, params=params)
    response.raise_for_status()
    return response.json().get("data", [])

# Sport IDs: 1=NFL, 2=NBA, 3=MLB, 4=NHL, 5=soccer, 6=UFC, etc.
# Check docs.sx.bet for the full sport ID list
markets = get_active_markets(sport_id=1)
print(f"Found {len(markets)} active NFL markets")
for market in markets[:3]:
    print(f"  {market['gameLabel']} — {market['type']}")

That is the entire setup. No imports beyond requests, no auth headers, no token management.


Step 2: Understanding the Markets Response

A market object contains:

{
  "marketHash": "0x3f2a...",
  "gameLabel": "Chiefs vs Eagles",
  "startDate": 1744300800000,
  "type": "moneyline",
  "sportId": 1,
  "leagueId": 101,
  "status": "ACTIVE",
  "outcomes": [
    {"label": "Chiefs", "index": 1},
    {"label": "Eagles", "index": 2}
  ]
}

Key fields:

Field What it tells you
marketHash Unique market identifier — use this to fetch odds
gameLabel Human-readable fixture description
startDate Unix timestamp in milliseconds
type moneyline, spread, total, alt_spread, alt_total
status ACTIVE (pre-game) or LIVE (in-play)
outcomes Participants and their outcome index (1 or 2)

Step 3: Fetch Best Odds for a Market

Once you have a marketHash, fetch the current best back and lay odds:

def get_best_odds(market_hash: str) -> dict:
    url = f"{BASE_URL}/orders/odds/best"
    params = {"marketHash": market_hash}
    response = requests.get(url, params=params)
    response.raise_for_status()
    return response.json().get("data", {})

# Use a marketHash from Step 1
sample_hash = markets[0]["marketHash"]
odds = get_best_odds(sample_hash)
print(f"Market: {markets[0]['gameLabel']}")
print(f"Best back odds (outcome 1): {odds.get('bestBettingOdds', {}).get('1')}")
print(f"Best back odds (outcome 2): {odds.get('bestBettingOdds', {}).get('2')}")

Odds are returned in percentage format (basis points out of 1e12). To convert to decimal odds:

def pct_to_decimal(pct_odds: str) -> float:
    """Convert SX Bet percentage odds to decimal odds."""
    return 1 / (int(pct_odds) / 1e12)

# Example: 500000000000 → 2.0 decimal (evens / +100 American)
decimal_odds = pct_to_decimal("500000000000")
print(f"Decimal odds: {decimal_odds:.2f}")

Step 4: Full Working Script

Here is a complete script that fetches active markets and prints odds for the first three:

import requests

BASE_URL = "https://api.sx.bet"

def get_active_markets(sport_id: int) -> list:
    response = requests.get(
        f"{BASE_URL}/markets/active",
        params={"sportIds": sport_id}
    )
    response.raise_for_status()
    return response.json().get("data", [])

def get_best_odds(market_hash: str) -> dict:
    response = requests.get(
        f"{BASE_URL}/orders/odds/best",
        params={"marketHash": market_hash}
    )
    response.raise_for_status()
    return response.json().get("data", {})

def pct_to_decimal(pct_odds: str) -> float:
    return round(1 / (int(pct_odds) / 1e12), 3)

def main():
    print("Fetching active NFL markets...")
    markets = get_active_markets(sport_id=1)
    print(f"Found {len(markets)} markets\n")

    for market in markets[:3]:
        market_hash = market["marketHash"]
        label = market["gameLabel"]
        market_type = market["type"]

        odds_data = get_best_odds(market_hash)
        best_odds = odds_data.get("bestBettingOdds", {})

        print(f"{label} ({market_type})")
        for outcome_index, outcome_info in zip(["1", "2"], market["outcomes"]):
            raw = best_odds.get(outcome_index)
            if raw:
                decimal = pct_to_decimal(raw)
                print(f"  {outcome_info['label']}: {decimal:.3f}")
        print()

if __name__ == "__main__":
    main()

Run it:

pip install requests
python quickstart.py

No .env file, no config, no credentials.


Step 5: Use the Testnet During Development

Before building anything that will eventually execute trades, switch to the testnet:

BASE_URL = "https://api.toronto.sx.bet"  # Testnet
# BASE_URL = "https://api.sx.bet"        # Production

The testnet mirrors the production API structure and supports wallet signing. Run your full order placement, cancellation, and heartbeat logic against testnet before going live. No real funds are needed or at risk.


Step 6: Real-Time Odds via WebSocket

REST polling works well for low-frequency strategies. For live trading or dashboards that need sub-second updates, use SX Bet's Centrifugo WebSocket:

import asyncio
from centrifuge import Client, SubscriptionEventHandler, PublicationEvent

async def on_odds_update(event: PublicationEvent, ctx):
    data = event.data
    print(f"Odds update: {data}")

async def stream_odds(market_hash: str):
    client = Client("wss://api.sx.bet/centrifugo/connection/websocket")
    await client.connect()

    sub = await client.new_subscription(
        f"best_odds:{market_hash}",
        SubscriptionEventHandler(on_publication=on_odds_update)
    )
    await sub.subscribe()
    print(f"Streaming odds for {market_hash}...")

    await asyncio.sleep(300)  # Stream for 5 minutes
    await client.disconnect()

# asyncio.run(stream_odds("0x..."))

Full WebSocket guide: Real-Time Sports Odds via WebSocket


Next Steps

You now have live sports odds in Python. Depending on what you are building:

Goal Next step
Build a trading bot How to Build a Sports Betting Bot in Python
Add real-time odds Real-Time Sports Odds via WebSocket
Understand the full API surface Sports Betting Exchange API: Complete Developer Guide
Explore all endpoints docs.sx.bet/api-reference/introduction

Frequently Asked Questions

Q: Does this work without any account? A: Yes. All read endpoints — markets, odds, orderbook, trades, live scores — work without an account or API key.

Q: What sports are available? A: NFL, NBA, MLB, NHL, soccer, UFC, tennis, esports, and cricket (including IPL). Check docs.sx.bet for the full sport ID list.

Q: Are there usage limits on the free API? A: Rate limits apply. See docs.sx.bet/developers/rate-limits for current limits by endpoint.

Q: How do I add write access to place bets? A: You need an Ethereum-compatible wallet. Place orders using EIP-712 signed messages. Full guide: docs.sx.bet/developers/quickstart.


Read the full quickstart at docs.sx.bet/developers/quickstart →

Build on SX Bet's Open API

No API key required. Fetch live odds, markets, and orderbook data with a single HTTP call.