List leagues
Sports competitions with events on TV, by sport and country, with their ids.
Free key and every planLive data
GEThttps://api.tvguideapi.com/v1/leagues
Try itRuns the real call with your key
200 OK
Parameters
| Parameter | In | Type | Required | Description | Example |
|---|---|---|---|---|---|
| sport | query | string | optional | A sport: football, cricket, basketball, rugby, tennis... | football |
| country | query | string | optional | A country code. | GB |
Request
curl -H "Authorization: Bearer $TVG_KEY" \ "https://api.tvguideapi.com/v1/leagues"
$ch = curl_init("https://api.tvguideapi.com/v1/leagues");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("TVG_KEY")],
]);
$answer = json_decode(curl_exec($ch), true);
const r = await fetch("https://api.tvguideapi.com/v1/leagues", {
headers: { Authorization: `Bearer ${process.env.TVG_KEY}` },
});
const { data, meta } = await r.json();
import os, requests
r = requests.get(
"https://api.tvguideapi.com/v1/leagues",
headers={"Authorization": f"Bearer {os.environ['TVG_KEY']}"},
)
data = r.json()["data"]
Sample response
{
"data": [
{
"id": "chinese-professional-baseball-league",
"name": "Premier League",
"sport": "football",
"country": "GB"
}
],
"meta": {
"count": 1,
"next": null,
"took_ms": 41
}
}