-
Notifications
You must be signed in to change notification settings - Fork 0
Relations
dblike edited this page Jan 20, 2026
·
1 revision
Follow, unfollow, block, and unblock users.
Namespace: LichessSharp.Api.Contracts
Access: client.Relations
Required Scope: follow:read, follow:write
Stream users who are being followed by the authenticated user.
Required Scope: follow:read
IAsyncEnumerable<UserExtended> StreamFollowingUsersAsync(
CancellationToken cancellationToken = default)Example:
using var client = new LichessClient(token);
Console.WriteLine("Users you follow:");
await foreach (var user in client.Relations.StreamFollowingUsersAsync())
{
var status = user.Online ? "Online" : "Offline";
Console.WriteLine($" {user.Username} ({status})");
if (user.Perfs?.Blitz != null)
{
Console.WriteLine($" Blitz: {user.Perfs.Blitz.Rating}");
}
}Follow a user.
Required Scope: follow:write
Task<bool> FollowUserAsync(string username, CancellationToken cancellationToken = default)Example:
using var client = new LichessClient(token);
await client.Relations.FollowUserAsync("DrNykterstein");
Console.WriteLine("Now following DrNykterstein");Unfollow a user.
Required Scope: follow:write
Task<bool> UnfollowUserAsync(string username, CancellationToken cancellationToken = default)Example:
using var client = new LichessClient(token);
await client.Relations.UnfollowUserAsync("username");
Console.WriteLine("Unfollowed user");Block a user.
Required Scope: follow:write
Task<bool> BlockUserAsync(string username, CancellationToken cancellationToken = default)Example:
using var client = new LichessClient(token);
await client.Relations.BlockUserAsync("spammer123");
Console.WriteLine("Blocked user");Unblock a user.
Required Scope: follow:write
Task<bool> UnblockUserAsync(string username, CancellationToken cancellationToken = default)Example:
using var client = new LichessClient(token);
await client.Relations.UnblockUserAsync("username");
Console.WriteLine("Unblocked user");- Users API - Get user profiles
- Account API - Get your own profile