lichess.org
Donate

Create a game for two other players to join

I'm wondering if such a feature is available: I'd like to be able to create a game, setting variant, rated/casual, and time control, and then let two other players play it.

I help run a small club that runs over lichess, and right now we have a combination of learning sessions and arena tournaments, but we want to add additional meetings where games are more *ad hoc*. There are often people new to lichess at these and we would like to make it as easy as possible for them to get going in these meetings. Creating two or three games that these players could simply join by clicking on a link in the team forum would be quite helpful.

Is such a thing available? If not, does it seem like something the lichess maintainers would be interested in adding?
@CrossEye message them and tell them to challenge each other or invite them both to a study and do it there :)
@TBest how exaclty would one do that? what would you need to type in on CMD or anything like that to generate the link?
@jdwhite42 if you want help doing it i suggest you join lichess's discord (you can find it on the home page below the top game or ask for a link)
@jdwhite42: Yes, we always could do that, but I was looking for an alternative.

@TBest: Thank you. I didn't even know there was an API. I will definitely look, because that could do exactly what we want.

@jdwhite42: If you're not a computer programmer, this probably isn't for you, although following the advice from for_cryingout_loud, you might be able to learn enough to do it!
@CrossEye i'm kinda a computer programmer?

i did enough stuff to be able to make a bot on lichess but that was just following instructions so idk lol
@jdwhite42:

Just testing so far myself, I was able to do this: in the browser console:
```
fetch('lichess.org/api/challenge/open', {
method: 'POST',
body: new URLSearchParams({
rated: false,
'clock.limit': 300,
'clock.increment': 0,
name: 'Just a challenge'
})
})
.then (resp => resp.json())
.then (console .log)
.catch (console .warn)
```

and get back a result like this:

```
{
"challenge": {
"id": "ovdODEHx",
"url": "lichess.org/ovdODEHx",
"status": "created",
"challenger": null,
"destUser": null,
"variant": {
"key": "standard",
"name": "Standard",
"short": "Std"
},
"rated": false,
"speed": "blitz",
"timeControl": {
"type": "clock",
"limit": 300,
"increment": 0,
"show": "5+0"
},
"color": "random",
"perf": {
"icon": "",
"name": "Blitz"
}
},
"socketVersion": 0,
"urlWhite": "lichess.org/ovdODEHx?color=white",
"urlBlack": "lichess.org/ovdODEHx?color=black"
}
```

It looks like authentication is not required for this endpoint, at least when I'm logged in, but I had already gotten a personal access token from lichess.org/account/oauth/token/create and stored it in local storage as 'ttec-bot', with the value `{"token":"<MY TOKEN HERE>"}`. So if it ever is required, I can add this to the fetch call:

```
headers: {
Authorization: `Bearer ${JSON.parse(localStorage.getItem ('ttec-bot')).token}`
},
```

For me, now it's a matter of playing with how to show this in the UI (probably a bookmarklet that duplicates the createGame) and then possibly auto-posting it into our Team's chat window. But at this point, it definitely looks doable.

@TBest: This is perfect, and very easy to use! Thank you very much!
As have already been mentioned, discord is great for API questions/support. But it sounds like you know your way around already :)

This topic has been archived and can no longer be replied to.