user28052: 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.

user17203: @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:
https://api.chess.com/pub/player/hikaru

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:
https://api.chess.com/pub/player/hikaru/stats

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:
https://api.chess.com/pub/player/hikaru/games/2022/04/pgn

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.

user28052: 
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.



28052: <p>How can I export all my games played on chess.com?</p>
<p>For example to import to another program for analysis.</p>
<p>Exporting from the chess.com games list only shows the most recent 50 games.</p>
 17203: <p>@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…</p>
<p>Chess.com has, a fairly recently provided, Published Data API. See announcement by Ben Curtis, on May 10, 2022: “<a href="https://www.chess.com/news/view/published-data-api" rel="nofollow noreferrer">Published-Data API</a>”:</p>
<blockquote>
<p>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. &quot;Public Data&quot; 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.</p>
</blockquote>
<p>The key with using a REST API is to construct the appropriate URL that represents your query. (See Zell Liew, “<a href="https://www.smashingmagazine.com/2018/01/understanding-using-rest-api/" rel="nofollow noreferrer">Understanding And Using REST APIs</a>, Smashing Magazine, May 20, 2021, for the most-accessible intro I know about getting information from a REST API.)</p>
<p>For example, to find out some basic information about Hikaru, specifically his “user profile,” put the following URL in your browser’s address bar:</p>
<pre><code>https://api.chess.com/pub/player/hikaru
</code></pre>
<p>Your browser will return with:</p>
<pre><code>    
avatar  &quot;https://images.chesscomf…0x200o.f323efa57fd0.jpeg&quot;
player_id   15448422
@id &quot;https://api.chess.com/pub/player/hikaru&quot;
url &quot;https://www.chess.com/member/Hikaru&quot;
name    &quot;Hikaru Nakamura&quot;
username    &quot;hikaru&quot;
title   &quot;GM&quot;
followers   983906
country &quot;https://api.chess.com/pub/country/US&quot;
location    &quot;Sunrise, Florida&quot;
last_online 1662743764
joined  1389043258
status  &quot;premium&quot;
is_streamer true
twitch_url  &quot;https://twitch.tv/gmhikaru&quot;
verified    true
</code></pre>
<p>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:</p>
<pre><code>https://api.chess.com/pub/player/hikaru/stats
</code></pre>
<p>This produces a long-ish regurgitation of statistics, for example, that Hikaru’s last bullet rating was 3352:</p>
<pre><code>. . . 

chess_bullet    
last    
rating  3352
date    1661276020
rd  41
best    
rating  3570
date    1605136047
game    &quot;https://www.chess.com/game/live/5710095242&quot;
record  
win 10136
loss    1376

. . .

</code></pre>
<p>Most directly on point to your question, you can get the PGN for all games a given player (i.e., <em>you</em>) played in a month. For Hikaru, for April 2022, the URL would be:</p>
<pre><code>https://api.chess.com/pub/player/hikaru/games/2022/04/pgn
</code></pre>
<p>and your browser will download a multi-game PGN file.</p>
<p>AFAICT, you can download a player’s game for a particular month, but not for any broader period.</p>
<p>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.</p>
 28052: <ol>
<li><p><a href="https://www.openingtree.com/" rel="nofollow noreferrer">OpeningTree.com</a> allows you to export all games played as White or Black by username.</p>
</li>
<li><p><a href="https://github.com/sarartur/chess.com" rel="nofollow noreferrer">Python wrapper for chess.com API</a> by  Artur Saradzhyan (I have not tested this.)</p>
</li>
<li><p>Manually export games from the chess.com game list, 50 at a time by date range (may require trivial deduplication). Supports chess clock info.</p>
</li>
</ol>
