SX Bet API: Access Crypto Sports Exchange Odds (Python)
Looking for the SX Bet API? Here’s the Part Their Docs Bury
SX Bet is one of the few real sports betting exchanges left. Peer-to-peer, non-custodial, settled onchain on Polygon. No house, no cut on the winning side, actual sharp pricing. It’s exactly what you want if you’re building a trading bot.
Then you open their API docs and realize what “onchain P2P” actually costs you.
| Requirement | Reality |
|---|---|
| Wallet | You need a funded Polygon wallet signed into SX’s auth flow |
| Signatures | Every authenticated request signs an EIP-712 typed message |
| Market IDs | 32-byte hex hashes, not human names. You resolve them yourself. |
| Odds Format | Native format is 10^20-scaled implied probability, not decimal |
| Order Books | Cross-maker ladders you stitch together from the /orders endpoint |
| Other Bookmakers | SX Bet only. Want to compare vs Pinnacle or Betfair? Build a second integration. |
If all you want is the price, you’re building half an ETH wallet and a market resolver before you write your first line of betting logic.
The “Third Option” for SX Bet Odds
OddsPapi aggregates 350+ bookmakers behind one API key — and yes, SX Bet is one of them. No wallet, no EIP-712 signatures, no hex market hashes. You query ?bookmakers=sx.bet on a fixture and get the same back/lay prices SX is showing its users, already decoded into decimal odds with order book depth attached.
| Feature | SX Bet Direct API | OddsPapi |
|---|---|---|
| Auth | EIP-712 signed requests from a Polygon wallet | Single API key as query param |
| Wallet Required | Yes, funded on Polygon | No |
| Odds Format | Implied prob × 10^20 (you convert) | Decimal, ready to use |
| Other Exchanges | SX only | SX + Betfair + ProphetX + 4casters + Polymarket + Kalshi |
| Sharp Bookmakers | None | Pinnacle, SBOBet, Singbet included |
| Historical Data | Not offered | Included on free tier |
What SX Bet Actually Is (And Why Devs Care)
SX Bet is a peer-to-peer sports betting exchange running on the SX Network, a Polygon-based L2 purpose-built for prediction markets. It’s crypto-native — you deposit USDC, bets settle onchain, and makers/takers transact without a central sportsbook. Because the book is P2P, you get two things you don’t get from a traditional sportsbook:
- Back AND lay prices on every market — you can bet for or against an outcome.
- True order book depth — multiple price levels with the size available at each, not a single “fair price” quote.
That’s the data trading bots actually want. The problem is getting to it without writing an EIP-712 signer.
The JSON Shape (This Is the Part That Matters)
When you pull an SX Bet fixture through OddsPapi, every outcome hangs an exchangeMeta block off the main price. For active, tradable markets, that block is a back/lay ladder:
# SX Bet active-market exchangeMeta shape
{
"active": true,
"betslip": "https://sx.bet/events/L15956975",
"bookmakerOutcomeId": "0xa661c6ffde36bb293d13a1d4de9ed690eabdfeae33dce54449cd16f877d07ae5",
"price": 4.624,
"limit": 14.09,
"exchangeMeta": {
"back": [
{"price": 4.624, "size": 14.09, "limit": 14.09}
],
"lay": []
}
}
A few things to notice:
priceis already decimal odds. No 10^20 conversion. Divide 1 by it if you want implied probability.bookmakerOutcomeIdis the 32-byte SX market hash (0x...) — drop this straight into SX’s onchain calls if you need deep-book context.betslipis a direct deep link into the SX Bet UI for the event. Useful for building dashboards.limitis the size (in USDC) available at the top of the ladder.exchangeMeta.backand.laygive you the full ladder. Empty list on one side means that side has no open orders — not unusual for niche markets.
You will also see a second shape on inactive or reference markets, where exchangeMeta is a list of market-maker quotes instead of a back/lay object. Always check outcome['active'] before reading the ladder.
Tutorial: Get SX Bet Odds in Python
Step 1: Grab Your API Key
Sign up at oddspapi.io. Free tier. Authentication is one query parameter, no wallet connect.
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.oddspapi.io/v4"
Step 2: Find a Fixture with SX Bet Liquidity
SX Bet carries depth on soccer, MLB, NHL, tennis and MMA in particular. Grab tomorrow’s soccer fixtures and look for one that has odds.
from datetime import datetime, timezone, timedelta
today = datetime.now(timezone.utc)
params = {
"apiKey": API_KEY,
"sportId": 10, # Soccer
"from": today.strftime("%Y-%m-%d"),
"to": (today + timedelta(days=3)).strftime("%Y-%m-%d"),
}
fixtures = requests.get(f"{BASE_URL}/fixtures", params=params).json()
# Filter to fixtures that have odds available
candidates = [f for f in fixtures if f.get("hasOdds")]
print(f"{len(candidates)} soccer fixtures with odds")
Step 3: Fetch SX Bet Odds (Filtered)
Pass bookmakers=sx.bet to return only the exchange. Fetch multiple slugs in one call if you want side-by-side comparison.
fixture_id = candidates[0]["fixtureId"]
response = requests.get(
f"{BASE_URL}/odds",
params={
"apiKey": API_KEY,
"fixtureId": fixture_id,
"bookmakers": "sx.bet",
},
)
data = response.json()
sx = data.get("bookmakerOdds", {}).get("sx.bet")
if not sx:
print("SX Bet has no book on this fixture — try another.")
else:
print(f"{len(sx['markets'])} markets from SX Bet")
Step 4: Parse the Back/Lay Ladder
Market 101 is Full Time Result (1X2). Outcomes 101, 102, 103 are Home, Draw, Away.
market = sx["markets"]["101"]
labels = {"101": "Home", "102": "Draw", "103": "Away"}
for outcome_id, label in labels.items():
outcome = market["outcomes"].get(outcome_id)
if not outcome:
continue
player = outcome["players"]["0"]
if not player["active"]:
print(f"{label}: inactive")
continue
meta = player.get("exchangeMeta", {})
# Handle both shapes: {back: [...], lay: [...]} for active markets,
# or a list for reference quotes.
if isinstance(meta, dict):
back = meta.get("back", [])
lay = meta.get("lay", [])
best_back = back[0]["price"] if back else None
best_lay = lay[0]["price"] if lay else None
else:
best_back = player["price"]
best_lay = None
print(f"{label}: back @ {best_back} | lay @ {best_lay}")
Output:
Home: back @ 1.303 | lay @ None
Draw: back @ 4.624 | lay @ None
Away: back @ 2.156 | lay @ None
Step 5: Compare SX Bet vs Pinnacle in One Call
The whole point of the aggregator is that you can pull SX and a sharp in the same request and flag price differences instantly.
response = requests.get(
f"{BASE_URL}/odds",
params={
"apiKey": API_KEY,
"fixtureId": fixture_id,
"bookmakers": "sx.bet,pinnacle,betfair-ex",
},
)
books = response.json()["bookmakerOdds"]
for slug, data in books.items():
market = data.get("markets", {}).get("101", {})
home = market.get("outcomes", {}).get("101", {}).get("players", {}).get("0", {})
price = home.get("price")
print(f"{slug:12} home @ {price}")
Output:
sx.bet home @ 1.303
pinnacle home @ 1.32
betfair-ex home @ 1.31
Three exchanges and one sharp book in a single HTTP round trip. That’s the workflow.
Why Devs Choose OddsPapi Over SX Bet’s Direct API
No wallet required — You get SX’s pricing without touching a Polygon signer. If all you need is the read side of the API, this saves you the entire onchain plumbing layer.
Already decoded — Decimal odds, back/lay split, order book depth, and a deep link to the SX Bet event UI, all in one JSON blob.
350+ other bookmakers in the same response — SX Bet is great pricing, but you want to compare it against Pinnacle, Betfair Exchange, ProphetX, and whichever sharps you trust. One API, one call.
Free historical data — SX Bet doesn’t ship a historical API. OddsPapi does, and it’s free on the entry tier — hit /v4/historical-odds?fixtureId=...&bookmakers=sx.bet and backtest your exchange strategy.
Which Sports SX Bet Actually Covers
At the time of writing, SX Bet has consistent liquidity on:
| Sport | OddsPapi sportId |
Typical Coverage |
|---|---|---|
| Soccer | 10 | Full match + halves, major leagues |
| MLB | 13 | Moneyline, run lines, totals |
| NHL | 15 | Moneyline, puck line, totals |
| Tennis | 12 | Match winner, set winner |
| MMA | 20 | Fight winner |
Filter fixtures by sportId, then pull ?bookmakers=sx.bet on the ones that have hasOdds: true. Niche fixtures (lower leagues, obscure sports) will frequently return an empty book — that’s not an API failure, SX Bet’s P2P ladders just haven’t been quoted yet.
Get Started
Stop writing EIP-712 signers. Pull SX Bet odds with a single HTTP request.
- Sign up at oddspapi.io
- Copy your API key
- Pull SX Bet’s book in one curl
curl "https://api.oddspapi.io/v4/odds?apiKey=YOUR_KEY&fixtureId=id1000003761320199&bookmakers=sx.bet"
No wallet. No signed messages. No hex market hashes. Just decimal odds with the full back/lay ladder attached.