Cheat Sheet
TLDR
- Get an API key here. The key will be sent to your email.
- Place your API key in the
apiKeyquery param or thex-api-keyheader. - A full list of request endpoints and their parameters can be found here.
- Responses are in JSON format. The
datafield contains the data you queried for. - Use our Data Explorer see the schema of the data that is returned.
- The most commonly used endpoint is the
/eventsendpoint. This returns a list of events with odds data. Common params include:oddsAvailable=true- only return live/upcoming events with oddsleagueID=NBA,NFL,MLB- only return events for specified leaguesoddID=points-home-game-ml-home,points-home-game-sp-home- only return specified odds marketsincludeAltLines=true- include alternate spread/over-under lines
Endpoints
A full reference of all endpoints and their parameters can be found here.
The API is currently on version 2 so each endpoint is prefixed with https://api.sportsgameodds.com/v2. For example the /leagues endpoint should be accessed at https://api.sportsgameodds.com/v2/leagues.
The main endpoint you’ll use to fetch odds and scores/stats is the /events endpoint.
Authentication
All requests require an API key
Place it in the header as x-api-key.
fetch("https://api.sportsgameodds.com/v2/events", {
headers: { "x-api-key": "your-api-key-here" },
});Or, place it in the query params as apiKey.
fetch("https://api.sportsgameodds.com/v2/events?apiKey=YOUR_API_KEY_GOES_HERE");Response Format
All responses follow a consistent JSON structure:
{
"success": true,
"data": [...],
"error": "...",
"nextCursor": "...",
}The success field tells you if the request was successful and returned data or not. The data field contains a list of objects you queried for. The format of each object is dependent on the endpoint you called. The error field contains an error message. It’s only present if success is false. The nextCursor field contains a cursor used to get the next page of data in some cases. More info here.
Example Request
https://api.sportsgameodds.com/v2/events?leagueID=NBA,NFL,MLB&oddsAvailable=true&limit=1&apiKey=YOUR_API_KEY
To test this, simply replace YOUR_API_KEY with your actual API key and visit this URL in your browser.
You shoud see the next upcoming or live game for either NBA, NFL, or MLB along with all the odds data for that game.
leagueID=NBA,NFL,MLB- Tells the API to only return data for NBA, NFL, and MLB gamesoddsAvailable=true- Tells the API to only return data for games where there are available/active odds marketslimit=1- Tells the API to only return 1 game. By default the API sorts results by start time in ascending order.apiKey=YOUR_API_KEY- Authenticates your request.
Data Schema
The best way to get a sense of how our data is structured is to play around with our Data Explorer.
In general, the data is organized into the following hierarchy:
- Sports - fairly self-explanatory.
- Leagues - each sport has one or more leagues.
- Teams - each league has one or more teams.
- Events - each team has one or more events.
The core unit that you’ll likely be working with is the Event. Each Event represents a single game/match/fight/etc. The Event object also contains all odds markets for that event. An odds market represents both the type of bet and the side of the bet. Each has its own unique ID called an oddID. You can find data for a specific odds market on an Event object at the path: Event.odds.<oddID>. If you’re looking for bookmaker specific data, you can find it here Event.odds.<oddID>.byBookmaker.<bookmakerID>.
Each oddID is a combination of other identifiers which uniquely identify the odds market. These identifiers are:
statID- the statistic being measured (ex: “points”, “assists”, “rebounds”, etc.)statEntityID- Who’s performance on the stat is being measured (ex: “home”, “away”, “LEBRON_JAMES”, “all” (both teams), etc.)periodID- the period being tracked (ex: full game (“game”), first half (“1h”), etc.)betTypeID- the type of bet (ex: spread (“sp”), moneyline (“ml”), over/under (“ou”), etc.)sideID- the side of the bet (ex: “home”, “away”, “over”, “under”, “yes”, “no”, etc.)
By combining these identifiers, we can uniquely identify any odds market! Pretty cool, right?
