How to hit the Lichess API

Lichess's API at https://lichess.org/api is fully open: players, ratings, games, tournaments, and the daily puzzle. Some endpoints stream newline-delimited JSON.

Authentication

None for public data. Playing and account actions need a personal token sent as Authorization: Bearer.

Full reference: https://lichess.org/api

Get a player

curl https://lichess.org/api/user/DrNykterstein
Run in PostTaco
Example response (trimmed)
{
  "id": "drnykterstein",
  "username": "DrNykterstein",
  "perfs": {
    "ultraBullet": {
      "games": 92,
      "rating": 2406,
      "rd": 236,
      "prog": -7,
      "prov": true
    },
    "bullet": {
      "games": 9583,
      "rating": 3243,
      "rd": 89,
      "prog": -14
    },
    "blitz": {
      "games": 606,
      "rating": 3153,
      "rd": 165,
      "prog": 37,
      "prov": true
    },
    "rapid": {
      "games": 0,
      "rating": 2500,
      "rd": 150,
      "prog": 0,
      "prov": true
    },
    "classical": {
      "games": 0,
      "rating": 2500,
      "rd": 150,
      "prog": 0,
      "prov": true
    },
    "correspondence": {
      "games": 0,
      "rating": 1500,
      "rd": 500,
      "prog": 0,
      "prov": true
    },
    "chess960": {
      "games": 129,
      "rating": 2541,
      "rd": 194,
      "prog": -26,
      "prov": true
    },
    "atomic": {
      "games": 25,
      "rating": 2160,
      "rd": 263,
      "prog": 85,
      "prov": true
    }
  },
  "title": "GM",
  "flair": "people.santa-claus-light-skin-tone",
  "patron": true,
  "patronColor": 10,
  "createdAt": 1544100290814,
  "profile": {},
  "seenAt": 1787911725437,
  "playTime": {
    "total": 1169601,
    "tv": 665451
  },
  "url": "https://lichess.org/@/DrNykterstein",
  "count": {
    "all": 10450,
    "rated": 10435,
    "draw": 834,
    "loss": 2409,
    "win": 7207,
    "bookmark": 0,
    "playing": 0,
    "import": 0,
    "me": 0
  },
  "streamer": {
    "twitch": {
      "channel": "https://www.twitch.tv/maskenissen"
    }
  }
}

Daily puzzle

curl https://lichess.org/api/puzzle/daily
Run in PostTaco
Example response (trimmed)
{
  "game": {
    "id": "vGz7CtP3",
    "perf": {
      "key": "blitz",
      "name": "Blitz"
    },
    "rated": true,
    "players": [
      {
        "name": "GrischukOP",
        "id": "grischukop",
        "color": "white",
        "rating": 2128
      },
      {
        "name": "toki48",
        "id": "toki48",
        "color": "black",
        "rating": 2133
      }
    ],
    "clock": "3+0"
  },
  "puzzle": {
    "id": "tAoUi",
    "rating": 1980,
    "plays": 82158,
    "solution": [
      "c6d5",
      "d6d7"
    ],
    "themes": [
      "exposedKing",
      "endgame"
    ],
    "fen": "8/P3B3/2bP2k1/3B1p1p/1p2pP2/b1p1P2P/2K5/8 b - - 1 1",
    "lastMove": "b3d5",
    "initialPly": 108
  }
}

Top players by variant

curl https://lichess.org/api/player/top/2/blitz
Run in PostTaco
Example response (trimmed)
{
  "users": [
    {
      "id": "aspiringstar",
      "username": "aspiringstar",
      "perfs": {
        "blitz": {
          "rating": 3000,
          "progress": 9
        }
      },
      "title": "GM"
    },
    {
      "id": "princec7",
      "username": "Princec7",
      "perfs": {
        "blitz": {
          "rating": 2984,
          "progress": -10
        }
      },
      "title": "IM"
    }
  ]
}