Get a free key

Use case: odds comparison

Odds comparison API for Australian bookmakers

Show punters the best price on a game across the Australian books, and how fresh each price is. One request per league gives you all of it.

The recipe

From response to price table

  1. Request a league, filtered to the markets you display with markets.
  2. Group every bookmaker's outcomes by outcome ID: one outcome keeps one ID whichever book is quoting it.
  3. Sort each group by decimal_odds and mark the top one.
  4. Hide quotes where available is false.
  5. Show each price's age from observed_at, such as "seen 2 min ago".
  6. Put Pinnacle or the Betfair Exchange beside the best price, so a reader can see how far it sits from the sharpest view.

Why it is less work here

One market, one shape, every book

Comparison sites usually spend their effort on matching: is "Sydney Swans v Collingwood" at one book the same game as "Sydney vs Collingwood Magpies" at another, and is their "Line" the same market as someone else's "Handicap"? In this feed that matching is already done. Each game has one event ID, and each outcome shows up a single time holding all the books' quotes, highest first, so the books come already aligned.

Lines and totals are matched too. Each number is its own market, so two books share an outcome ID only when they hang the same line, and a table never ranks a price at 40.5 against one at 44.5.

Code

A best-price table in Python

best_prices.py
import os
import requests

resp = requests.get(
    "https://api.sockodds.com/v1/odds",
    params={"league": "afl", "markets": "winner"},
    headers={"Authorization": f"Bearer {os.environ['SOCKODDS_KEY']}"},
    timeout=20,
)
resp.raise_for_status()

for event in resp.json()["data"]:
    print(event["name"])
    # Every book's price per outcome, best first: an outcome appears once.
    for market in event["markets"]:
        if market["period"] != "full":
            continue
        for o in market["outcomes"]:
            live = [p for p in o["prices"] if p["available"]]
            if not live:
                continue
            others = ", ".join(f"{p['decimal_odds']} {p['bookmaker']}" for p in live[1:4])
            print(f"  {o['name']}: best {live[0]['decimal_odds']} at {live[0]['bookmaker']}")
            print(f"    then {others}")

Publishing prices

If your table faces the public

Your key belongs on the server, never in the browser: visitors read from your own cache or database, refreshed every few minutes. That also means a traffic spike on your site never becomes a spike in API calls.

If you publish prices to punters in Australia, wagering advertising rules and responsible gambling messaging may apply to you, particularly if you earn from bookmaker affiliate links. Check your obligations before launch.

Which plan? A comparison on the free plan's leagues, the NFL, NBA, NBL and Premier League with the AFL, NRL and MLB in season, can start free with every book but bet365, within 1,000 credits a month. Every other league, and the credits to refresh through the day, start on Starter; bet365 needs Pro. Size your usage

Questions

Comparison builds

Can I compare props and alternate lines, not just head to head?

Yes. Player props, team props and alternate lines come in the same response, in the same bookmakers, markets and outcomes layout. Grouping by outcome ID keeps each number apart, since books hang different lines.

Which price formats are included?

Every quote has decimal_odds and its implied_probability. Australian readers expect decimal; if you want American or fractional too, the converter shows the arithmetic.

How fresh will my table be?

SockOdds states no fixed refresh, but withholds a quote over ten minutes old rather than showing it as current. Add your own refresh on top, every five minutes or so, and a reader can see prices up to about fifteen minutes old; each price's timestamp lets you say how old on the page.

Start now

Your first Australian price is one request away.

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