- Blind mode tutorial
lichess.org
Donate

Free chess API to get legal moves from FEN string

Hello,

A friend of mine needed an easy way to get chess legal moves from a FEN string for his project, so I developed a small API that allows just that.

I thought that it could be of use for other people so I hosted it to make it available for free.

If you want to use it, it's fairly easy, you just have to issue a get request to this url https://alpha.pawnpal.pbou.dev/standard/ and add an URL encoded FEN string and you will get a json of all possible moves for this specific position.

To get the FEN of a position you can copy it from any analysis board on Lichess and use some tool like https://www.urlencoder.org/

So far only the standard variant is available.

Example:
Entering this in your browser
https://alpha.pawnpal.pbou.dev/standard/6k1%2F4P3%2F5K2%2F8%2F8%2F8%2F8%2F8%20b%20-%20-%200%201
Will return the following
[
{
"role":"King",
"from":"G8",
"capture":null,
"to":"H7","promotion":null
},
{
"role":"King",
"from":"G8",
"capture":null,
"to":"H8",
"promotion":null
}
]

Here is the Github page for interested people: https://github.com/PierreBou91/pawn-pal

Feel free to submit ideas or contribute if you want. Otherwise, I think other similar/more advanced might suit your need (https://mutsuntsai.github.io/fen-tool/)

I hope you find it useful !

Hello, A friend of mine needed an easy way to get chess legal moves from a FEN string for his project, so I developed a small API that allows just that. I thought that it could be of use for other people so I hosted it to make it available for free. If you want to use it, it's fairly easy, you just have to issue a get request to this url https://alpha.pawnpal.pbou.dev/standard/ and add an URL encoded FEN string and you will get a json of all possible moves for this specific position. To get the FEN of a position you can copy it from any analysis board on Lichess and use some tool like https://www.urlencoder.org/ So far only the standard variant is available. Example: Entering this in your browser https://alpha.pawnpal.pbou.dev/standard/6k1%2F4P3%2F5K2%2F8%2F8%2F8%2F8%2F8%20b%20-%20-%200%201 Will return the following [ { "role":"King", "from":"G8", "capture":null, "to":"H7","promotion":null }, { "role":"King", "from":"G8", "capture":null, "to":"H8", "promotion":null } ] Here is the Github page for interested people: https://github.com/PierreBou91/pawn-pal Feel free to submit ideas or contribute if you want. Otherwise, I think other similar/more advanced might suit your need (https://mutsuntsai.github.io/fen-tool/) I hope you find it useful !

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