← Back to Documentation

Head-to-Head

GET https://api.worldcupapi.com/head2head

Description

Get head-to-head statistics between two teams in World Cup matches. Includes historical match results, win/loss records, and goal statistics.

Parameters

Name Type Required Description
key string Yes Your API key for authentication
team1_id integer Yes The unique identifier of the first team
team2_id integer Yes The unique identifier of the second team
lang string No Language code (es, fr, de, etc.) - defaults to English

Example Request

GET /head2head?key=YOUR_API_KEY

Example Response

{
    "team1": {
        "id": "1456",
        "name": "England",
        "overall_form": [
            "W",
            "W",
            "W",
            "W",
            "W",
            "W"
        ],
        "h2h_form": [
            "W",
            "W",
            "D",
            "D",
            "W"
        ]
    },
    "team2": {
        "id": "211",
        "name": "Croatia",
        "overall_form": [
            "W",
            "W",
            "W",
            "D",
            "W",
            "W"
        ],
        "h2h_form": [
            "L",
            "L",
            "D",
            "D",
            "L"
        ]
    },
    "team1_last_6": [
        {
            "id": "672629",
            "date": "2025-11-16",
            "home_name": "Albania",
            "away_name": "England",
            "score": "0 - 2",
            "ht_score": "0 - 0",
            "ft_score": "0 - 2",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2025-11-16 20:54:33",
            "home_id": "1742",
            "away_id": "1456",
            "location": "Stadiumi Loro Boriçi",
            "fixture_id": "1821630",
            "scheduled": "17:00",
            "outcomes": {
                "half_time": "X",
                "full_time": "2",
                "extra_time": null,
                "penalty_shootout": null
            }
        },
        {
            "id": "672255",
            "date": "2025-11-13",
            "home_name": "England",
            "away_name": "Serbia",
            "score": "2 - 0",
            "ht_score": "1 - 0",
            "ft_score": "2 - 0",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2025-11-13 23:54:28",
            "home_id": "1456",
            "away_id": "1447",
            "location": "Wembley Stadium",
            "fixture_id": "1821606",
            "scheduled": "19:45",
            "outcomes": {
                "half_time": "1",
                "full_time": "1",
                "extra_time": null,
                "penalty_shootout": null
            }
        },
        {
            "id": "664766",
            "date": "2025-10-14",
            "home_name": "Latvia",
            "away_name": "England",
            "score": "0 - 5",
            "ht_score": "0 - 3",
            "ft_score": "0 - 5",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2025-10-14 22:54:29",
            "home_id": "2683",
            "away_id": "1456",
            "location": "Stadions Skonto",
            "fixture_id": "1818076",
            "scheduled": "18:45",
            "outcomes": {
                "half_time": "2",
                "full_time": "2",
                "extra_time": null,
                "penalty_shootout": null
            }
        },
        {
            "id": "663615",
            "date": "2025-10-09",
            "home_name": "England",
            "away_name": "Wales",
            "score": "3 - 0",
            "ht_score": "3 - 0",
            "ft_score": "3 - 0",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2025-10-09 20:40:32",
            "home_id": "1456",
            "away_id": "2685",
            "location": "Wembley Stadium",
            "fixture_id": "1762075",
            "scheduled": "18:47",
            "outcomes": {
                "half_time": "1",
                "full_time": "1",
                "extra_time": null,
                "penalty_shootout": null
            }
        },
        {
            "id": "652490",
            "date": "2025-09-09",
            "home_name": "Serbia",
            "away_name": "England",
            "score": "0 - 5",
            "ht_score": "0 - 2",
            "ft_score": "0 - 5",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2025-09-09 20:59:15",
            "home_id": "1447",
            "away_id": "1456",
            "location": "Stadion Rajko Mitić",
            "fixture_id": "1808977",
            "scheduled": "18:45",
            "outcomes": {
                "half_time": "2",
                "full_time": "2",
                "extra_time": null,
                "penalty_shootout": null
            }
        },
        {
            "id": "652000",
            "date": "2025-09-06",
            "home_name": "England",
            "away_name": "Andorra",
            "score": "2 - 0",
            "ht_score": "1 - 0",
            "ft_score": "2 - 0",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2025-09-06 19:55:20",
            "home_id": "1456",
            "away_id": "1732",
            "location": "Wembley Stadium",
            "fixture_id": "1798242",
            "scheduled": "16:00",
            "outcomes": {
                "half_time": "1",
                "full_time": "1",
                "extra_time": null,
                "penalty_shootout": null
            }
        }
    ],
    "team2_last_6": [
        {
            "id": "672702",
            "date": "2025-11-17",
            "home_name": "Montenegro",
            "away_name": "Croatia",
            "score": "2 - 3",
            "ht_score": "2 - 1",
            "ft_score": "2 - 3",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2025-11-17 23:54:54",
            "home_id": "1738",
            "away_id": "211",
            "location": "Stadion Pod Goricom",
            "fixture_id": "1821637",
            "scheduled": "19:45",
            "outcomes": {
                "half_time": "1",
                "full_time": "2",
                "extra_time": null,
                "penalty_shootout": null
            }
        },
        {
            "id": "672322",
            "date": "2025-11-14",
            "home_name": "Croatia",
            "away_name": "Faroe Islands",
            "score": "3 - 1",
            "ht_score": "1 - 1",
            "ft_score": "3 - 1",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2025-11-14 23:54:28",
            "home_id": "211",
            "away_id": "1735",
            "location": "Stadion Maksimir",
            "fixture_id": "1821611",
            "scheduled": "19:45",
            "outcomes": {
                "half_time": "X",
                "full_time": "1",
                "extra_time": null,
                "penalty_shootout": null
            }
        },
        {
            "id": "664582",
            "date": "2025-10-12",
            "home_name": "Croatia",
            "away_name": "Gibraltar",
            "score": "3 - 0",
            "ht_score": "1 - 0",
            "ft_score": "3 - 0",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2025-10-12 20:44:28",
            "home_id": "211",
            "away_id": "1650",
            "location": "Stadion Maksimir",
            "fixture_id": "1818044",
            "scheduled": "18:46",
            "outcomes": {
                "half_time": "1",
                "full_time": "1",
                "extra_time": null,
                "penalty_shootout": null
            }
        },
        {
            "id": "663610",
            "date": "2025-10-09",
            "home_name": "Czech Republic",
            "away_name": "Croatia",
            "score": "0 - 0",
            "ht_score": "0 - 0",
            "ft_score": "0 - 0",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2025-10-09 20:37:53",
            "home_id": "1722",
            "away_id": "211",
            "location": "Generali Arena",
            "fixture_id": "1817733",
            "scheduled": "18:45",
            "outcomes": {
                "half_time": "X",
                "full_time": "X",
                "extra_time": null,
                "penalty_shootout": null
            }
        },
        {
            "id": "652424",
            "date": "2025-09-08",
            "home_name": "Croatia",
            "away_name": "Montenegro",
            "score": "4 - 0",
            "ht_score": "1 - 0",
            "ft_score": "4 - 0",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2025-09-08 22:49:09",
            "home_id": "211",
            "away_id": "1738",
            "location": "Stadion Maksimir",
            "fixture_id": "1808925",
            "scheduled": "18:45",
            "outcomes": {
                "half_time": "1",
                "full_time": "1",
                "extra_time": null,
                "penalty_shootout": null
            }
        },
        {
            "id": "651641",
            "date": "2025-09-05",
            "home_name": "Faroe Islands",
            "away_name": "Croatia",
            "score": "0 - 1",
            "ht_score": "0 - 1",
            "ft_score": "0 - 1",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2025-09-05 22:50:16",
            "home_id": "1735",
            "away_id": "211",
            "location": "Tórsvøllur",
            "fixture_id": "1798310",
            "scheduled": "18:45",
            "outcomes": {
                "half_time": "2",
                "full_time": "2",
                "extra_time": null,
                "penalty_shootout": null
            }
        }
    ],
    "h2h": [
        {
            "id": "258035",
            "date": "2021-06-13",
            "home_name": "England",
            "away_name": "Croatia",
            "score": "1 - 0",
            "ht_score": "0 - 0",
            "ft_score": "1 - 0",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2021-06-13 14:52:15",
            "home_id": "1456",
            "away_id": "211",
            "location": "Wembley Stadium",
            "fixture_id": "1387376",
            "scheduled": "13:00",
            "outcomes": {
                "half_time": "X",
                "full_time": "1",
                "extra_time": null,
                "penalty_shootout": null
            }
        },
        {
            "id": "117665",
            "date": "2018-11-18",
            "home_name": "England",
            "away_name": "Croatia",
            "score": "2 - 1",
            "ht_score": "0 - 0",
            "ft_score": "2 - 1",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2018-11-18 15:56:01",
            "home_id": "1456",
            "away_id": "211",
            "location": null,
            "fixture_id": null,
            "scheduled": null,
            "outcomes": {
                "half_time": "X",
                "full_time": "1",
                "extra_time": null,
                "penalty_shootout": null
            }
        },
        {
            "id": "111635",
            "date": "2018-10-12",
            "home_name": "Croatia",
            "away_name": "England",
            "score": "0 - 0",
            "ht_score": "0 - 0",
            "ft_score": "0 - 0",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2018-10-12 20:41:02",
            "home_id": "211",
            "away_id": "1456",
            "location": null,
            "fixture_id": null,
            "scheduled": null,
            "outcomes": {
                "half_time": "X",
                "full_time": "X",
                "extra_time": null,
                "penalty_shootout": null
            }
        },
        {
            "id": "95733",
            "date": "2018-07-11",
            "home_name": "Croatia",
            "away_name": "England",
            "score": "2 - 1",
            "ht_score": "0 - 1",
            "ft_score": "1 - 1",
            "et_score": "2 - 1",
            "ps_score": "",
            "time": "AET",
            "status": "FINISHED",
            "last_changed": "2022-10-09 13:51:23",
            "home_id": "211",
            "away_id": "1456",
            "location": "Luzhniki Stadium, Moscow",
            "fixture_id": "0",
            "scheduled": "18:00",
            "outcomes": {
                "half_time": "2",
                "full_time": "X",
                "extra_time": "1",
                "penalty_shootout": null
            }
        },
        {
            "id": "437864",
            "date": "2004-06-21",
            "home_name": "Croatia",
            "away_name": "England",
            "score": "2 - 4",
            "ht_score": "1 - 2",
            "ft_score": "2 - 4",
            "et_score": "",
            "ps_score": "",
            "time": "FT",
            "status": "FINISHED",
            "last_changed": "2023-07-14 09:27:09",
            "home_id": "211",
            "away_id": "1456",
            "location": "Estádio da Luz, Lisbon",
            "fixture_id": "0",
            "scheduled": "18:45",
            "outcomes": {
                "half_time": "2",
                "full_time": "2",
                "extra_time": null,
                "penalty_shootout": null
            }
        }
    ],
    "fixture": {
        "id": "1825354",
        "date": "2026-06-17",
        "time": "20:00:00",
        "round": "1",
        "home_name": "England",
        "away_name": "Croatia",
        "location": "AT&T Stadium, Arlington",
        "home_id": "1456",
        "away_id": "211"
    }
}

Code Examples

JavaScript (Fetch)

const response = await fetch('https://api.worldcupapi.com/head2head?key=YOUR_API_KEY');
const data = await response.json();
console.log(data);

Python (Requests)

import requests

url = 'https://api.worldcupapi.com/head2head'
params = {'key': 'YOUR_API_KEY'}
response = requests.get(url, params=params)
data = response.json()
print(data)
			

PHP (cURL)

$url = 'https://api.worldcupapi.com/head2head?key=YOUR_API_KEY';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
			

Java (HttpURLConnection)

URL url = new URL("https://api.worldcupapi.com/head2head?key=YOUR_API_KEY");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String response = in.readLine();
			

C# (HttpClient)

using (var client = new HttpClient())
{
	var response = await client.GetAsync("https://api.worldcupapi.com/head2head?key=YOUR_API_KEY");
	var content = await response.Content.ReadAsStringAsync();
	var data = JsonSerializer.Deserialize<object>(content);
}
			

Go

import (
	"encoding/json"
	"net/http"
)

resp, err := http.Get("https://api.worldcupapi.com/head2head?key=YOUR_API_KEY")
if err != nil {
	log.Fatal(err)
}
defer resp.Body.Close()

var data map[string]interface{}
json.NewDecoder(resp.Body).Decode(&data)
			

Ruby

require 'net/http'
require 'json'

uri = URI('https://api.worldcupapi.com/head2head?key=YOUR_API_KEY')
response = Net::HTTP.get_response(uri)
data = JSON.parse(response.body)