u/OZX-OG

Downloading Epic Games Purchase History as a .txt File

so epic doesnt have a builtin way to export your library which is honestly annoying, but you can pull it from your purchase history pretty easily with a script.

first, head to https://store.epicgames.com/ and log in,

then just open dev tools (chrome: ctrl + shift + i), go to the console tab, paste the script below and run it.

when its done it dedupes everything, prints it in the console, and downloads a file called EpicGamesLibrary.txt with all your purchases sorted nicely.

(async () => {

  const BASE =
    "https://accounts.epicgames.com/account/v2/payment/ajaxGetOrderHistory?count=10&sortDir=DESC&sortBy=DATE&locale=en-US";

  async function getPage(token = "") {
    const url = token ? `${BASE}&nextPageToken=${token}` : BASE;

    const res = await fetch(url, {
      method: "GET",
      credentials: "include",
      headers: {
        "accept": "application/json",
        "x-requested-with": "XMLHttpRequest"
      },
      referrer: "https://www.epicgames.com/account/transactions"
    });

    return res.json();
  }

  async function getAllOrders() {
    let token = "";
    let allGames = [];
    let page = 1;

    while (true) {
      const data = await getPage(token);

      const games = data.orders.flatMap(order =>
        order.items.map(i => i.description)
      );

      console.log(
        `Page ${page} → Orders: ${data.orders.length} | Games: ${games.length} | NextToken: ${data.nextPageToken}`
      );

      allGames.push(...games);

      if (!data.nextPageToken) break;

      token = data.nextPageToken;
      page++;
    }

    return allGames;
  }

  const games = await getAllOrders();

  const uniqueGames = [...new Set(games)].sort();

  console.log("TOTAL UNIQUE ITEMS:", uniqueGames.length);
  console.log(uniqueGames);

  // download txt file
  const blob = new Blob([uniqueGames.join("\n")], { type: "text/plain" });
  const a = document.createElement("a");
  a.href = URL.createObjectURL(blob);
  a.download = "EpicGamesLibrary.txt";
  a.click();

})();
reddit.com
u/OZX-OG — 5 days ago