Skip to main content

LeaderboardDto

Contains the competitive leaderboard data for a specific act.
actId
str
required
The act identifier for this leaderboard
players
List[PlayerDto]
required
List of players on the leaderboard
totalPlayers
int
required
Total number of players on the leaderboard
immortalStartingPage
int
required
The page number where Immortal rank begins
immortalStartingIndex
int
required
The index where Immortal rank begins
topTierRRThreshold
int
required
The RR (Ranked Rating) threshold for top tier players
tierDetails
dict
required
Dictionary containing tier-specific details and thresholds
startIndex
int
required
The starting index for this leaderboard page
shard
str
required
The shard/region for this leaderboard
query
str | None
Optional query parameter used to filter the leaderboard

Example

import asyncio
from valaw import Client

async def main():
    client = Client(token="YOUR_API_KEY", cluster="americas")
    
    # Get top 50 players on NA leaderboard
    leaderboard = await client.GET_getLeaderboard(
        actId="current-act-id",
        region="na",
        size=50,
        startIndex=0
    )
    
    print(f"Total players on leaderboard: {leaderboard.totalPlayers}")
    print(f"Immortal starts at index: {leaderboard.immortalStartingIndex}")
    print(f"\nTop 10 Players:")
    
    for i, player in enumerate(leaderboard.players[:10], 1):
        print(f"{i}. {player.gameName}#{player.tagLine}")
        print(f"   Rank: {player.leaderboardRank} | RR: {player.rankedRating} | Wins: {player.numberOfWins}")
    
    await client.close()

asyncio.run(main())

PlayerDto

Represents a player on the competitive leaderboard.
leaderboardRank
int
required
The player’s rank position on the leaderboard (1 = top player)
rankedRating
int
required
The player’s current Ranked Rating (RR)
numberOfWins
int
required
Total number of competitive wins for the act
competitiveTier
int
required
The player’s competitive tier/rankTier values:
  • 0-2: Unranked/Iron
  • 3-5: Bronze
  • 6-8: Silver
  • 9-11: Gold
  • 12-14: Platinum
  • 15-17: Diamond
  • 18-20: Ascendant
  • 21-23: Immortal
  • 24: Radiant
puuid
str
default:"\"\""
The player’s unique identifier. Defaults to empty string for private profiles.
gameName
str
default:"\"Private\""
The player’s in-game name. Shows “Private” for private profiles.
tagLine
str
default:"\"\""
The player’s tag line. Empty string for private profiles.
Some players may have private profiles. In these cases, the gameName field will show “Private” and the puuid and tagLine fields will be empty strings.

Example

# Accessing player information
player = leaderboard.players[0]

if player.gameName != "Private":
    print(f"Player: {player.gameName}#{player.tagLine}")
    print(f"PUUID: {player.puuid}")
else:
    print("Player: [Private Profile]")

print(f"Rank: #{player.leaderboardRank}")
print(f"RR: {player.rankedRating}")
print(f"Wins: {player.numberOfWins}")
print(f"Tier: {player.competitiveTier}")

Competitive Tier Reference

The competitiveTier field maps to the following ranks:
Tier ValueRank
0Unranked
3Iron 1
4Iron 2
5Iron 3
6Bronze 1
7Bronze 2
8Bronze 3
9Silver 1
10Silver 2
11Silver 3
12Gold 1
13Gold 2
14Gold 3
15Platinum 1
16Platinum 2
17Platinum 3
18Diamond 1
19Diamond 2
20Diamond 3
21Ascendant 1
22Ascendant 2
23Ascendant 3
24Immortal 1
25Immortal 2
26Immortal 3
27Radiant

Helper Function

def get_rank_name(tier: int) -> str:
    """Convert competitive tier number to rank name."""
    ranks = {
        0: "Unranked",
        3: "Iron 1", 4: "Iron 2", 5: "Iron 3",
        6: "Bronze 1", 7: "Bronze 2", 8: "Bronze 3",
        9: "Silver 1", 10: "Silver 2", 11: "Silver 3",
        12: "Gold 1", 13: "Gold 2", 14: "Gold 3",
        15: "Platinum 1", 16: "Platinum 2", 17: "Platinum 3",
        18: "Diamond 1", 19: "Diamond 2", 20: "Diamond 3",
        21: "Ascendant 1", 22: "Ascendant 2", 23: "Ascendant 3",
        24: "Immortal 1", 25: "Immortal 2", 26: "Immortal 3",
        27: "Radiant"
    }
    return ranks.get(tier, "Unknown")

# Usage
for player in leaderboard.players[:10]:
    rank_name = get_rank_name(player.competitiveTier)
    print(f"{player.gameName}: {rank_name} ({player.rankedRating} RR)")

Build docs developers (and LLMs) love