Live Leaderboard API
curl --request GET \
--url https://api.gamezop.com/v2/tournaments/{tournament_id}/leaderboard \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.gamezop.com/v2/tournaments/{tournament_id}/leaderboard"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.gamezop.com/v2/tournaments/{tournament_id}/leaderboard', 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.gamezop.com/v2/tournaments/{tournament_id}/leaderboard",
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.gamezop.com/v2/tournaments/{tournament_id}/leaderboard"
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.gamezop.com/v2/tournaments/{tournament_id}/leaderboard")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gamezop.com/v2/tournaments/{tournament_id}/leaderboard")
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{
"success": true,
"data": {
"leaderboard": {
"leaderboard_id": "lb_B1MfIa4QCg_highscore",
"name": "High Score",
"description": "Top scores across all players for this tournament.",
"total_players": 19283
},
"top": [
{
"rank": 1,
"puid": "player_987",
"score": 98200
},
{
"rank": 2,
"puid": "player_456",
"score": 97100
}
],
"player": {
"entry": {
"rank": 42,
"puid": "player_123",
"score": 75400
},
"neighbours": {
"above": {
"rank": 41,
"puid": "player_777",
"score": 75800
},
"below": {
"rank": 43,
"puid": "player_555",
"score": 75100
}
}
}
}
}Integration
Live Leaderboard API
Get the live leaderboard of a tournament that is in progress.
GET
/
v2
/
tournaments
/
{tournament_id}
/
leaderboard
Live Leaderboard API
curl --request GET \
--url https://api.gamezop.com/v2/tournaments/{tournament_id}/leaderboard \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.gamezop.com/v2/tournaments/{tournament_id}/leaderboard"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.gamezop.com/v2/tournaments/{tournament_id}/leaderboard', 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.gamezop.com/v2/tournaments/{tournament_id}/leaderboard",
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.gamezop.com/v2/tournaments/{tournament_id}/leaderboard"
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.gamezop.com/v2/tournaments/{tournament_id}/leaderboard")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gamezop.com/v2/tournaments/{tournament_id}/leaderboard")
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{
"success": true,
"data": {
"leaderboard": {
"leaderboard_id": "lb_B1MfIa4QCg_highscore",
"name": "High Score",
"description": "Top scores across all players for this tournament.",
"total_players": 19283
},
"top": [
{
"rank": 1,
"puid": "player_987",
"score": 98200
},
{
"rank": 2,
"puid": "player_456",
"score": 97100
}
],
"player": {
"entry": {
"rank": 42,
"puid": "player_123",
"score": 75400
},
"neighbours": {
"above": {
"rank": 41,
"puid": "player_777",
"score": 75800
},
"below": {
"rank": 43,
"puid": "player_555",
"score": 75100
}
}
}
}
}Licensed
The Tournaments module is only available with the licensed model. Contact us to know more.
live state.
Optionally pass a puid to get that player’s current rank, with one entry above and one below, alongside the top entries.
player object behaviour
| Condition | Behaviour |
|---|---|
puid not passed | player object is omitted entirely from the response |
puid passed, player not in leaderboard | entry is null, neighbours.above and neighbours.below are null |
| Player is at rank 1 | neighbours.above is null |
| Player is at last rank | neighbours.below is null |
The rate limit on this API (1200 requests per minute) is counted per tournament, not per token. If you fan out to many users, fetch the leaderboard once into your own backend or CDN and serve it from there. Do not proxy every end-user request straight through to this API.
Authorizations
You can find the Bearer token for this API under Settings & Admin > API Tokens within the Gamezop Business Dashboard.
Query Parameters
Was this page helpful?