Free online Chess server. Play Chess now in a clean interface. No registration, no ads, no plugin required. Play Chess with the computer, friends or random opponents.
Create a gameTournamentSimultaneous exhibitions
Chess basicsPuzzlesPracticeCoordinatesStudyCoaches
Lichess TVCurrent gamesStreamersBroadcasts (beta)Video library
PlayersTeamsForumQuestions & Answers
Analysis boardOpening explorerBoard editorImport gameAdvanced search
Sign in
  1. Forum
  2. General Chess Discussion
  3. For Newbie Javascript Lichess Bot Developers (i.e. just me?)

After some learning curve to get the Lichess API to work, I have distilled a small test program from what I learnt.

It will use my API token and retrieve my username from the Lichess accounts API.

There's no error checking etc as I wanted as small a demo program as reasonably possible.

const baseURL = ""
const APITOKEN = "YourAPItokenHere"

const axios = require('axios')

const headers = {Authorization: `Bearer ${APITOKEN}`}
const lichess = {baseURL, headers};

(async () => {console.log((await axios.get('/api/account', lichess)).data.username)})();