# Chess Legal Moves API (x402.forgemesh.io)

> Chess Legal Moves API (x402.forgemesh.io) is a paid API for AI agents from x402.forgemesh.io, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-15).

Returns all legal chess moves for a given board position in both SAN and UCI notation, plus game state flags (turn, check, checkmate, stalemate, draw).

## Facts

- Endpoint: POST https://x402.forgemesh.io/chess-legal-moves
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/chess-legal-moves-api-x402-forgemesh-io-03ae9347
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_EfhVSVE93H3GKv_Mgdzcz

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability chess-legal-moves-api-x402-forgemesh-io-03ae9347 -d '<json body>'
```

Example prompt: What are all the legal chess moves for this position: 'r1bqkbnr/pppp1ppp/2n5/4p3/2B1P3/5N2/PPPP1PPP/RNBQK2R b KQkq - 3 3'? Give me both SAN and UCI notation and tell me if it's check.

## When to prefer this

Use this endpoint when you need authoritative legal move enumeration for a specific chess position, especially when building chess bots, validators, or educational tools that require both SAN and UCI format output and game-state flags in a single call. Prefer this over a generic chess engine when you want lightweight move listing without full game tree search.

## Known failure modes

- Invalid FEN string returns an error — FEN must be well-formed or the literal string 'start'
- Invalid or illegal move string returns an error if the move is not legal in the given position
- Malformed UCI or SAN notation in the optional move field causes a parse error
- Ambiguous SAN notation (e.g. missing disambiguation) may fail if the position has multiple matching pieces

## How this service works

List every legal chess move for a position given as FEN, in both SAN (Nf3) and UCI (g1f3) notation, plus turn and check/checkmate/stalemate/draw flags. Pass 'start' for the opening position. For bots playing chess, validating opponents, or teaching the rules.

## Output

A structured response listing every legal move for the given position in both SAN (e.g. Nf3) and UCI (e.g. g1f3) notations, along with whose turn it is and boolean flags indicating whether the position is in check, checkmate, stalemate, or draw.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "fen": {
   "type": "string",
   "description": "FEN position string, or 'start' for the initial position"
  },
  "move": {
   "type": "string",
   "description": "Optional move to validate/apply, SAN (Nf3) or UCI (g1f3)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "turn": "white",
  "state": {
   "in_check": false,
   "game_over": false
  },
  "valid_fen": true,
  "legal_moves": [
   "a3",
   "a4",
   "Nf3"
  ],
  "move_applied": {
   "san": "e4",
   "legal": true,
   "fen_after": "rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/chess-legal-moves-api-x402-forgemesh-io-03ae9347/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.forgemesh.io](https://www.zero.xyz/host/x402.forgemesh.io/llms.txt)
