Get a free key

Use case: alert bots

Odds API for Discord and Telegram alert bots

A line-move bot is three moves on repeat: fetch the prices, compare them with last time, and post whatever shifted far enough to matter. Here is a working one in about thirty lines.

line_move_bot.py
import os
import time
import requests

API = "https://api.sockodds.com/v1/odds"
HEADERS = {"Authorization": f"Bearer {os.environ['SOCKODDS_KEY']}"}
WEBHOOK = os.environ["DISCORD_WEBHOOK_URL"]
MOVE = 0.10  # post when a decimal price moves by ten cents or more

last = {}  # (outcome ID, bookmaker) -> last decimal price seen

while True:
    r = requests.get(API, headers=HEADERS, timeout=20,
                     params={"league": "nrl", "markets": "winner"})
    if r.status_code == 429:
        time.sleep(int(r.headers.get("retry-after", 60)))
        continue
    r.raise_for_status()
    for event in r.json()["data"]:
        for market in event["markets"]:
            for o in market["outcomes"]:
                for p in o["prices"]:
                    if not p["available"]:
                        continue
                    key = (o["id"], p["bookmaker"])
                    before, now = last.get(key), p["decimal_odds"]
                    last[key] = now
                    if before and abs(now - before) >= MOVE:
                        text = (f'{event["name"]} | {p["bookmaker"]} {o["name"]} {before} to {now} '
                                f'(seen {p["observed_at"][11:16]} UTC)')
                        requests.post(WEBHOOK, json={"content": text}, timeout=10)
    time.sleep(300)  # five minutes, SockOdds' suggested poll for games 3 to 24 hours away

For Telegram, swap the webhook post for the Bot API's sendMessage with your bot token and chat ID. Everything else stays the same.

Design notes

What makes a bot people keep

  • Poll at a sensible pace. SockOdds states no single refresh interval, so a loop faster than every few minutes mostly finds the same prices and spends credits on them.
  • Post moves, not noise. A threshold in cents or in implied percentage keeps the channel readable. Moves on the favourite's side usually matter more than a long shot drifting.
  • Say which book and how old. Each price has its own observed_at; include it, so readers know what they are looking at.
  • Key on the outcome ID. An outcome keeps its ID on every poll, and each of its prices names its bookmaker, so the outcome ID and the bookmaker are all the state a bot needs.
  • Back off politely. A 429 carries retry-after; sleep that long and carry on. Rejected calls are not billed.

How much quota does a bot use? Every plan counts credits, as SockOdds's pricing page reads on 18 November 2026: an odds call costs a credit per market returned, per region billed, and a league's featured markets, the head to head among them, count once for each page of up to 25 games. Asked for the head to head in one region (regions=au), an eight-game NRL round is one credit a poll, so every five minutes for twelve hours a day is 1 × 12 × 12 × 30 = 4,320 credits a month, inside Starter's 30,000; around the clock is twice that. With neither regions nor bookmakers set, every ten books in the answer bill one region, so the same poll at every book costs a few times as much. Polling only on game days, or only from a few hours before kick-off, cuts usage sharply. Try your numbers in the calculator

Questions

Bots and the API

Step by step: build an odds alert bot for Discord that survives restarts and follows line moves, with the full tested file.

Is there a push or WebSocket option instead of polling?

Pro includes a WebSocket stream at /v1/stream/odds: one event, or up to 20 in a league, checked every 15 seconds and sent as a snapshot when something changed, with a heartbeat that costs nothing when nothing did. It saves you writing a loop; the prices are the ones the REST routes serve.

Can the bot run on the free plan?

For building and testing, yes: the NRL is on the free plan in season, and at one credit a poll its 1,000 credits a month last about 1,000 polls, under seven days at twelve hours a day. For a bot that runs for real, plan on Starter or above.

Can I alert on player props?

Yes. Add a prop's market key, such as player_disposals_over_under, to markets and the bot watches it for every player. Watch the line as well as the price: books often move the number rather than the odds, and here a new number is a new market, so a line move shows as one line going and another arriving.

Start now

Your first Australian price is one request away.

Free key, no card, AFL and NRL included. Keys are issued on sockodds.com.