-
Notifications
You must be signed in to change notification settings - Fork 0
Fide
dblike edited this page Mar 24, 2026
·
3 revisions
Access FIDE (World Chess Federation) player data from Lichess.
Namespace: LichessSharp.Api.Contracts, LichessSharp.Models.Fide
Access: client.Fide
Get information about a FIDE player by their FIDE ID.
Task<FidePlayer> GetPlayerAsync(
int playerId,
CancellationToken cancellationToken = default)Example:
using var client = new LichessClient();
// Magnus Carlsen's FIDE ID
var player = await client.Fide.GetPlayerAsync(1503014);
Console.WriteLine($"Name: {player.Name}");
Console.WriteLine($"Title: {player.Title}");
Console.WriteLine($"Federation: {player.Federation}");
Console.WriteLine($"Year of Birth: {player.Year}");
Console.WriteLine();
Console.WriteLine("Ratings:");
Console.WriteLine($" Standard: {player.Standard}");
Console.WriteLine($" Rapid: {player.Rapid}");
Console.WriteLine($" Blitz: {player.Blitz}");
if (player.Inactive == true)
{
Console.WriteLine("\nPlayer is inactive");
}Search for FIDE players by name.
Task<IReadOnlyList<FidePlayer>> SearchPlayersAsync(
string query,
CancellationToken cancellationToken = default)Example:
using var client = new LichessClient();
var players = await client.Fide.SearchPlayersAsync("Carlsen");
Console.WriteLine($"Found {players.Count} players:\n");
foreach (var player in players)
{
var title = player.Title.HasValue ? $"{player.Title} " : "";
var rating = player.Standard?.ToString() ?? "unrated";
Console.WriteLine($"{title}{player.Name}");
Console.WriteLine($" FIDE ID: {player.Id}");
Console.WriteLine($" Federation: {player.Federation}");
Console.WriteLine($" Standard: {rating}");
Console.WriteLine();
}Get the historical FIDE ratings for a player across all time controls.
Task<FidePlayerRatings> GetPlayerRatingsAsync(
int playerId,
CancellationToken cancellationToken = default)Example:
using var client = new LichessClient();
// Magnus Carlsen's FIDE ID
var ratings = await client.Fide.GetPlayerRatingsAsync(1503014);
Console.WriteLine($"Standard history: {ratings.Standard.Count} data points");
Console.WriteLine($"Rapid history: {ratings.Rapid.Count} data points");
Console.WriteLine($"Blitz history: {ratings.Blitz.Count} data points");Note: Each data point is an encoded number containing the year, month, and ELO rating. For example,
2015081568means August 2015, rating 1568.
using var client = new LichessClient();
var worldChampions = new[] { "Carlsen", "Ding Liren", "Nepomniachtchi" };
foreach (var name in worldChampions)
{
var players = await client.Fide.SearchPlayersAsync(name);
var topPlayer = players
.Where(p => p.Standard >= 2700)
.OrderByDescending(p => p.Standard)
.FirstOrDefault();
if (topPlayer != null)
{
Console.WriteLine($"{topPlayer.Title} {topPlayer.Name} ({topPlayer.Federation}): {topPlayer.Standard}");
}
}using var client = new LichessClient();
async Task CompareRatings(int fideId1, int fideId2)
{
var player1 = await client.Fide.GetPlayerAsync(fideId1);
var player2 = await client.Fide.GetPlayerAsync(fideId2);
Console.WriteLine($"Rating Comparison: {player1.Name} vs {player2.Name}\n");
var categories = new[] { ("Standard", player1.Standard, player2.Standard),
("Rapid", player1.Rapid, player2.Rapid),
("Blitz", player1.Blitz, player2.Blitz) };
foreach (var (category, r1, r2) in categories)
{
var diff = (r1 ?? 0) - (r2 ?? 0);
var diffStr = diff > 0 ? $"+{diff}" : diff.ToString();
Console.WriteLine($"{category}: {r1 ?? 0} vs {r2 ?? 0} ({diffStr})");
}
}
// Compare Magnus Carlsen and Fabiano Caruana
await CompareRatings(1503014, 2020009);| Property | Type | Description |
|---|---|---|
| Id | int | FIDE player ID |
| Name | string | Player's full name |
| Title | Title? | Chess title (GM, IM, FM, WGM, WIM, etc.) |
| Federation | string? | 3-letter country code (USA, NOR, CHN, etc.) |
| Year | int? | Year of birth |
| Inactive | bool? | Whether the player is inactive |
| Standard | int? | Standard (classical) FIDE rating |
| Rapid | int? | Rapid FIDE rating |
| Blitz | int? | Blitz FIDE rating |
| Property | Type | Description |
|---|---|---|
| Standard | IReadOnlyList<long> | Historical standard (classical) ratings (encoded) |
| Rapid | IReadOnlyList<long> | Historical rapid ratings (encoded) |
| Blitz | IReadOnlyList<long> | Historical blitz ratings (encoded) |
| Title | Description |
|---|---|
| GM | Grandmaster |
| IM | International Master |
| FM | FIDE Master |
| CM | Candidate Master |
| WGM | Woman Grandmaster |
| WIM | Woman International Master |
| WFM | Woman FIDE Master |
| WCM | Woman Candidate Master |
- FIDE data is updated periodically from the official FIDE database
- Some players may have partial rating information (e.g., no blitz rating)
- The search is case-insensitive and matches partial names
- FIDE IDs are permanent identifiers and don't change
- Users API - Lichess user profiles
- Broadcasts API - Broadcast tournament players with FIDE data