Skip to main content
GET
Head-to-Head

Endpoint

Description

Returns comprehensive head-to-head data for a specific match, including:
  • Direct H2H matches (h2hGames) - All historical meetings between the two teams
  • Recent form (homeCompetitor.recentGames / awayCompetitor.recentGames) - Each team’s recent matches against any opponent
  • Betting odds - Available bookmakers and odds for the match
  • Metadata - Competition, country, and sport information

Response Data Structure

Understanding the data structure is crucial for correctly displaying H2H information.

Key Data Locations

Common Mistake: Do NOT filter recentGames to find H2H matches. Use h2hGames directly - it contains all direct meetings between the two teams.

Parameters

All startTime fields use ISO 8601 format with a dynamic timezone offset based on the resolved or specified timezone.

matchupId Format

The matchupId uses hyphens to separate IDs:
  • homeCompetitorId-awayCompetitorId (e.g., "131-132")
  • homeCompetitorId-awayCompetitorId-competitionId (e.g., "131-132-7")
Team order does NOT matter. The API returns the same data for 14-106 and 106-14.
Best practice: Always use matchupId exactly as returned from fixtures/results endpoints.

Request Examples


Response Structure


Complete Response Fields Reference

Root Level Fields


Game Object Fields


Competitor Object Fields

Used for both homeCompetitor and awayCompetitor.

Recent Games / H2H Games Object Fields

Used for both h2hGames[] and recentGames[] arrays.

Odds Object Fields

Odds Option Fields

Rate Object Fields


Bookmaker Object Fields


Competition Object Fields


Complete Workflow Example

Step 1: Fetch Fixtures to Get Game and Matchup IDs

Step 2: Call H2H Endpoint

Step 3: Access Direct H2H Matches

Step 4: Access Recent Form for Each Team


Common Use Cases

1. Calculate H2H Win/Draw/Loss Record

2. Calculate Team Form (W/D/L String)

3. Separate Scheduled vs Completed H2H Matches

4. Calculate Goals Scored in H2H

5. Get Most Recent N H2H Games

6. Filter H2H by Competition


Empty Response Scenarios


Rate Limiting & Caching

Each fixture requires a separate H2H call. Cache results to avoid hitting rate limits.

Common Issues & Solutions

Common Mistakes to Avoid:
  1. Don’t filter recentGames for H2H - Use h2hGames directly
  2. Don’t assume all h2hGames are completed - Check statusGroup === 4
  3. Don’t construct matchupId manually - Use value from fixtures
  4. Don’t ignore winner values - 0 means scheduled, -1 means draw

Complete Implementation Example

Authorizations

x-api-key
string
header
required

Your SportsAPI Pro API key

Query Parameters

competitor1
integer
required

First team ID

Example:

678

competitor2
integer
required

Second team ID

Example:

679

numOfGames
integer
default:10

Number of historical games to return

Example:

10

Response

200

Head-to-head history retrieved successfully

Last modified on June 29, 2026