Python SDK — Leaderboard

Leaderboard ranks are computed on read from numeric player_data fields: pick the fields to sort by — array order defines tie-breaking — and a limit of 1-100. Updating player data changes standing immediately, no rebuild step.

Leaderboard — client.leaderboard

get
client.leaderboard.get(sort_by: list[str], limit: int = 10, data_cls: type | None = None) -> LeaderboardResponse

Gets the ranked leaderboard sorted by player-data fields (limit 1-100).

Example Usage:

# Sort by level, then score
response = client.leaderboard.get(["level", "score"], limit=10)

for entry in response.leaderboard:
    print(f"#{entry.rank} - {entry.player_name}")
    # typed player data: entry.player_data

How ranking works

The leaderboard is a live ranking over the numeric fields in player data — there is no separate score submission. You write fields like wins, level or score through player data updates, and the board sorts them server-side at read time, so standings always reflect the latest data.

Pass the field names to sort by — array order defines tie-breaking — and a limit between 1 and 100 rows. Each entry carries the rank, display name and player data; SDKs with typed responses can deserialize that data straight into your own model type.

  • Keep ranked fields numeric and identically named across every platform build — a renamed field splits the board.
  • Boards are computed on read: a data update changes standing immediately, with no rebuild or cache to wait out.
  • Ranked fields are public by nature — never store anything private in the fields you sort on.
  • Calls are synchronous functions — wrap them in asyncio.to_thread or your engine's job system when the game loop cannot block, and reuse one client across coroutines.