Get leagues
curl --request GET \
--url https://api.4casters.io/exchange/getLeagues \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.4casters.io/exchange/getLeagues"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.4casters.io/exchange/getLeagues', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.4casters.io/exchange/getLeagues",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.4casters.io/exchange/getLeagues"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.4casters.io/exchange/getLeagues")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/exchange/getLeagues")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"availableLeagues": [
"NBA",
"NHL",
"PREMIER-LEAGUE",
"PGA"
]
}
}Markets
Get leagues
List leagues with active markets
GET
/
exchange
/
getLeagues
Get leagues
curl --request GET \
--url https://api.4casters.io/exchange/getLeagues \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.4casters.io/exchange/getLeagues"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.4casters.io/exchange/getLeagues', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.4casters.io/exchange/getLeagues",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.4casters.io/exchange/getLeagues"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.4casters.io/exchange/getLeagues")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/exchange/getLeagues")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"availableLeagues": [
"NBA",
"NHL",
"PREMIER-LEAGUE",
"PGA"
]
}
}Returns every league with active markets on the exchange. Use league codes from this endpoint to fetch games (
/exchange/v2/getGames) and orderbooks (/exchange/v2/getOrderbook).
If the response contains a league name with LIVE in it (other than the per-sport live leagues NFL-LIVE, NBA-LIVE, NCAAF-LIVE, NCAAB-LIVE), the value "LIVE" is appended as an alias for “all in-play games”.
Request
GET /exchange/getLeagues
string
Optional sport filter (
basketball, baseball, hockey, football, soccer, golf, tennis, mma, etc.). When sport=soccer or sport=golf, the value "all" is appended to the list.curl https://api.4casters.io/exchange/getLeagues \
-H "Authorization: Bearer YOUR_TOKEN"
Response
array
Array of league codes.
Example
{
"data": {
"availableLeagues": [
"CHAMPIONS-LEAGUE",
"NBA",
"NHL",
"BUNDESLIGA",
"PREMIER-LEAGUE",
"PGA",
"LA-LIGA",
"NON-UFC",
"SERIE-A",
"MLS",
"UFCMMA"
]
}
}
Authorizations
Pass your auth token in the Authorization header. The Bearer prefix is optional; the server also accepts a signed auth cookie or a token field in the request body.
Query Parameters
Optional sport filter (e.g. basketball, soccer, golf). When sport=soccer or sport=golf, all is appended to the list.
Response
Available leagues
Show child attributes
Show child attributes
Was this page helpful?