Oddlyx LogoOddlyx

Historical Odds Endpoint

Retrieve historical odds data for backtesting and analytics.

GET
/api/v1/nba/odds/historical

Description

Use this endpoint to fetch odds history over a date range. Typical use cases include model training, backtesting strategies, and post-game analysis.

Pro / Elite only

The /api/v1/nba/odds/historical endpoint is available on Pro and Elite plans only. Starter plans will receive a 403 Forbidden response when calling this endpoint.

Parameters

NameTypeRequiredDescription
start_datestring
Required
YYYY-MM-DD. Start of date range.
end_datestring
Required
YYYY-MM-DD. End of date range.
game_idinteger | array
Optional
Filter by game ID(s).
market_typestring | array
Optional
Filter by market type.
book_idinteger | array
Optional
Filter by sportsbook ID(s).
limitinteger
Optional
Max records to return. Default 100.
offsetinteger
Optional
Pagination offset. Default 0.

Response

Returns a list of historical snapshots, each containing the date and the game data (including markets) fetched at that time.

Example Request

curl -X GET "https://odds-marketplace.onrender.com/api/v1/nba/odds/historical?start_date=2024-01-01&end_date=2024-01-07&market_type=moneyline" \
  -H "Authorization: Bearer sk_your_api_key_here"

Example Response

{
  "success": true,
  "data": [
    {
      "date": "20240101",
      "fetched_at": "2024-01-01T23:59:00.000Z",
      "game": {
        "game_id": 401123456,
        "league_id": 1,
        "status": "closed",
        "home_team": { "id": 21, "abbr": "DEN" },
        "away_team": { "id": 14, "abbr": "LAL" },
        "markets": {
          "moneyline": {
             "market_type": "moneyline",
             "outcomes": [
                {
                  "book_id": 15,
                  "side": "home",
                  "odds": { "decimal": 1.75, "american": "-133" },
                  "is_available": true
                }
             ]
          }
        }
      }
    }
  ],
  "count": 1,
  "pagination": {
    "limit": 100,
    "offset": 0
  }
}