# org.lichess.puzzle.getNextRanked

> Published by [pds.dad](https://lexicon.garden/identity/did:plc:rnpkyqnmsw4ipey6eotbdnnf)

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:rnpkyqnmsw4ipey6eotbdnnf/org.lichess.puzzle.getNextRanked)
- [Documentation](https://lexicon.garden/lexicon/did:plc:rnpkyqnmsw4ipey6eotbdnnf/org.lichess.puzzle.getNextRanked/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:rnpkyqnmsw4ipey6eotbdnnf/org.lichess.puzzle.getNextRanked/examples)

## Definitions

### `org.lichess.puzzle.getNextRanked`

**Type**: `query`

Fetches the next ranked puzzle for the authenticated player. Each puzzle needs to be solved or failed before requesting another; if the player already holds an unresolved ranked puzzle, that same puzzle (with a freshly re-signed challenge) is returned so a client that lost its token can recover it.

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `puzzle` | `ref` → `org.lichess.puzzle.defs#puzzleView` | Yes | The puzzle to solve. The player must find the continuation after the puzzle's first move (moves[0]). |
| `ranked` | `boolean` | Yes | Echoes whether this puzzle is scored. |
| `challenge` | `string` | Yes | Opaque signed token (JWT/HMAC/ed25519) encoding puzzleId, player DID, rating+RD snapshot, puzzle rating, nonce, and expiry. Passed back verbatim to submitAttempt. Empty for casual if you choose not to issue one. |

#### Errors

- **OutstandingPuzzle**: The player already has an unresolved ranked puzzle. Submit or let it time out before requesting another. This is what blocks request-peek-reroll grinding.
- **NoPuzzleAvailable**: No puzzle matched the requested filters.
- **PlayerLimited**: The player is temporarily blocked from ranked play. The message includes the RFC 3339 timestamp when the limit lifts. Submitting an already-outstanding puzzle still works.

## Raw Schema

```json
{
  "id": "org.lichess.puzzle.getNextRanked",
  "defs": {
    "main": {
      "type": "query",
      "errors": [
        {
          "name": "OutstandingPuzzle",
          "description": "The player already has an unresolved ranked puzzle. Submit or let it time out before requesting another. This is what blocks request-peek-reroll grinding."
        },
        {
          "name": "NoPuzzleAvailable",
          "description": "No puzzle matched the requested filters."
        },
        {
          "name": "PlayerLimited",
          "description": "The player is temporarily blocked from ranked play. The message includes the RFC 3339 timestamp when the limit lifts. Submitting an already-outstanding puzzle still works."
        }
      ],
      "output": {
        "schema": {
          "type": "object",
          "required": [
            "puzzle",
            "ranked",
            "challenge"
          ],
          "properties": {
            "puzzle": {
              "ref": "org.lichess.puzzle.defs#puzzleView",
              "type": "ref",
              "description": "The puzzle to solve. The player must find the continuation after the puzzle's first move (moves[0])."
            },
            "ranked": {
              "type": "boolean",
              "description": "Echoes whether this puzzle is scored."
            },
            "challenge": {
              "type": "string",
              "maxLength": 4096,
              "description": "Opaque signed token (JWT/HMAC/ed25519) encoding puzzleId, player DID, rating+RD snapshot, puzzle rating, nonce, and expiry. Passed back verbatim to submitAttempt. Empty for casual if you choose not to issue one."
            }
          }
        },
        "encoding": "application/json"
      },
      "description": "Fetches the next ranked puzzle for the authenticated player. Each puzzle needs to be solved or failed before requesting another; if the player already holds an unresolved ranked puzzle, that same puzzle (with a freshly re-signed challenge) is returned so a client that lost its token can recover it."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
