---
name: snap-that-piece
description: Read a chess position from a photo of a physical board and get it back as FEN, through the Snap That Piece API preview, and report the read if it is wrong. Use when someone has a photo of a real chess set, a position in a book, or a game on a screen, and wants the position as FEN or as a rendered board. Needs an API key the person approves. 5 scans a day per account.
---

# Snap That Piece

Reads a chess position from a photo of a real board. It's built for real sets photographed at an angle from a player's seat.

Endpoints live at `https://app.snapthatpiece.com`. The full description is at [openapi.json](https://app.snapthatpiece.com/api/v1/openapi.json) and the docs are at [snapthatpiece.com/developers/](https://snapthatpiece.com/developers/).

If your client can connect to an MCP server, `https://app.snapthatpiece.com/mcp` does all of this with the person's sign-in instead of a key, and has a tool for sending a photo they attached. The rest of this page is for HTTP.

## 1. Get a key

If the person gave you a key (`stp_...`), use it. If not, ask them for one as [auth.md](https://snapthatpiece.com/auth.md) describes: you send your name and their email address, show them a code, they approve in Settings, and you collect the key once.

Send it on every request:

```
Authorization: Bearer stp_...
```

The key acts for the person. Keep it out of logs, prompts and anything shared.

## 2. Scan the photo

Post the image as the request body, up to 10 MB, as JPEG, PNG, WebP or HEIC:

```bash
curl -X POST https://app.snapthatpiece.com/api/v1/scans \
  -H "Authorization: Bearer $STP_KEY" \
  -H "Content-Type: image/jpeg" \
  --data-binary @board.jpg
```

Send the original file. Never shrink or recompress it to fit it into a message, because a small photo gets misread. A photo is refused with `not_an_image` if it can't be read, `image_too_small` under 64 pixels on a side, and `image_too_large` over 50 megapixels, or 12 for WebP. Metadata such as location is removed before it's stored. HEIC is the exception: it keeps its metadata and its size isn't checked.

The answer is `202` with the scan's `id`. Poll `GET /api/v1/scans/{id}` about once a second until `status` is `completed` or `failed`. It usually takes seconds.

## 3. Read the result

- `fen`: the position. A photo doesn't show whose turn it is, so treat the side to move, castling and en passant as placeholders. Ask the person if they matter.
- `unsure_squares`: the squares to check first. Errors can be elsewhere too.
- `unsure`: when true, have the person check the position before you rely on it.
- `orientation.ambiguous`: when true, the model couldn't tell which side is which, so the position may be turned 180°.
- `low_angle`: when true, a real board was shot from too low an angle, so some squares may be off. Suggest a retake from higher up.
- `links.board_png`: a picture of the read board, to show the person next to their photo. Fetch it with the key. `links.board_svg` is the same board as SVG.
- `error` and `message` on a failed scan: why it failed, as a code and a sentence to pass on. A failed scan where no board is found doesn't use up one of the day's 5.

Recognition is good, not perfect, and there is no accuracy figure. Don't quote `confidence` as one. When it matters, show the person the board and ask them to compare it with the photo.

## 4. Report a wrong read

Report it when the person says the position is wrong, or when you can see that it is. This is how we find the photos the model gets wrong.

Say whether the read was right. A thumbs-down asks one of us to look at the photo:

```bash
curl -X POST https://app.snapthatpiece.com/api/v1/scans/$SCAN_ID/rating \
  -H "Authorization: Bearer $STP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"rating": "down"}'
```

`rating` is `up`, `down`, or `null` to take it back.

Send the right position, if the person gave it to you or you can verify it. Don't guess:

```bash
curl -X POST https://app.snapthatpiece.com/api/v1/scans/$SCAN_ID/correct \
  -H "Authorization: Bearer $STP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"fen": "r2q1rk1/2p2ppp/2np1N2/1pb1p1B1/p3P3/1B1P1Q1P/PPP2PP1/R4RK1"}'
```

- Send `fen` in the same orientation as the scan's `fen`. Only its piece placement is used.
- If the pieces are right but the board is turned around, send `{"is_flipped": true}` instead. It's a value, not a toggle: the scan's `is_flipped` says what it is now. You can send both fields together, and `fen` still reads back as you sent it.
- The scan and its board images then show the fix, though an image fetched in the last five minutes may still be cached.

Both routes work on completed scans sent with this key, and both answer with the updated scan. A scan that failed or hasn't finished gets `409` with `not_ready`.

## Limits and rules

- 5 boards read a day per account, and 15 tries, whatever their result. `GET /api/v1/usage` says how many are left and when one comes back. Over a limit, the answer is `429` with a `Retry-After` header and an `error` code. Wait, and tell the person.
- 60 reports an hour per account. Reports don't use up scans.
- Only send photos the person has the right to share. Photos sent through the free API may be used to train our models.
- A result may be used to answer the person who asked. It may not be used to train or fine-tune models, to build a dataset, or be sold or redistributed. See the [Terms of Service](https://snapthatpiece.com/terms/).
- During the preview, the strip under the rendered board carries our logo and name. Leave it in place.
- Stockfish evaluations aren't part of the API. To analyze or play the position, hand the person `https://app.snapthatpiece.com/play?fen=<URL-encoded FEN>&utm_source=agent_skill&utm_medium=agent`. Set the real side to move in the FEN first: the page refuses a position that can't come up in a game, such as the side not to move being in check. If it refuses, the side to move or the read is wrong.
