Getting Started
Make your first API call in 30 seconds.
Base URL
https://chessgrammar.com/api/v1
No API key or authentication required during the Developer Preview.
Your first call
Analyze a position for tactical patterns:
curl -X POST https://chessgrammar.com/api/v1/extract \
-H "Content-Type: application/json" \
-d '{"fen": "6k1/5p1p/4p3/4q3/3n4/2Q3P1/PP1N1P1P/6K1 b - - 3 37"}'
This position contains a knight fork and a discovered attack. The response:
{
"tactics": [
{
"pattern": "fork",
"color": "black",
"trigger_move": "d4e2",
"key_squares": ["e2"],
"target_squares": ["g1", "c3"],
"targets": [
{"square": "g1", "piece": "K", "piece_name": "king", "color": "white"},
{"square": "c3", "piece": "Q", "piece_name": "queen", "color": "white"}
],
"gain": 700,
"gain_confirmed": true,
"is_mate": false,
"sequence": null,
"fen": "6k1/5p1p/..."
},
{
"pattern": "discovered_attack",
"color": "black",
"trigger_move": "d4e2",
"key_squares": ["e5", "d4"],
"target_squares": ["c3"],
"gain": 700,
"gain_confirmed": true,
"is_mate": false,
"sequence": null,
"fen": "6k1/5p1p/..."
}
],
"count": 2,
"depth": "l2",
"performance_ms": 48.2,
"fen": "6k1/5p1p/..."
}
Reading the response
Each tactic in the tactics array contains:
| Field | Description |
|---|---|
pattern | Tactic type: fork, pin, skewer, discovered_attack, double_check, back_rank_mate, smothered_mate, deflection, interference, trapped_piece |
color | Which side has the tactic (white or black) |
trigger_move | The move that initiates the tactic (UCI format) |
key_squares | The critical square(s) involved |
target_squares | The squares of the attacked/affected pieces |
targets | Detailed info on each target (square, piece type, color) |
gain | Material gain in centipawns (100 = pawn, 300 = knight/bishop, 500 = rook, 900 = queen) |
gain_confirmed | true if confirmed through forcing tree (L2), false for L1 candidates |
is_mate | true if the tactic leads to checkmate |
sequence | Forcing move sequence (only when with_sequence: true) |
Try it interactively
The Playground lets you paste a FEN or PGN and see results instantly, with a visual board.
Next steps
- Core Concepts — understand L1/L2 depth and forcing trees
- API Reference — full endpoint documentation
- Patterns — all 10 tactical patterns with examples
- Examples — real-world curl examples