Back to Projects

Leaderboard API

In-memory leaderboard system for the Bean Catcher game. Submit scores, retrieve top players, and track rankings.

Endpoints

GET/api/leaderboard

Retrieve the top 10 scores sorted by score descending

POST/api/leaderboard

Submit a new score to the leaderboard

POST Request Body

playerNamestring (required)Player name, 1-20 characters
scorenumber (required)Score value, must be a positive integer

Response Schema (Entry)

idstringUnique identifier for the entry
playerNamestringPlayer's display name
scorenumberPlayer's score
timestampstring (ISO 8601)When the score was submitted

🧪 Try It Live

Fetch the current top 10 scores from the leaderboard.

Submit a new score to the leaderboard.

Example Requests

# GET top scores
curl https://beanola.com/api/leaderboard
# POST new score
curl -X POST https://beanola.com/api/leaderboard \
  -H "Content-Type: application/json" \
  -d '{"playerName": "BunMaster", "score": 2500}'

Example Response (GET)

[
  {
    "id": "1706180400000-abc123",
    "playerName": "BunMaster",
    "score": 2500,
    "timestamp": "2025-01-25T12:00:00.000Z"
  },
  {
    "id": "1706180300000-def456",
    "playerName": "CoffeeBean",
    "score": 2100,
    "timestamp": "2025-01-25T11:58:20.000Z"
  }
]

Want to earn a real score?

Play Bean Catcher