🏆 Custom Leaderboards

Empire Builder-Style Leaderboard Management

Create New Leaderboard

Your Leaderboards

Loading leaderboards...

API Documentation

Create Leaderboard

POST /api/custom-leaderboards/apiLeaderboards

{
  "name": "ZABAL Voters",
  "description": "Top voters in the community",
  "empire_address": "0x...",
  "metric_type": "votes",
  "icon_url": "https://...",
  "reset_frequency": "never"
}

Submit Score

POST /api/custom-leaderboards/submitScore

{
  "leaderboard_id": "uuid",
  "fid": 12345,
  "username": "zaal",
  "address": "0x...",
  "score": 42,
  "metadata": {}
}

Get Leaderboard

GET /api/custom-leaderboards/apiLeaderboards?id=uuid&limit=100

{
  "success": true,
  "data": {
    "id": "uuid",
    "name": "ZABAL Voters",
    "entries": [
      {
        "rank": 1,
        "fid": 12345,
        "username": "zaal",
        "score": 42
      }
    ]
  }
}

JavaScript Example

// Create leaderboard
const response = await fetch('/api/custom-leaderboards/apiLeaderboards', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    name: 'My Leaderboard',
    description: 'Track top performers',
    empire_address: '0x...',
    metric_type: 'votes'
  })
});

const result = await response.json();
console.log('Leaderboard created:', result.data);

// Submit score
await fetch('/api/custom-leaderboards/submitScore', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    leaderboard_id: result.data.id,
    fid: 12345,
    score: 100
  })
});