Skip to content
SportsDataAPI Real-time sports data
Basketball 12 min read Feb 12, 2026

NBA Odds API: Real-Time Basketball Betting Data

Access real-time NBA odds, lines, and player props through dedicated basketball APIs. This guide covers the best providers, pricing, data formats, and working Python code to get started.

SportsDataAPI Team
NBA Odds API: Real-Time Basketball Betting Data

Whether you are building a betting dashboard, training a prediction model, or just want to check nba odds programmatically, a basketball odds API gives you structured access to the same data sportsbooks use to set their lines. This guide walks through the major betting markets, compares the top providers for NBA data, shows exactly what endpoints return, and includes a copy-paste Python example you can run in minutes.

NBA/Basketball Betting Markets Explained

Before pulling data from any API, it helps to understand the markets you will be working with. NBA odds cover everything from simple game-winner picks to granular player-level propositions.

Moneyline

The moneyline is the most straightforward basketball bet: pick which team wins. APIs return this as the h2h (head-to-head) market. In American odds format, a favorite might be listed at -180 while the underdog sits at +155. Every NBA odds API covers moneyline because it is the most requested market.

Point Spreads

Point spreads level the playing field by assigning a handicap. If the Lakers are -6.5, they need to win by 7 or more to cover. APIs return spread values alongside the associated odds for each side. This is the spreads market in most basketball API responses.

Totals (Over/Under)

Totals set a combined score line for both teams. A typical NBA total might be 224.5 points. You bet on whether the actual combined score goes over or under that number. APIs return the total value and the odds for each side as the totals market.

Player Props

Player props let you bet on individual performances: points scored, assists, rebounds, three-pointers made, and more. Not every API includes player props in their standard plans. The Odds API offers them through US and Australian bookmakers, while BallDontLie includes player props on their GOAT tier.

Futures

Futures are long-range bets placed before or during the season. NBA Championship winner, Conference winners, MVP awards, and win totals are the most common. Futures odds shift throughout the season as team performance changes. These are typically available through outrights endpoints.

Best APIs for NBA/Basketball Data

Choosing the right nba api depends on whether you need odds data, statistical data, or both. Here is how the top providers compare for basketball odds and stats coverage.

The Odds API: Coverage and Pricing

The Odds API is the go-to choice for developers who primarily need nba odds today from multiple bookmakers. It aggregates odds from 40+ sportsbooks across US, UK, EU, and Australian regions, covering moneyline, spreads, totals, and player props for every NBA game.

Pricing is based on monthly API credits:

  • Free: 500 credits/month (all sports and markets included)
  • 20K Plan: $30/month for 20,000 credits
  • 100K Plan: $59/month for 100,000 credits
  • 5M Plan: $119/month for 5,000,000 credits
  • 15M Plan: $249/month for 15,000,000 credits

Every plan gives access to all sports, all bookmakers, and all betting markets including historical odds going back to mid-2020. The free tier is generous enough for personal projects and prototyping. The sport key for NBA is basketball_nba.

SportsData.io: Coverage and Pricing

SportsData.io (also called SportsDataIO) focuses on deep statistical coverage alongside odds. Their NBA feeds include player stats, fantasy projections, DFS salaries, play-by-play data, injuries, and game odds with line movement tracking.

Pricing for NBA through their Discovery Lab:

  • Free: Last season data only (scrambled for demo purposes)
  • Fantasy API: $99/month (100 calls/day, player stats, projections, DFS data)
  • Odds API: $99/month (100 calls/day, game odds, line movement, scores)
  • Fantasy + Odds: $149/month (1,000 calls/day, everything combined)
  • Season Pass options start at $569/year for either Fantasy or Odds

SportsData.io is best suited for developers who need both basketball betting odds and deep statistical data in one place, though the price point is higher than odds-only providers.

BallDontLie: Coverage and Pricing

BallDontLie started as a free NBA stats API and has expanded to cover odds, player props, box scores, and advanced statistics. It covers NBA data going back to 1946, making it one of the deepest historical sources.

Pricing tiers:

  • Free: $0 (5 requests/min, access to teams, players, and games)
  • ALL-STAR: $9.99/month (60 requests/min, adds game stats, injuries, active players)
  • GOAT: $39.99/month (600 requests/min, adds betting odds, player props, box scores, play-by-play, advanced stats, standings, and contracts)

BallDontLie also offers an ALL-ACCESS tier at $159.99/month for every endpoint across every sport they cover. For NBA-only developers, the GOAT plan at $39.99/month provides strong value with odds and deep stats combined.

API-Sports: Coverage and Pricing

API-Sports (through their API-Basketball product) covers the NBA alongside 400+ basketball leagues across 79 countries. Their nba api endpoints include livescores, standings, fixtures, head-to-head data, player statistics, and odds from multiple bookmakers.

Pricing for API-Basketball:

  • Free: 100 requests/day (all endpoints and competitions)
  • Pro: $15/month (7,500 requests/day, adds player data)
  • Ultra: $25/month (75,000 requests/day)
  • Mega: $35/month (150,000 requests/day)

API-Sports is the most affordable paid option and covers far more basketball leagues than NBA-only providers. The free tier includes odds data, which is unusual at this price point.

Data Available via API

Understanding what data you actually receive helps you pick the right provider and plan your application architecture.

Pre-Match Odds and Lines

Pre-match odds are available hours to days before tipoff. A typical API response includes the game start time, home and away teams, and an array of bookmaker objects. Each bookmaker lists odds for your requested markets (moneyline, spreads, totals). Here is an abbreviated example from The Odds API:

{
  "id": "e912304a8f4e8ac0b",
  "sport_key": "basketball_nba",
  "commence_time": "2026-02-12T00:10:00Z",
  "home_team": "Los Angeles Lakers",
  "away_team": "Boston Celtics",
  "bookmakers": [
    {
      "key": "draftkings",
      "title": "DraftKings",
      "markets": [
        {
          "key": "h2h",
          "outcomes": [
            {"name": "Los Angeles Lakers", "price": -150},
            {"name": "Boston Celtics", "price": 130}
          ]
        },
        {
          "key": "spreads",
          "outcomes": [
            {"name": "Los Angeles Lakers", "price": -110, "point": -3.5},
            {"name": "Boston Celtics", "price": -110, "point": 3.5}
          ]
        }
      ]
    }
  ]
}

Live/In-Play Odds

Live odds update during the game as the score and momentum shift. The Odds API REST endpoints update every few seconds for in-play games. For applications that need faster updates, some providers like OddsJam offer WebSocket feeds with sub-150ms latency. Live NBA markets typically include moneyline, spread, and totals, with some books offering live player props.

Historical Odds Data

Historical odds are essential for backtesting betting models and analyzing line movement. The Odds API provides historical NBA odds from mid-2020 for moneyline, spreads, and totals. SportsData.io includes line movement tracking showing how odds shifted from open to close. BallDontLie offers game data going back to 1946, though odds data is more recent.

Historical endpoints typically accept a date parameter and return the same response structure as live endpoints, making it easy to reuse your parsing code.

Player and Team Statistics

Beyond odds, most basketball APIs provide statistical data that feeds into prediction models:

  • Per-game averages (points, rebounds, assists, steals, blocks)
  • Advanced metrics (PER, true shooting percentage, usage rate)
  • Team standings and records
  • Injury reports and lineup data
  • Quarter-by-quarter scoring breakdowns
  • Play-by-play event logs

BallDontLie and SportsData.io are strongest here. The Odds API focuses purely on odds and does not include statistical data.

Code Example: Fetch NBA/Basketball Odds with Python

This working example uses The Odds API free tier to pull current basketball betting odds. You can sign up at the-odds-api.com to get an API key at no cost.

Setup and Authentication

You only need the requests library, which comes standard with most Python environments:

import requests
import json

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.the-odds-api.com/v4"
SPORT = "basketball_nba"

Fetching Current Odds

This call retrieves moneyline, spread, and totals from US bookmakers for all upcoming NBA games:

def fetch_nba_odds():
    url = f"{BASE_URL}/sports/{SPORT}/odds"
    params = {
        "apiKey": API_KEY,
        "regions": "us",
        "markets": "h2h,spreads,totals",
        "oddsFormat": "american"
    }
    response = requests.get(url, params=params)
    remaining = response.headers.get("x-requests-remaining")
    print(f"API credits remaining: {remaining}")
    return response.json()

games = fetch_nba_odds()
print(f"Found {len(games)} upcoming NBA games")

Parsing the Response

This parsing function extracts a clean comparison table from the nested response:

def parse_odds(games):
    for game in games:
        home = game["home_team"]
        away = game["away_team"]
        tip = game["commence_time"]
        print(f"\n{away} @ {home}")
        print(f"  Tip-off: {tip}")

        for book in game.get("bookmakers", []):
            book_name = book["title"]
            for market in book["markets"]:
                if market["key"] == "h2h":
                    outcomes = market["outcomes"]
                    home_odds = next(
                        (o["price"] for o in outcomes if o["name"] == home), None
                    )
                    away_odds = next(
                        (o["price"] for o in outcomes if o["name"] == away), None
                    )
                    print(f"  {book_name}: {home} {home_odds} | {away} {away_odds}")

parse_odds(games)

Running this script with a valid API key produces output like:

Found 5 upcoming NBA games

Boston Celtics @ Los Angeles Lakers
  Tip-off: 2026-02-12T00:10:00Z
  DraftKings: Los Angeles Lakers -150 | Boston Celtics 130
  FanDuel: Los Angeles Lakers -145 | Boston Celtics 125
  BetMGM: Los Angeles Lakers -155 | Boston Celtics 135

Each API call uses one credit from your monthly quota. The free tier’s 500 credits are enough for roughly 16 daily snapshots of the full NBA schedule.

Use Cases

Building a Betting Dashboard

A real-time NBA betting dashboard pulls odds from multiple bookmakers and displays them side-by-side. With The Odds API’s multi-bookmaker response format, you get DraftKings, FanDuel, BetMGM, Caesars, and dozens more in a single call. Pair this with BallDontLie’s stats data to show team records, injuries, and recent form alongside the odds. For more on building sports data interfaces, see our guide on Sports Betting API: The Complete Guide for Developers and Bettors.

Odds Comparison Tool

Comparing nba odds today across sportsbooks is one of the most common use cases. The code example above is the foundation for a comparison tool. Extend it to calculate implied probabilities, highlight the best available line for each side, and flag discrepancies between books. Our Odds Comparison API: Build Your Own Odds Screener tutorial walks through the full build.

Prediction Models and Analytics

Historical odds combined with player and team statistics power NBA prediction models. Use SportsData.io or BallDontLie for features like player efficiency ratings, pace of play, rest days, and home/away splits. Compare your model’s predicted probability against the implied probability from the odds to find value bets. The Basketball API: Scores, Stats, and Odds for Developers guide covers the statistical endpoints in detail.

FAQ

What is the best free NBA API?

The Odds API offers the best free tier for NBA odds data with 500 monthly credits, access to all markets, and coverage of 40+ bookmakers. For NBA stats without odds, BallDontLie provides free access to teams, players, and games at 5 requests per minute. API-Basketball (by API-Sports) gives 100 free requests per day covering odds, livescores, standings, and statistics across 400+ basketball leagues.

How often do NBA odds update?

Pre-match NBA odds typically update every few minutes as bookmakers adjust their lines. During live games, REST APIs update every 5 to 30 seconds depending on the provider. WebSocket feeds from providers like OddsJam deliver sub-150ms latency for real-time in-play applications. The Odds API REST endpoint refreshes every few seconds for active games.

Can I get historical NBA odds data?

Yes. The Odds API provides historical NBA odds from mid-2020 covering moneyline, spreads, and totals. SportsData.io tracks line movement from open to close for each game. BallDontLie has NBA game data going back to 1946, though odds data is limited to recent seasons. Historical data typically requires a paid plan, though The Odds API includes it on all tiers including the free plan.

Already have an account?