Head to Head
REQUIREMENT
You'll need a license key to use OpticOdds' API. You can get one by contacting us at www.opticodds.com.
API Endpoint
https://api.opticodds.com/api/v2/scores/head-to-head
Parameters
key
(required)
Your OpticOdds API license key.
team1_id
(required)
The team ID for the first team you want to compare.
team2_id
(required)
The team ID for the second team you want to compare.
lookback_num
The number of games to look back for head-to-head comparison. This is optional and defaults to 10 and is capped at 25.
Example Response
{
"data": [
{
"game_id": "54558-66793-2024-04-17-12",
"score_home_total": 4,
"score_away_total": 6,
"clock": null,
"sport": "baseball",
"league": "MLB",
"period": "9",
"status": "Completed",
"is_live": false,
"weather": null,
"capacity": "49286",
"away_team": "New York Yankees",
"home_team": "Toronto Blue Jays",
"last_play": null,
"attendance": "30233",
"start_date": "2024-04-17T19:07:00+00:00",
"description": "New York Yankees vs Toronto Blue Jays",
"away_starter": "Marcus Stroman",
"current_outs": null,
"home_starter": "Kevin Gausman",
"weather_temp": null,
"current_balls": null,
"current_strikes": null,
"runner_on_first": null,
"runner_on_third": null,
"runner_on_second": null,
"current_batter_name": null,
"score_away_period_1": 0,
"score_away_period_2": 0,
"score_away_period_3": 0,
"score_away_period_4": 0,
"score_away_period_5": 1,
"score_away_period_6": 0,
"score_away_period_7": 0,
"score_away_period_8": 1,
"score_away_period_9": 4,
"score_home_period_1": 0,
"score_home_period_2": 2,
"score_home_period_3": 0,
"score_home_period_4": 0,
"score_home_period_5": 0,
"score_home_period_6": 0,
"score_home_period_7": 2,
"score_home_period_8": 0,
"score_home_period_9": 0,
"current_pitcher_name": null,
"home_team_id": "118E9A57A501",
"away_team_id": "121EBAED4535",
"home_team_name": "Blue Jays",
"venue_name": "Rogers Centre",
"weather_temp_high": null,
"current_possession": null,
"away_team_abb": "NYY",
"home_team_city": "Toronto",
"away_team_city": "New York",
"broadcast": "YES | MLBN | RSN",
"season_year": "2024",
"duration": null,
"season_week": null,
"home_team_abb": "TOR",
"away_team_name": "Yankees",
"decision": null,
"venue_location": "Toronto, ON",
"season_type": "Regular Season",
"decision_method": null,
"current_down_and_distance": null
},
{
"game_id": "54558-66793-2024-04-16-16",
"score_home_total": 5,
"score_away_total": 4,
"clock": null,
"sport": "baseball",
"league": "MLB",
"period": "9",
"status": "Completed",
"is_live": false,
"weather": null,
"capacity": "49286",
"away_team": "New York Yankees",
"home_team": "Toronto Blue Jays",
"last_play": null,
"attendance": "31175",
"start_date": "2024-04-16T23:07:00+00:00",
"description": "New York Yankees vs Toronto Blue Jays",
"away_starter": "Carlos Rodon",
"current_outs": null,
"home_starter": "Yusei Kikuchi",
"weather_temp": null,
"current_balls": null,
"current_strikes": null,
"runner_on_first": null,
"runner_on_third": null,
"runner_on_second": null,
"current_batter_name": null,
"score_away_period_1": 0,
"score_away_period_2": 1,
"score_away_period_3": 0,
"score_away_period_4": 0,
"score_away_period_5": 0,
"score_away_period_6": 0,
"score_away_period_7": 2,
"score_away_period_8": 0,
"score_away_period_9": 1,
"score_home_period_1": 0,
"score_home_period_2": 0,
"score_home_period_3": 1,
"score_home_period_4": 2,
"score_home_period_5": 0,
"score_home_period_6": 2,
"score_home_period_7": 0,
"score_home_period_8": 0,
"current_pitcher_name": null,
"home_team_id": "118E9A57A501",
"away_team_id": "121EBAED4535",
"home_team_name": "Blue Jays",
"venue_name": "Rogers Centre",
"weather_temp_high": null,
"current_possession": null,
"away_team_abb": "NYY",
"home_team_city": "Toronto",
"away_team_city": "New York",
"broadcast": "RSN | TVA | YES",
"season_year": "2024",
"duration": null,
"season_week": null,
"home_team_abb": "TOR",
"away_team_name": "Yankees",
"decision": null,
"venue_location": "Toronto, ON",
"season_type": "Regular Season",
"decision_method": null,
"current_down_and_distance": null
},
...
],
}