guides

Odds API Python tutorial: your first call in 5 steps

By · Published · Updated · 3 min read

This tutorial takes you from zero to odds from several sportsbooks in Python, in 5 steps. The first two steps need no API key, so you can see the books, leagues and markets before you sign up.

You need Python 3 and the requests package (pip install requests).

Step 1: list the books without a key

Six endpoints are public: /v1/books, /v1/sports, /v1/leagues, /v1/markets, /v1/coverage and /v1/status. Start with the books.

import requests

BASE = "https://api.pricedodds.com/v1"

books = requests.get(f"{BASE}/books", timeout=10).json()["data"]
for book in books:
    print(book["id"], "|", book["name"], "|", book["type"], "|", ",".join(book["features"]))

Each book has an id such as draftkings or fanduel. You use those ids in every later call. The features list says whether the book has prematch, live and props.

Step 2: list leagues and market keys

Leagues and markets also use readable ids. Read them from the API and do not guess them.

sports = requests.get(f"{BASE}/sports", timeout=10).json()["data"]
for sport in sports:
    for league in sport["leagues"]:
        print(sport["id"], "|", league["id"], "|", league["name"], "|", league["events"], "events")

catalog = requests.get(f"{BASE}/markets", params={"sport": "basketball"}, timeout=10).json()["data"]
print(catalog["periods"])
for market in catalog["markets"]:
    print(market["key"], "|", market["name"], "|", "/".join(market["sides"]))

A league with 0 events has no games in the current window. In the coverage file generated on November 28, 2026, 17:22 UTC that was the case for 178 leagues, among them MLB, WNBA, ATP Tour, WTA Tour and League of Legends, which are in the catalog with observed: false. Whether a league has data depends on season and schedule: the feed window is the next 7 days plus live games (21 days for MMA and boxing cards). To search leagues by name, call GET /v1/leagues: it needs no key and takes sport, q and active=true, as listed in the docs.

Step 3: get a key and pick your books

Start the 3-day free trial at /signup. The $1 card verification is refunded immediately. The plan you pick is charged from day 4 unless you cancel before the trial ends. Copy your key into an environment variable. Keep the key on your server and never put it in a URL: the API rejects keys in URLs.

export PRICEDODDS_API_KEY="your-key-here"

Then choose the books your plan includes. Solo covers any 2.

import os

HEADERS = {"Authorization": f"Bearer {os.environ['PRICEDODDS_API_KEY']}"}

r = requests.post(f"{BASE}/account/books", headers=HEADERS,
                  json={"books": ["draftkings", "fanduel"]}, timeout=10)
print(r.status_code, r.json())

You can change the selection once every 24 hours. A second change inside that window returns book_change_too_soon.

Step 4: find games

List NBA events. Every response has the same shape: data, asOf and next.

resp = requests.get(f"{BASE}/events", headers=HEADERS, params={"league": "nba"}, timeout=10).json()

for event in resp["data"]:
    print(event["id"], "|", event["away"]["name"], "@", event["home"]["name"], "|", event["startsAt"], "|", event["status"])

next_cursor = resp["next"]  # pass it as cursor= to get the next page; None on the last page

Event ids start with evt_. Store them as they are.

Step 5: get odds from every book you picked

Ask for one event. The response lists each market, each side, and one price per book.

event_id = resp["data"][0]["id"]

odds = requests.get(f"{BASE}/events/{event_id}/odds", headers=HEADERS,
                    params={"markets": "moneyline,spread,total"}, timeout=10).json()["data"]

for market in odds["markets"]:
    for sel in market["selections"]:
        prices = ", ".join(f'{p["book"]} {p["american"]:+d}' for p in sel["prices"])
        best = sel["best"]
        print(market["market"], market["period"], sel["side"], sel.get("line"), "|", prices,
              "| best:", best["book"], best["american"])

Show american to users and do math with decimal. Spread lines are per side: if the home team is -4.5, the away team is +4.5.

What should I do when a call fails?

Errors come back as JSON with a code, a message and a fix. Check the status code before you read data.

r = requests.get(f"{BASE}/events", headers=HEADERS, params={"league": "nba"}, timeout=10)
if r.status_code == 429:
    wait = int(r.headers.get("Retry-After", "1"))
    print("rate limited, wait", wait, "seconds")
elif not r.ok:
    err = r.json()["error"]
    print(err["code"], "|", err["message"], "|", err["fix"])

The three errors you will meet first:

CodeWhat it meansFix
missing_keyNo key was sentSend the Authorization header
book_not_in_planYou asked for a book outside your selectionRemove it or add it to your books
rate_limitedYou went over your plan's requests per secondWait Retry-After seconds

Solo allows 1 request per second, Starter 3, Growth 5 and All-Access 10.

Where do I go next?

  • Player props: GET /v1/events/{id}/props?markets=player_points.
  • Best line across books: GET /v1/best?league=nba&market=moneyline.
  • Live prices without polling: the WebSocket pushes each price change.
  • What is covered: every book, league and market is on the coverage page.
  • Plans: from $39 a month for any 2 books. See pricing.

PricedOdds is a data API, not a sportsbook. The data is informational, and the Terms prohibit using it to accept or price wagers.

The fields and endpoints behind these calls are in what the sports betting odds API returns. Other leagues work the same way, for example NFL odds through the same calls. If you are coming from The Odds API, that page sets the two side by side.

The same script works for hockey: see the NHL odds API for its markets.

To try the same calls from a terminal first, follow the curl quickstart.

To build other requests without typing the parameters, pick the endpoint, league, books and markets in the API request builder and copy the URL.