GET /leagues - List All Leagues
Get a list of Leagues
GET https://api.sockodds.com/v2/leagues/
Retrieve all supported leagues with leagueID values. `enabled` reflects what your plan can see.
Query parameters
| Parameter | Type | Description |
|---|---|---|
sportID | string | The sport to get leagues for |
leagueID | string | The league to get data for |
Response
{ "success": true, "data": League[], "nextCursor": string | null }
League
Contains information on a specific league
| Field | Type | Description |
|---|---|---|
leagueID | string | |
sportID | string | |
name / shortName | string | |
enabled | boolean | Whether your plan can read this league |
activeEvents | number | Events currently carried |
Status codes
| Status | Body |
|---|---|
200 | Success |
400 | {"success":false,"error":"Invalid params"} |
401 | {"success":false,"error":"Invalid API key"} |
403 | {"success":false,"error":"Inactive API key"} |
429 | {"success":false,"error":"Rate limit exceeded"} (Retry-After header) |
Code samples
curl -X GET "https://api.sockodds.com/v2/leagues/?sportID=RUGBY_LEAGUE" \
-H "x-api-key: YOUR_API_KEY"const r = await fetch("https://api.sockodds.com/v2/leagues/?sportID=RUGBY_LEAGUE", { headers: { "x-api-key": "YOUR_API_KEY" } });
const { success, data, nextCursor, notice } = await r.json();import requests
r = requests.get("https://api.sockodds.com/v2/leagues/", params=dict(sportID="RUGBY_LEAGUE"), headers={"x-api-key": "YOUR_API_KEY"})
body = r.json()req, _ := http.NewRequest("GET", "https://api.sockodds.com/v2/leagues/?sportID=RUGBY_LEAGUE", nil)
req.Header.Set("x-api-key", "YOUR_API_KEY")
res, err := http.DefaultClient.Do(req)HttpRequest req = HttpRequest.newBuilder().uri(URI.create("https://api.sockodds.com/v2/leagues/?sportID=RUGBY_LEAGUE"))
.header("x-api-key", "YOUR_API_KEY").GET().build();
HttpResponse<String> res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());using var http = new HttpClient();
http.DefaultRequestHeaders.Add("x-api-key", "YOUR_API_KEY");
var body = await http.GetStringAsync("https://api.sockodds.com/v2/leagues/?sportID=RUGBY_LEAGUE");Try it
// the response appears here