Leaderboards & competition
Boards, periods, keyed boards, tournaments, and promotion/relegation leagues.
Configure a board once (dashboard → Leaderboards, or the MCP/dev API): its aggregation (best / last / sum) and period (all-time / daily / weekly). Then submit scores and read ranks. The server keeps the aggregate for the current period.
await tg.leaderboards.submit('high_scores', 9000);
const { entries } = await tg.leaderboards.top('high_scores', { limit: 10 });
const around = await tg.leaderboards.aroundMe('high_scores'); Keyed boards
Rank entities other than players — teams, UGC items, or a custom entity id — with tg.keyedBoards. Same shape, but you submit for an entity_id.
Tournaments
A tournament is a time-boxed competition over a board with a reward table. Players join (optionally paying an entry fee); at the end the server finalizes standings and pays prizes through the inbox. Configure them in the dashboard (Competition) or the dev API.
Leagues
Leagues group players into tiered divisions (bronze → silver → gold …). Each season the operator advances the league: top players are promoted, bottom players relegated. Players see their division and rank via tg.leagues.