Overview
The Odds-API.io provides several endpoints for fetching odds data from multiple bookmakers. This guide covers best practices and common patterns for working with odds data.
Basic Workflow
Get available sports - Fetch the list of supported sports
Get leagues - Retrieve leagues for your chosen sport
Get events - Find upcoming or live events
Get odds - Fetch odds from selected bookmakers
Fetching Odds for a Single Event
Use the /v3/odds endpoint to get odds for a specific event:
const apiKey = process . env . ODDS_API_KEY ;
const eventId = 123456 ;
const bookmakers = [ 'Bet365' , 'Unibet' , 'Pinnacle' ]. join ( ',' );
const response = await fetch (
`https://api.odds-api.io/v3/odds?apiKey= ${ apiKey } &eventId= ${ eventId } &bookmakers= ${ bookmakers } `
);
const data = await response . json ();
console . log ( data );
Fetching Odds for Multiple Events
For better efficiency, use the /v3/odds/multi endpoint to fetch odds for up to 10 events in a single request:
const apiKey = process . env . ODDS_API_KEY ;
const eventIds = [ 123456 , 123457 , 123458 ]. join ( ',' );
const bookmakers = [ 'Bet365' , 'Unibet' ]. join ( ',' );
const response = await fetch (
`https://api.odds-api.io/v3/odds/multi?apiKey= ${ apiKey } &eventIds= ${ eventIds } &bookmakers= ${ bookmakers } `
);
const data = await response . json ();
// Returns an array of event odds
console . log ( data );
The multi-odds endpoint counts as only 1 API request regardless of how many events you fetch (up to 10).
Understanding the Odds Response
The odds response includes multiple markets for each bookmaker:
{
"id" : 123456 ,
"home" : "Manchester United" ,
"away" : "Liverpool" ,
"date" : "2025-10-15T15:00:00Z" ,
"status" : "pending" ,
"bookmakers" : {
"Bet365" : [
{
"name" : "ML" ,
"odds" : [
{
"home" : "2.10" ,
"draw" : "3.40" ,
"away" : "3.20"
}
],
"updatedAt" : "2025-10-04T10:30:00Z"
},
{
"name" : "Asian Handicap" ,
"odds" : [
{
"hdp" : -0.5 ,
"home" : "1.95" ,
"away" : "1.85"
}
]
},
{
"name" : "Over/Under" ,
"odds" : [
{
"max" : 2.5 ,
"over" : "1.90" ,
"under" : "1.90"
}
]
}
]
}
}
Market Types
ML - Match result (Home, Draw, Away)
Spread - Handicap betting with fractional lines
Totals - Total goals/points over or under a line
Both Teams to Score - Yes/No markets
Correct Score - Exact score predictions
And many more…
Finding the Best Odds
Here’s an example of comparing odds across bookmakers to find the best value:
function findBestOdds ( oddsData ) {
const market = 'ML' ;
const bestOdds = {
home: { bookmaker: null , odds: 0 , link: null },
draw: { bookmaker: null , odds: 0 , link: null },
away: { bookmaker: null , odds: 0 , link: null }
};
for ( const [ bookmaker , markets ] of Object . entries ( oddsData . bookmakers )) {
const marketML = markets . find ( m => m . name === market );
if ( ! marketML ?. odds [ 0 ]) continue ;
const odds = marketML . odds [ 0 ];
if ( parseFloat ( odds . home ) > bestOdds . home . odds ) {
bestOdds . home = {
bookmaker ,
odds: parseFloat ( odds . home )
};
}
if ( odds . draw && parseFloat ( odds . draw ) > bestOdds . draw . odds ) {
bestOdds . draw = {
bookmaker ,
odds: parseFloat ( odds . draw )
};
}
if ( parseFloat ( odds . away ) > bestOdds . away . odds ) {
bestOdds . away = {
bookmaker ,
odds: parseFloat ( odds . away )
};
}
}
return bestOdds ;
}
// Usage
const bestOdds = findBestOdds ( oddsData );
console . log ( 'Best home odds:' , bestOdds . home . odds , 'at' , bestOdds . home . bookmaker );
Getting Updated Odds
For real-time applications, use the /v3/odds/updated endpoint to fetch only odds that have changed:
const apiKey = process . env . ODDS_API_KEY ;
const since = Math . floor ( Date . now () / 1000 ) - 60 ; // Last 60 seconds
const bookmaker = 'Bet365' ;
const sport = 'Football' ;
const response = await fetch (
`https://api.odds-api.io/v3/odds/updated?apiKey= ${ apiKey } &since= ${ since } &bookmaker= ${ bookmaker } &sport= ${ sport } `
);
const updatedOdds = await response . json ();
The since parameter must be a UNIX timestamp no older than 1 minute.
Caching Strategies
To optimize performance and reduce API calls:
Cache event lists for 5-10 minutes
Cache pre-match odds for 30-60 seconds
Cache live odds for 5-10 seconds
Use updated odds endpoint for incremental updates
// Example caching with Node.js
const cache = new Map ();
const CACHE_TTL = 60000 ; // 60 seconds
async function getCachedOdds ( eventId ) {
const cacheKey = `odds: ${ eventId } ` ;
const cached = cache . get ( cacheKey );
if ( cached && Date . now () - cached . timestamp < CACHE_TTL ) {
return cached . data ;
}
const data = await fetchOdds ( eventId );
cache . set ( cacheKey , { data , timestamp: Date . now () });
return data ;
}
Best Practices
Select Only Needed Bookmakers
Batch requests using /v3/odds/multi to reduce API calls and stay within rate limits.
Cache odds data appropriately based on match status (pre-match vs live).
Handle Missing Data Gracefully
Not all bookmakers offer all markets. Always check if data exists before accessing it.
Next Steps