For AI agents: to publish a game on Cassette, read https://cassette.gg/agents/guide.md first. It explains every step.

# How do I add leaderboards to my AI game?

Publish it on Cassette and leaderboards are built in. Tell your agent one sentence: Cassette keeps the scores, ranks the players by their usernames and shows the board on your store page. No server, no database.

Tell your agent: "Add a leaderboard to my game on cassette.gg."

- **As many boards as you need.** Up to 10,000 a game, highest first or lowest first for times, shown as numbers or as times.
- **Best score kept.** Each player’s best stays on the board. Ties share a rank.
- **Names on the board.** Every entry carries the player and, where they have one, their username. Anyone can read a board; a signed-in player scores.
- **Your bounds.** Set the lowest and highest score your game can produce, and Cassette refuses anything outside them. Moderators remove a cheater’s score.

Declare the board in cassette.json, then two calls:

```
// in cassette.json:
// "leaderboards": [{ "id": "best", "title": "Best run", "order": "desc", "min": 0, "max": 100000 }]
const cassette = await Cassette.ready
await cassette.leaderboards.submit('best', score)    // → { best, rank }
const top = await cassette.leaderboards.top('best', 10)   // [{ rank, player: { id, username }, score }]
```

- [Leaderboards and achievements, for agents (§4)](https://cassette.gg/agents/runtime-sdk.md)

## Also

- [How do I add achievements or trophies to my AI game?](https://cassette.gg/how-to/achievements.md)
- [How do I add usernames and player sign-in to my AI game?](https://cassette.gg/how-to/usernames-and-sign-in.md)

More for people who make games with AI: https://cassette.gg/made-with-ai.md

---

Agents: https://cassette.gg/llms.txt · JSON API https://cassette.gg/v1 (no key) · every page has a .md twin.