Live Odds and Scores From One API: Joining Prices and Game State by Event Id

How to put live odds and scores side by side from one API: what each half contains, joining them on one event id, comparing sportsbook odds in-play, handling suspensions when the score changes, and keeping historical sports odds after the final whistle.

By PreciseAPI Engineering

Published

A price without a score is half a story during a game. Home -3.5 means one thing at 0-0 in the first quarter and something else entirely down 10 with four minutes left. That is why every live sportsbook odds screen, in-play model and second-screen app shows live odds and scores together, and why the hardest part of building one is often not getting either feed but joining them: two providers, two sets of team names, two clocks.

This guide shows how to get both from one API and join them on one event id. It covers what each half contains, a working refresh loop that compares sports odds across books with the score and clock beside them, what happens to prices when the score changes, and how to keep historical sports odds once the game ends. The examples use PreciseAPI, a sports odds data API: it supplies prices and game state, and does not take bets or publish picks.

Why live odds and scores belong in one feed

When odds and scores come from different providers, you inherit a matching problem every game day. Team names differ, kickoff times differ by a few minutes, and a postponed game exists in one feed but not the other. Every mismatch is a game card with a price and no score, or the wrong score.

In PreciseAPI, scores and odds are two views of the same event object. The id returned by /v1/scores is the id in /v1/odds, /v1/best-lines and /v1/history, and it doesn't change when a game goes from scheduled to live to final. Joining the two is a dictionary lookup.

What the two halves contain

Live odds. /v1/odds returns every source's markets for each game, grouped by book, with the moneyline, spread and total by default for the full game and periods you request. In-play, books reprice constantly and suspend markets around scores and reviews; each market carries suspended and updated_at. The live odds API page covers in-play prices in detail.

Live scores. /v1/scores returns status, score ({ home, away }, or null when no score is known, never a placeholder 0-0), score_status and clock. In football, basketball and hockey the clock has display (such as Q4 7:05), seconds_left and running. Scores come from the sportsbooks' own in-play feeds, cross-checked: a new score is provisional until a second source reports it, then confirmed. The scores API page and the live scores guide list every field.

Live oddsLive scores
Endpoint/v1/odds, /v1/best-lines/v1/scores
Credits2 or 3 per request1 per request
Key fieldsprice, point, suspended, updated_atscore, score_status, clock, status
Join keyevent idevent id
Stream messagedeltaevent

Both need the Syndicate plan while a game is in progress. Edge and Sharp cover pre-game odds and final scores; they leave games in progress out of these endpoints, and asking for status=live returns 403 plan_feature_unavailable.

A live odds and scores board in Python

This loop refreshes live NFL scores and in-play moneylines from four books every 10 seconds, joins them on event id, and marks the best price for each side. Each refresh costs 3 credits (1 for scores, 2 for odds), which Syndicate's unlimited credits cover.

import os, time
import requests

API = "https://api.preciseapi.com/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['PRECISEAPI_KEY']}"}
BOOKS = "pinnacle,draftkings,fanduel,betmgm"

def get(path, **params):
    r = requests.get(f"{API}{path}", params=params, headers=HEADERS, timeout=10)
    r.raise_for_status()
    return r.json()["data"]

def decimal(american):
    return 1 + american / 100 if american > 0 else 1 + 100 / -american

while True:
    scores = {e["id"]: e for e in get("/scores", league="nfl", status="live")}
    odds = get("/odds", league="nfl", status="live", markets="moneyline",
               books=BOOKS, include_suspended="true")

    for ev in odds:
        game = scores.get(ev["id"], ev)          # same id in both responses
        s, c = game.get("score") or {}, game.get("clock") or {}
        print(f'{ev["away"]["abbr"]} {s.get("away", "-")} @ {ev["home"]["abbr"]} {s.get("home", "-")}'
              f'  {c.get("display", "")}  ({game.get("score_status") or "no score yet"})')

        quotes = {}                               # side -> [(book, price, suspended)]
        for book in ev["bookmakers"]:
            for m in book["markets"]:
                for o in m["outcomes"]:
                    quotes.setdefault(o["side"], []).append((book["id"], o["price"], m["suspended"]))
        for side, rows in quotes.items():
            open_rows = [r for r in rows if not r[2] and r[1] is not None]
            best = max((decimal(p) for _, p, _ in open_rows), default=None)
            cells = [f'{b} {"susp" if susp else p}{"*" if best and not susp and decimal(p) == best else ""}'
                     for b, p, susp in rows]
            print(f'   {side:5} ' + '  '.join(cells))
    time.sleep(10)

Three details are doing real work here:

If you only need the best price rather than every book, /v1/best-lines?league=nfl&status=live returns best_price and best_books per outcome for 3 credits, and the scores API page has a short game-card join built on it.

When the score changes, the prices pause

A sportsbook odds screen shows its most important behavior right after a score. Books suspend markets while they reprice, then reopen them at new numbers, often within seconds. In the data that looks like this:

  1. The score changes, at first with score_status: "provisional".
  2. Markets at several books turn suspended: true, or drop out of responses that don't ask for suspended markets.
  3. Markets reopen with new prices and a new updated_at, and spreads and totals often reopen at a new number.
  4. The score turns confirmed once a second source reports it.

Design for that sequence. Show suspended prices as suspended, not as the last number. Don't treat a game with one book open and three suspended as a real price comparison. And if anything you build reacts to scores, wait for confirmed or final. A score that goes down, such as an overturned touchdown, only appears once two sources agree, so a brief wrong score from one feed doesn't reach you.

For freshness rules stricter than "not suspended", max_source_age_ms drops any quote the source hasn't confirmed within that many milliseconds. The data model docs explain each timestamp.

Real time betting odds: polling or the stream

The loop above polls, which is the simplest way to start and is fine for a board refreshed every few seconds. For real time betting odds across many games, the WebSocket stream at /v1/stream is the better fit, and it is also on Syndicate. One connection sends a snapshot in the same shape as /v1/odds, then delta messages with only the markets that changed and event messages whenever a game's status, score, score status, clock or kickoff changes. Both arrive on one numbered sequence, so your board updates prices and scores from a single source of truth, and a gap in the numbers tells you to resync.

The odds screen tutorial builds that state store in Node.js, including the event handling, and the polling vs WebSockets post works through when the stream pays off. Between messages, a running clock can be counted down locally from seconds_left; the live scores guide shows how.

Pre-game boards on Edge and Sharp

Not every product needs in-play prices. A pre-game sports betting odds comparison page with yesterday's results beside today's lines works on Edge and Sharp:

# Today's pre-game prices, best per outcome
curl "https://api.preciseapi.com/v1/best-lines?league=nfl&status=scheduled&markets=moneyline,spread,total" \
  -H "Authorization: Bearer $PRECISEAPI_KEY"

# Games that finished in the last few hours
curl "https://api.preciseapi.com/v1/scores?league=nfl&status=final" \
  -H "Authorization: Bearer $PRECISEAPI_KEY"

Finished games stay in /v1/scores for at least four hours, so store results you want to keep. The line shopping guide covers comparing books before kickoff in more depth.

Historical sports odds after the final whistle

Once a game ends, the odds don't have to disappear with it. /v1/history returns the opening price, the current price and every recorded move for one book's main full-game moneyline, spread or total, and the moves after start_time are the in-play ones. Put them next to the score and you can see how a line reacted to each scoring drive.

History for a game in progress needs Syndicate; once the game is final, any paid plan can read it. It stays readable for 48 hours after a market's last change and is not a multi-season archive, so save it the same day. Look a finished game up by the market_id you kept from /v1/odds, since books take finished games' markets down. The historical odds API page covers the details, and the football betting data post designs a database for it.

Plans and cost

PlanLive odds and scoresPre-game odds and final scoresStream
Sandbox (free, 50 credits)NoPre-game odds, final scoresNo
Edge ($49.99/mo, 100,000 credits)NoYesNo
Sharp ($199.99/mo, unlimited)NoYesNo
Syndicate ($249.99/mo, unlimited)YesYesYes, 10 connections

See pricing for the full comparison, and the real-time odds screen use case for example architectures.

Frequently asked questions

Can I get live odds and scores from one API?

Yes. PreciseAPI's /v1/scores and /v1/odds return the same event object with the same id, so live scores, the game clock and every book's in-play prices join without matching team names. Games in progress are on the Syndicate plan.

How do I compare sports odds across books during a game?

Request /v1/odds with status=live and the books you want, group outcomes by side or selection id, and pick the best price in decimal odds while skipping suspended markets. /v1/best-lines does the comparison for you and returns the best price and the books offering it.

Why do live sportsbook odds disappear after a score?

Books suspend markets while they reprice. The feed marks them suspended: true, and leaves them out of responses unless you pass include_suspended=true. They reopen at new prices, often with a new spread or total number.

How fresh are live scores?

Scores come from the sportsbooks' own in-play feeds and are cross-checked. state_updated_at says when the sources read the score and clock, and a new score is provisional until a second source agrees.

Can I get historical sports odds for games that already finished?

For recent games, yes: /v1/history keeps the main full-game markets, in-play moves included, for 48 hours after a market's last change. It is not an archive of past seasons, so store what you need as games finish.

Keep reading