Skip to content

Instantly share code, notes, and snippets.

@azagniotov
Last active October 4, 2025 14:05
Show Gist options
  • Save azagniotov/210c31540712c10206484d5297616842 to your computer and use it in GitHub Desktop.
Save azagniotov/210c31540712c10206484d5297616842 to your computer and use it in GitHub Desktop.
Downloads all pay-slips from ADP website
/*
This has been tested in Chrome v55.0.2883.95 (64-bit)
1. Log into ADP website using the URL: https://my.adp.com/static/redbox/login.html (Make sure you are NOT in Incognito mode)
2. Open Developer Tools console
3. Run the following code in the console:
*/
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://my.adp.com/v1_0/O/A/payStatements?adjustments=yes&numberoflastpaydates=300');
xhr.setRequestHeader("Access-Control-Allow-Origin", "*"); // CORS policy
xhr.onload = function() {
if (xhr.status === 200) {
var rawData = JSON.parse(xhr.responseText);
for (var index = rawData.payStatements.length - 1; index >= 0; --index) {
var entry = rawData.payStatements[index];
var url = "https://my.adp.com" + entry.statementImageUri.href.substring(3);
var a = document.createElement('a');
var trueIndex = (rawData.payStatements.length - index);
if (trueIndex < 10) {
trueIndex = "00" + trueIndex;
} else if (trueIndex < 100) {
trueIndex = "0" + trueIndex;
}
a.download = "payslip.no." + trueIndex + ".from." + entry.payDate + ".pdf";
a.href = url;
document.body.appendChild(a);
a.click();
delete a;
}
} else {
console.log('Request failed. Returned status of ' + xhr.status);
}
};
xhr.send();
@hakimh02
Copy link

This is great. Thank you to all who have developed this code. I used the version by @corymayer using Firefox 133.0 on Windows 11 without any modifications except for inserting the OID.

Hey there, can you please explain how you got the OID? Tried looking for it in responses but wasn't able to do so...would appreciate if you can run me through how you achieved that. Thank you

@cwlls
Copy link

cwlls commented Sep 18, 2025

Login to ADP, as usual, and then go to the following URL in the same browser session: https://my.adp.com/myadp_prefix/myadpapi/core/v1/version

In the resulting JSON output look for the value labeled: 'associateoid'. Paste it into the code seen above and run it in the javascript console of your browser. I can confirm this works as of today, using Safari Version 18.6 (20621.3.11.11.3)

@hakimh02
Copy link

maybe I'm missing something, but I can't get the JSON file to show up using the above URL.
When I login and then try to use the above URL, the page reloads and shows that's I'm not logged in.
Btw, this is the URL my company is using "https://adpworld.adp.com/

@hakimh02
Copy link

@cwlls would appreciate any help here. Thank you

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