Skip to content

REST API Reference

You can extract live data from the leaderboards and the validated database by integrating our public URLs into your own web projects or apps.

NOTE

All public endpoints are read-only (GET) and return data in application/json format.


👤 Player Profile

Extracts basic info, current ELO, wins, podiums, and PBs of an LFS player.

  • URL: GET https://lfsrank.com/api/api_player.php?uname={username}
  • Optional Params: track and car (to return specific Personal Best records).

Real Response (Example)

json
{
  "status": "success",
  "player": {
    "id": 142,
    "uname": "danielin",
    "elo": 1540,
    "wins": 12,
    "races": 50,
    "nation": "ESP",
    "team_name": "MyTeam",
    "podiums": 25
  },
  "pb": {
    "track": "BL1",
    "car": "XFG",
    "time": 92350
  }
}

🏆 Global Leaderboards

Extracts players sorted by their ELO skill level. Paginated.

  • URL: GET https://lfsrank.com/api/rankings.php
  • Optional Params:
    • limit: Limit of players (max 500).
    • offset: Pagination (default 0).
    • sort: Allows wins to sort by victories instead of ELO.

Real Response (Example)

json
{
  "status": "success",
  "count": 100,
  "rankings": [
    {
      "uname": "danielin",
      "elo": 1540,
      "wins": 12,
      "races": 50,
      "nation": "ESP",
      "team_name": "MyTeam",
      "rank": 1
    }
  ]
}

🌐 Recent Validated Races

Shows the list of race blocks that have already been cryptographically verified by the local SQLite database (validator_node.db).

  • URL: GET https://lfsrank.com/api/races.php
  • Optional Params: page (int) and limit (int).

Real Response (Example)

json
{
  "status": "success",
  "total": 542,
  "races": [
    {
      "id": 542,
      "track": "AS1",
      "allowed_cars": "TBO",
      "server_id": "SPAIN RACING",
      "previous_hash": "2cf24dba5fb0a30...",
      "signature": "e3b0c44298fc1c1...",
      "race_date": "2024-05-30 08:05:22",
      "results": [
         { "position": 1, "uname": "danielin", "total_time": 64200 }
      ]
    }
  ]
}

Released under the MIT License.