# Chess a player's games with PGN API

Get Chess.com or Lichess player games with PGN in JSON via REST or OpenAny MCP—with pay-per-use pricing and no subscription. Powered by Apish, pass parameters such as limit, output, raw, and retrieve structured data including source game identifier, pgn, source game time class, and source game result notation for chess reference, and record navigation.

Documentation: https://openany.si/market/apis/chess/chess-a-player-s-games-with-pgn-api/?offering=a504426a-21bf-46f1-aff6-efc7fe962d74
API ID: a504426a-21bf-46f1-aff6-efc7fe962d74
Provider: apish
Contract revision: 3
Method: GET
Endpoint: https://api.openany.si/v1/agent-apis/apish/chess/v1/games
Page update time: 2026-12-03T02:47:47.956Z
Access: OpenAny REST
OpenAny MCP: availability is not supplied by this REST contract. Check get_api on the configured OpenAny MCP server before execution.
Request content type: none
Execution mode: sync
Authentication: Authorization: Bearer $OPENANY_API_KEY

## Billing
Price: $0.002 / billing credit
API-key calls use your shared balance. Review the published billing rules before making a paid request.
Price source: OpenAny public API contract. Price update time: not supplied.
Contract update time: 2026-12-03T02:47:46.637Z. This is not a price-change timestamp.
```json
{
  "currency": "USD",
  "mode": "rules",
  "parameters": [],
  "policy_version": 2,
  "sale": {
    "addons": [],
    "base_price_micro_usd": "0",
    "max_cost_micro_usd": "2000",
    "quantities": [
      {
        "id": "upstream_credits",
        "label": "Actual API.SH credits consumed",
        "max_quantity": "1",
        "measure": "value",
        "pointer": "/credits_used",
        "price_micro_usd": "2000",
        "quantity_scale": 0,
        "source": "response",
        "unit": "credit",
        "unit_quantity": "1"
      }
    ],
    "rounding": "ceil",
    "variants": []
  }
}
```

## Request parameters
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Chess a player's games with PGN API request inputs",
  "$comment": "Declared input types grouped by HTTP location. Path, query and header values describe decoded inputs and are serialized as text on the wire; body is the payload. This is not an exhaustive provider contract or a schema for the raw HTTP request.",
  "type": "object",
  "properties": {
    "path": {
      "type": "object",
      "properties": {}
    },
    "query": {
      "type": "object",
      "properties": {
        "username": {
          "type": "string",
          "description": "Username."
        },
        "site": {
          "type": "string",
          "description": "chesscom or lichess.",
          "enum": [
            "chesscom",
            "lichess"
          ]
        },
        "month": {
          "type": "string",
          "description": "YYYY-MM: games of that month."
        },
        "limit": {
          "type": "integer",
          "description": "Games to return (chess.com 1-500, lichess 1-100; default 50)."
        },
        "perf": {
          "type": "string",
          "description": "lichess only: bullet, blitz, rapid, classical, correspondence, chess960 ..."
        },
        "rated": {
          "type": "boolean",
          "description": "lichess only: true rated games only, false casual only."
        },
        "until": {
          "type": "string",
          "description": "lichess only: `next_until` from the previous page."
        },
        "time_class": {
          "type": "string",
          "description": "Only games of this time class: bullet, blitz, rapid, daily (lichess: correspondence) or classical (lichess). On lichess it stands in for `perf` when `perf` is not given.",
          "enum": [
            "bullet",
            "blitz",
            "rapid",
            "daily",
            "classical"
          ]
        },
        "color": {
          "type": "string",
          "description": "Only games the player had this colour in.",
          "enum": [
            "white",
            "black"
          ]
        },
        "result": {
          "type": "string",
          "description": "Only games the player won, lost or drew. On lichess it is applied to the page of games fetched, so a page can hold fewer than `limit` games; keep paging with `next_until`.",
          "enum": [
            "win",
            "loss",
            "draw"
          ]
        },
        "opponent": {
          "type": "string",
          "description": "Only games against this username."
        },
        "since": {
          "type": "string",
          "description": "Games played from this date (YYYY-MM-DD or epoch milliseconds). Same as `from`."
        },
        "analysed": {
          "type": "string",
          "description": "lichess only: true for games with computer analysis, false for games without.",
          "enum": [
            "true",
            "false"
          ]
        },
        "from": {
          "type": "string",
          "description": "Games played from this date (YYYY-MM-DD or epoch milliseconds)."
        },
        "to": {
          "type": "string",
          "description": "Games played up to this date, inclusive (YYYY-MM-DD or epoch milliseconds). chess.com pages with `next_to`."
        },
        "opening": {
          "type": "string",
          "description": "Only games whose opening name contains this text (e.g. sicilian defense, queens gambit declined)."
        },
        "eco": {
          "type": "string",
          "description": "Only games whose ECO code starts with this (e.g. B90, B9 or B)."
        },
        "sort": {
          "type": "string",
          "description": "lichess only: newest first (default) or oldest first (page with `next_after` as `after`).",
          "enum": [
            "newest",
            "oldest"
          ]
        },
        "after": {
          "type": "string",
          "description": "lichess only, with sort=oldest: `next_after` from the previous page."
        },
        "ongoing": {
          "type": "string",
          "description": "lichess only: true also returns games still being played.",
          "enum": [
            "true",
            "false"
          ]
        },
        "clocks": {
          "type": "boolean",
          "description": "lichess only: true adds the clock after every move (`clocks_centiseconds`)."
        },
        "raw": {
          "type": "string",
          "description": "0 leaves out the bulky `raw` source blocks (often 10-30x smaller).",
          "enum": [
            "0",
            "1"
          ]
        },
        "fields": {
          "type": "string",
          "description": "Comma-separated fields to return, e.g. `posts.id,posts.title`. Call metadata is always included."
        },
        "fresh": {
          "type": "string",
          "description": "1 skips the 24-hour cache and fetches live.",
          "enum": [
            "1"
          ]
        },
        "output": {
          "type": "string",
          "description": "JSON only for this OpenAny product. Omit output or use json; CSV and NDJSON are not supported.",
          "enum": [
            "json"
          ]
        },
        "records": {
          "type": "string",
          "description": "With output=csv|ndjson: the top-level list to turn into rows (e.g. `reviews`), or `.` for the whole object as one row."
        }
      },
      "required": [
        "username"
      ]
    },
    "headers": {
      "type": "object",
      "properties": {}
    }
  },
  "required": [
    "path",
    "query",
    "headers"
  ]
}
```

## Response fields
Source: Inferred from examples; not an exhaustive provider schema.
```json
{
  "type": "object",
  "properties": {
    "cached": {
      "type": "boolean"
    },
    "count": {
      "type": "integer"
    },
    "credits_used": {
      "type": "integer"
    },
    "fetched_at": {
      "type": "string"
    },
    "games": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "accuracies": {
            "type": "object",
            "properties": {
              "black": {
                "type": "number"
              },
              "white": {
                "type": "number"
              }
            }
          },
          "black": {
            "type": "object",
            "properties": {
              "rating": {
                "type": "integer"
              },
              "result": {
                "type": "string"
              },
              "username": {
                "type": "string"
              }
            }
          },
          "eco": {
            "type": "string"
          },
          "end_time": {
            "type": "string"
          },
          "fen": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "opening": {
            "type": "string"
          },
          "pgn": {
            "type": "string"
          },
          "rated": {
            "type": "boolean"
          },
          "result": {
            "type": "string"
          },
          "rules": {
            "type": "string"
          },
          "start_time": {
            "type": "string"
          },
          "termination": {
            "type": "string"
          },
          "time_class": {
            "type": "string"
          },
          "time_control": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "white": {
            "type": "object",
            "properties": {
              "rating": {
                "type": "integer"
              },
              "result": {
                "type": "string"
              },
              "username": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "month": {
      "type": "string"
    },
    "months": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "previous_month": {
      "type": "string"
    },
    "site": {
      "type": "string"
    },
    "username": {
      "type": "string"
    }
  }
}
```

## Request example
Scenario: Official example · Live API.SH response · Minimal request
```bash
curl \
  'https://api.openany.si/v1/agent-apis/apish/chess/v1/games?limit=1&output=json&raw=0&username=hikaru' \
  -X GET \
  -H "Authorization: Bearer $OPENANY_API_KEY" \
  -H 'Content-Type: application/json'
```

## Response example
Example from the provider's documentation. Field values in your results will differ.
Sample response · Documented HTTP 200
```json
{
  "cached": false,
  "count": 1,
  "credits_used": 1,
  "fetched_at": "2026-11-19T12:20:22.790Z",
  "games": [
    {
      "accuracies": {
        "black": 68.59,
        "white": 66.72
      },
      "black": {
        "rating": 3080,
        "result": "resigned",
        "username": "Carnivoras"
      },
      "eco": "A01",
      "end_time": "2026-11-19T01:35:02.000Z",
      "fen": "1Q2k3/2Rb2q1/3p3r/3P1p2/4p2p/PP2PpP1/5P2/6K1 b - - 1 39",
      "id": "9dd53891-e3b8-11f1-baf4-33d19f01000f",
      "opening": "Nimzowitsch Larsen Attack Modern Variation 2.Bb2 Nc6 3.c4 g6",
      "pgn": "[Event \"Live Chess\"]\n[Site \"Chess.com\"]\n[Date \"2026.11.19\"]\n[Round \"-\"]\n[White \"Hikaru\"]\n[Black \"Carnivoras\"]\n[Result \"1-0\"]\n[CurrentPosition \"1Q2k3/2Rb2q1/3p3r/3P1p2/4p2p/PP2PpP1/5P2/6K1 b - - 1 39\"]\n[Timezone \"UTC\"]\n[ECO \"A01\"]\n[ECOUrl \"https://www.chess.com/openings/Nimzowitsch-Larsen-Attack-Modern-Variation-2.Bb2-Nc6-3.c4-g6\"]\n[UTCDate \"2026.11.19\"]\n[UTCTime \"01:29:08\"]\n[WhiteElo \"3465\"]\n[BlackElo \"3080\"]\n[TimeControl \"180\"]\n[Termination \"Hikaru won by resignation\"]\n[StartTime \"01:29:08\"]\n[EndDate \"2026.11.19\"]\n[EndTime \"01:35:02\"]\n[Link \"https://www.chess.com/game/live/187517802954\"]\n\n1. b3 {[%clk 0:03:00]} 1... e5 {[%clk 0:03:00]} 2. Bb2 {[%clk 0:02:59.1]} 2... Nc6 {[%clk 0:02:59.7]} 3. c4 {[%clk 0:02:58.3]} 3... g6 {[%clk 0:02:57.1]} 4. g3 {[%clk 0:02:57.2]} 4... Bg7 {[%clk 0:02:56.5]} 5. Bg2 {[%clk 0:02:56.9]} 5... f5 {[%clk 0:02:49.9]} 6. e3 {[%clk 0:02:55.3]} 6... d6 {[%clk 0:02:49.6]} 7. Ne2 {[%clk 0:02:54.4]} 7... Nf6 {[%clk 0:02:49]} 8. d4 {[%clk 0:02:53.8]} 8... e4 {[%clk 0:02:47.7]} 9. O-O {[%clk 0:02:51.8]} 9... O-O {[%clk 0:02:46.9]} 10. a3 {[%clk 0:02:49.6]} 10... Ne7 {[%clk 0:02:45.5]} 11. d5 {[%clk 0:02:48.7]} 11... g5 {[%clk 0:02:43.4]} 12. Nbc3 {[%clk 0:02:36]} 12... Ng6 {[%clk 0:02:40.2]} 13. Qc2 {[%clk 0:02:34.2]} 13... Ne5 {[%clk 0:02:33]} 14. Rad1 {[%clk 0:02:33.2]} 14... Qe8 {[%clk 0:02:28.6]} 15. Nd4 {[%clk 0:02:30.2]} 15... g4 {[%clk 0:02:23.4]} 16. Nce2 {[%clk 0:02:25.8]} 16... Nf3+ {[%clk 0:02:21.2]} 17. Bxf3 {[%clk 0:02:23.6]} 17... gxf3 {[%clk 0:02:09]} 18. Nf4 {[%clk 0:02:23]} 18... Bh6 {[%clk 0:01:57.6]} 19. Kh1 {[%clk 0:01:46.6]} 19... Ng4 {[%clk 0:01:47.2]} 20. Qc3 {[%clk 0:01:43.9]} 20... Bg7 {[%clk 0:01:38.6]} 21. h3 {[%clk 0:01:40.8]} 21... Ne5 {[%clk 0:01:37.4]} 22. c5 {[%clk 0:01:19.4]} 22... Bd7 {[%clk 0:01:24.1]} 23. cxd6 {[%clk 0:01:14.2]} 23... cxd6 {[%clk 0:01:23]} 24. Qc7 {[%clk 0:01:13.9]} 24... Rc8 {[%clk 0:01:08.8]} 25. Qxb7 {[%clk 0:01:12.9]} 25... Rf6 {[%clk 0:00:55.6]} 26. Nde6 {[%clk 0:01:09.7]} 26... Rh6 {[%clk 0:00:38]} 27. Nxg7 {[%clk 0:01:07.6]} 27... Kxg7 {[%clk 0:00:37.9]} 28. Rc1 {[%clk 0:00:59.2]} 28... Kf8 {[%clk 0:00:31.6]} 29. Rxc8 {[%clk 0:00:57.1]} 29... Bxc8 {[%clk 0:00:31.5]} 30. Qc7 {[%clk 0:00:56.1]} 30... Bd7 {[%clk 0:00:29]} 31. Kg1 {[%clk 0:00:46.8]} 31... Qe7 {[%clk 0:00:22.5]} 32. Rc1 {[%clk 0:00:42]} 32... Ng6 {[%clk 0:00:21.4]} 33. Nxg6+ {[%clk 0:00:25.8]} 33... hxg6 {[%clk 0:00:20.5]} 34. h4 {[%clk 0:00:25.5]} 34... g5 {[%clk 0:00:19.9]} 35. Qb8+ {[%clk 0:00:23.6]} 35... Kf7 {[%clk 0:00:18.8]} 36. Rc7 {[%clk 0:00:23.3]} 36... gxh4 {[%clk 0:00:17.8]} 37. Qxa7 {[%clk 0:00:23.1]} 37... Ke8 {[%clk 0:00:09.2]} 38. Bg7 {[%clk 0:00:21.1]} 38... Qxg7 {[%clk 0:00:07.7]} 39. Qb8+ {[%clk 0:00:20.3]} 1-0\n",
      "rated": true,
      "result": "1-0",
      "rules": "chess",
      "start_time": "2026-11-19T01:29:08Z",
      "termination": "Hikaru won by resignation",
      "time_class": "blitz",
      "time_control": "180",
      "url": "https://www.chess.com/game/live/187517802954",
      "white": {
        "rating": 3465,
        "result": "win",
        "username": "Hikaru"
      }
    }
  ],
  "month": "2026-11",
  "months": [
    "2026-11",
    "2026-10",
    "2026-09",
    "2026-08",
    "2026-07",
    "2026-06",
    "2026-05",
    "2026-04",
    "2026-03",
    "2026-02",
    "2026-01",
    "2025-12",
    "2025-11",
    "2025-10",
    "2025-09",
    "2025-08",
    "2025-07",
    "2025-06",
    "2025-05",
    "2025-04",
    "2025-03",
    "2025-02",
    "2025-01",
    "2024-12",
    "2024-11",
    "2024-10",
    "2024-09",
    "2024-08",
    "2024-07",
    "2024-06",
    "2024-05",
    "2024-04",
    "2024-03",
    "2024-02",
    "2024-01",
    "2023-12",
    "2023-11",
    "2023-10",
    "2023-09",
    "2023-08",
    "2023-07",
    "2023-06",
    "2023-05",
    "2023-04",
    "2023-03",
    "2023-02",
    "2023-01",
    "2022-12",
    "2022-11",
    "2022-10",
    "2022-09",
    "2022-08",
    "2022-07",
    "2022-06",
    "2022-05",
    "2022-04",
    "2022-03",
    "2022-02",
    "2022-01",
    "2021-12",
    "2021-11",
    "2021-10",
    "2021-09",
    "2021-08",
    "2021-07",
    "2021-06",
    "2021-05",
    "2021-04",
    "2021-03",
    "2021-02",
    "2021-01",
    "2020-12",
    "2020-11",
    "2020-10",
    "2020-09",
    "2020-08",
    "2020-07",
    "2020-06",
    "2020-05",
    "2020-04",
    "2020-03",
    "2020-02",
    "2020-01",
    "2019-12",
    "2019-11",
    "2019-10",
    "2019-09",
    "2019-08",
    "2019-07",
    "2019-06",
    "2019-05",
    "2019-04",
    "2019-03",
    "2019-02",
    "2019-01",
    "2018-12",
    "2018-11",
    "2018-10",
    "2018-09",
    "2018-08",
    "2018-07",
    "2018-06",
    "2018-05",
    "2018-04",
    "2018-03",
    "2018-02",
    "2018-01",
    "2017-12",
    "2017-11",
    "2017-10",
    "2017-09",
    "2017-08",
    "2017-07",
    "2017-06",
    "2017-05",
    "2017-04",
    "2017-03",
    "2017-02",
    "2017-01",
    "2016-12",
    "2016-11",
    "2016-10",
    "2016-09",
    "2016-08",
    "2016-07",
    "2016-06",
    "2016-05",
    "2016-04",
    "2016-03",
    "2016-02",
    "2016-01",
    "2015-12",
    "2015-11",
    "2015-10",
    "2015-09",
    "2015-08",
    "2015-07",
    "2015-06",
    "2015-05",
    "2015-04",
    "2015-03",
    "2015-02",
    "2015-01",
    "2014-12",
    "2014-11",
    "2014-10",
    "2014-09",
    "2014-08",
    "2014-07",
    "2014-06",
    "2014-05",
    "2014-04",
    "2014-03",
    "2014-02",
    "2014-01"
  ],
  "previous_month": "2026-10",
  "site": "chesscom",
  "username": "hikaru"
}
```

## Error handling
400: Check the request fields.
401 / 403: Verify credentials and access permissions.
402: Inspect payment requirements and balance.
429: Respect returned retry guidance.
5xx: Inspect the error and usage record before retrying a paid operation.

## Available implementations
- apish: https://openany.si/market/apis/chess/chess-a-player-s-games-with-pgn-api/?offering=a504426a-21bf-46f1-aff6-efc7fe962d74

Integration guide: https://openany.si/docs/
Agent setup: https://openany.si/SKILL.md
