Skip to content

Instantly share code, notes, and snippets.

@alyti
Last active April 15, 2025 17:37
Show Gist options
  • Save alyti/24459f6e2d5eba2cab10aca27d29470b to your computer and use it in GitHub Desktop.
Save alyti/24459f6e2d5eba2cab10aca27d29470b to your computer and use it in GitHub Desktop.
Download mods from ageofempires.com

AoE2 DE Mod downloader bookmarklet

TL;DR:

  1. Make a new bookmark
    • Copy the contents of the snippet below into location field for a new bookmark.
    • Call bookmark whatever you want, I went with AoE2 DE Mod DL.
  2. Make sure you are signed into the website (https://ageofempires.com/mods), if you aren't, the API will just reject your request.
    • It's completely free and doesn't care if you own the game on that account.
  3. Navigate to mod of your choice and click the bookmark.
  4. Wait for a bit, the API tends to be slow...
  5. You should get a download popup for mod's archive.
  6. Extract archive into something like C:\Users\YOUR USERNAME\Games\Age of Empires 2 DE\SOME NUMBERS\mods\local
    • For example I want x256 techs mod (mod id: 832), I would extract contents of the newly downloaded aoe_832.zip into folder C:\Users\alyti\Games\Age of Empires 2 DE\1212112121212121212\mods\local\aoe_832.
javascript:(function() {
let id = parseInt(location.pathname.match("([0-9]{1,5})")[0], 10); if (id === NaN) {return};
fetch("https://api.ageofempires.com/api/v1/mods/Download", {"credentials": "include", "headers": { "Content-Type": "application/json" }, "body": JSON.stringify({id, boolValue: true}), "method": "POST", "mode": "cors"}).then(r => r.json()).then(r => {location.href = r.value.downloadUrl}).catch(e => console.log(e));
})()
@alex-taxiera
Copy link

const fn = (id) => { fetch(" https://api.ageofempires.com/api/v1/mods/Download ", { "credentials": "include", "headers": { "Content-Type": "application/json" }, "body": JSON.stringify({ id: id, boolValue: true }), "method": "POST", "mode": "cors" }) .then(r => r.json()) .then(r => { location.href = r.value.downloadUrl; }) .catch(e => console.log(e)); };

I might be blind, but is this the same code? What's different?

Sorry I can't say for how to make local mods work for AOE4 since I don't have it. It may not be possible if you aren't finding any guides online.

@Based-Dog
Copy link

Based-Dog commented Jan 30, 2025

It's not super obvious for the less initiated, but you'll have to input const fn = (id) => fetch("https://api.ageofempires.com/api/v1/mods/Download", {"credentials": "include", "headers": { "Content-Type": "application/json" }, "body": JSON.stringify({id, boolValue: true}), "method": "POST", "mode": "cors"}).then(r => r.json()).then(r => {location.href = r.value.downloadUrl}).catch(e => console.log(e)); into one line in the console, then in the line below it add fn(12345) where 12345 is the ID of the mod you want below it, and THEN you run the command. You don't edit anything in the original line.

@copytac
Copy link

copytac commented Feb 21, 2025

Hi there, I'll attach a functioning code to download mods using console as I was also having issues with the one Alex shared. Please find it below.

However, could anyone PLEASE explain how to make it work for AOE4? I tried everything but the mods won't be detected unless I use the ingame mod manager which is a nogo for me. I want to be able to activate mods MANUALLY. What to do please? I put the downloaded .sga file in extension/local folder.

As for the code, here it is:

const fn = (id) => { fetch(" https://api.ageofempires.com/api/v1/mods/Download ", { "credentials": "include", "headers": { "Content-Type": "application/json" }, "body": JSON.stringify({ id: id, boolValue: true }), "method": "POST", "mode": "cors" }) .then(r => r.json()) .then(r => { location.href = r.value.downloadUrl; }) .catch(e => console.log(e)); };

// Call the function with the desired id fn(!!!Put ID here!!!);

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment