API ReferenceLeagues
Get League
Retrieve detailed information about a specific league
Get League
Get comprehensive information about a single sports league by its ID.
Endpoint
GET /v1/leagues/{league_id}Authentication
Required. Use Bearer token or X-API-Key header.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
league_id | string | Yes | Unique league identifier (e.g., "nfl", "nba", "premier-league") |
Example Request
import { AltSportsData } from 'altsportsdata';
const client = new AltSportsData({ apiKey: 'YOUR_API_KEY' });
const league = await client.leagues.get('nfl');
console.log(league.data);from altsportsdata import AltSportsData
client = AltSportsData(api_key='YOUR_API_KEY')
league = client.leagues.get('nfl')
print(league.data)curl -X GET "https://api.altsportsdata.com/v1/leagues/nfl" \
-H "Authorization: Bearer YOUR_API_KEY"const response = await fetch("https://api.altsportsdata.com/v1/leagues/nfl", {
headers: {
"Authorization": "Bearer YOUR_API_KEY"
}
});
const league = await response.json();
console.log(league.data);require 'net/http'
require 'json'
uri = URI('https://api.altsportsdata.com/v1/leagues/nfl')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer YOUR_API_KEY'
response = http.request(request)
data = JSON.parse(response.body)<?php
$url = 'https://api.altsportsdata.com/v1/leagues/nfl';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_KEY'
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
?>using System;
using System.Net.Http;
using System.Threading.Tasks;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");
var url = "https://api.altsportsdata.com/v1/leagues/nfl";
var response = await client.GetStringAsync(url);
Console.WriteLine(response);package main
import (
"fmt"
"io"
"net/http"
)
func main() {
client := &http.Client{}
url := "https://api.altsportsdata.com/v1/leagues/nfl"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class GetLeague {
public static void main(String[] args) throws Exception {
String urlString = "https://api.altsportsdata.com/v1/leagues/nfl";
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Authorization", "Bearer YOUR_API_KEY");
BufferedReader in = new BufferedReader(
new InputStreamReader(conn.getInputStream())
);
String line;
StringBuilder response = new StringBuilder();
while ((line = in.readLine()) != null) {
response.append(line);
}
in.close();
System.out.println(response.toString());
}
}Example Response
{
"data": {
"id": "nfl",
"name": "National Football League",
"sport": "American Football",
"sport_bucket": "football",
"archetype": "professional",
"category": "team_sport",
"country": "US",
"region": "North America",
"tier": "T1",
"founded": 1920,
"active": true,
"teams_count": 32,
"avg_attendance": 67254,
"social_media": {
"twitter": "@NFL",
"instagram": "@nfl",
"followers_total": 45000000
},
"website": "https://www.nfl.com",
"description": "The premier professional American football league",
"logo_url": "https://cdn.altsportsdata.com/leagues/nfl.png"
},
"meta": {
"total": 1,
"page": 1,
"limit": 1,
"has_more": false,
"api_version": "v1",
"timestamp": "2026-03-07T06:36:00Z"
}
}Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique league identifier |
name | string | Full league name |
sport | string | Sport name |
sport_bucket | string | Sport category bucket |
archetype | string | League archetype (professional, amateur, etc.) |
category | string | Sport category (team_sport, individual_sport, etc.) |
country | string | Primary country code (ISO 3166-1) |
region | string | Geographic region |
tier | string | Tier classification (T1-T4) |
founded | integer | Year founded |
active | boolean | Whether league is currently active |
teams_count | integer | Number of teams in league |
avg_attendance | integer | Average attendance per event |
social_media | object | Social media handles and follower counts |
website | string | Official website URL |
description | string | League description |
logo_url | string | League logo image URL |