Documentation / API reference
POST /v1/bestmove
- Auth
- Bearer API key (keyless allowed with limits on eval and bestmove)
- Minimum plan
- free
Request body
| Field | Type | Default | Notes |
|---|---|---|---|
fen * | string | ||
depth | integer | 14 | 1 to 30 |
multipv | integer | 1 | 1 to 10 |
movetime_ms | integer | 50 to 60000 | |
engine | string | latest | Engine version id from GET /engines, or `latest`. |
path | auto | wasm | native | auto | |
options | object | UCI options by JSON name; schema and defaults from GET /engines. |
curl -s https://stockfishapi.com/v1/bestmove \
-H "Authorization: Bearer $STOCKFISH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"fen":"r1bqkbnr/pppp1ppp/2n5/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - 2 3","depth":14,"multipv":1}' const res = await fetch("https://stockfishapi.com/v1/bestmove", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.STOCKFISH_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
"fen": "r1bqkbnr/pppp1ppp/2n5/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - 2 3",
"depth": 14,
"multipv": 1
}),
});
const data = await res.json(); import os, requests
r = requests.post(
"https://stockfishapi.com/v1/bestmove",
headers={"Authorization": f"Bearer {os.environ['STOCKFISH_API_KEY']}"},
json={
"fen": "r1bqkbnr/pppp1ppp/2n5/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - 2 3",
"depth": 14,
"multipv": 1
},
)
data = r.json() Responses
| Status | Meaning |
|---|---|
200 | Best move |
Errors follow problem+json with next_action.