How can I export all my games played on chess.com?
For example to import to another program for analysis.
Exporting from the chess.com games list only shows the most recent 50 games.
Chess Stack Exchange is a question and answer site for serious players and enthusiasts of chess. It only takes a minute to sign up.Sign up to join this community
OpeningTree.com allows you to export all games played as White or Black by username.
Python wrapper for chess.com API by Artur Saradzhyan (I have not tested this.)
Manually export games from the chess.com game list, 50 at a time by date range (may require trivial deduplication). Supports chess clock info.
@qwr’s answer to their own question mentions a “Python wrapper for chess.com API,” but I think it’s worthwhile answering with the API itself, because it’s very accessible without any need to know/use Python. Hence…
Chess.com has, a fairly recently provided, Published Data API. See announcement by Ben Curtis, on May 10, 2022: “Published-Data API”:
The PubAPI is a read-only REST API that responds with JSON-LD data. Our goal is to re-package all currently public data from the website and make it available via the PubAPI. "Public Data" is information available to people who are not logged in, such as player data, game data, and club/tournament information. This excludes private information that is restricted to the logged in user, such as game chat and conditional moves.
The key with using a REST API is to construct the appropriate URL that represents your query. (See Zell Liew, “Understanding And Using REST APIs, Smashing Magazine, May 20, 2021, for the most-accessible intro I know about getting information from a REST API.)
For example, to find out some basic information about Hikaru, specifically his “user profile,” put the following URL in your browser’s address bar:
Your browser will return with:
avatar "https://images.chesscomf…0x200o.f323efa57fd0.jpeg" player_id 15448422 @id "https://api.chess.com/pub/player/hikaru" url "https://www.chess.com/member/Hikaru" name "Hikaru Nakamura" username "hikaru" title "GM" followers 983906 country "https://api.chess.com/pub/country/US" location "Sunrise, Florida" last_online 1662743764 joined 1389043258 status "premium" is_streamer true twitch_url "https://twitch.tv/gmhikaru" verified true
For basic statistics about a player (ratings, win/loss, and other stats about a player's game play, tactics, lessons and Puzzle Rush score), tack on “/stats” to the previous URL:
This produces a long-ish regurgitation of statistics, for example, that Hikaru’s last bullet rating was 3352:
. . . chess_bullet last rating 3352 date 1661276020 rd 41 best rating 3570 date 1605136047 game "https://www.chess.com/game/live/5710095242" record win 10136 loss 1376 . . .
Most directly on point to your question, you can get the PGN for all games a given player (i.e., you) played in a month. For Hikaru, for April 2022, the URL would be:
and your browser will download a multi-game PGN file.
AFAICT, you can download a player’s game for a particular month, but not for any broader period.
Since the URLs are very simple, it would be pretty easy to construct several year’s worth of URLs with a text editor and copy/pasting to change the years and months.
Use my API to get all games.
It is very simple.