← Back to Documentation

Commentary

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

Description

Get real-time scores and updates for all ongoing World Cup matches. This endpoint provides live match data including current scores, match status, time elapsed, and basic match information.

Parameters

Name Type Required Description
key string Yes Your API key for authentication
match_id integer Yes The unique identifier of the match
lang string No Language code (es, fr, de, etc.) - defaults to English
from integer No The second from which to start the commentary
to integer No The second to which to end the commentary

Example Request

GET /commentary?key=YOUR_API_KEY

Example Response

{
    "commentary": [
        {
            "id": 653,
            "match_id": 335680,
            "event_type": "CONTAINS_BALL",
            "minute": "0",
            "second": "50",
            "match_second": 50,
            "comment": "",
            "pos_x": 0,
            "pos_y": 0,
            "side": "h",
            "created_at": "2022-06-13 18:46:24",
            "updated_at": null,
            "text": "France contains the ball for a long period of time",
            "team": {
                "id": 1439,
                "name": "France",
                "logo": "https://cdn.worldcupapi.com/teams/f762fd07a14509496998fff35234ffdb.png"
            },
            "player": null,
            "player_2": null
        },
        {
            "id": 652,
            "match_id": 335680,
            "event_type": "MATCH_START",
            "minute": "0",
            "second": "0",
            "match_second": 0,
            "comment": "",
            "pos_x": 0,
            "pos_y": 0,
            "side": "a",
            "created_at": "2022-06-13 18:45:32",
            "updated_at": null,
            "text": "The match starts",
            "team": {
                "id": 211,
                "name": "Croatia",
                "logo": "https://cdn.worldcupapi.com/teams/5359e81da2c5812b807dc8d1c00d45b1.png"
            },
            "player": null,
            "player_2": null
        }
    ],
    "match": {
        "home": "France",
        "away": "Croatia",
        "score": "0 - 1",
        "ht_score": "0 - 1",
        "time": "FT"
    }
}

Code Examples

JavaScript (Fetch)

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

Python (Requests)

import requests

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

PHP (cURL)

$url = 'https://api.worldcupapi.com/commentary?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/commentary?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/commentary?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/commentary?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/commentary?key=YOUR_API_KEY')
response = Net::HTTP.get_response(uri)
data = JSON.parse(response.body)