Spotify Liked Songs out of order: the steps to fix it
All your liked songs stamped with the same date and the order is gone? The songs are intact — only the order was lost, and it can be rebuilt. I build custom tools, and I have just done it on a library of 582 songs. Here are the four steps, in order.
1. Stop touching the library
Do not re-like anything, do not remove anything. Every action layers noise on top of the traces you will need.
2. Ask Spotify support for your list
Write to support and ask for the list of your liked songs, giving the approximate date and time of the incident. The file arrives by email — nothing to dig out of the settings. This is the step people skip, and it is the one that unlocks everything: support can reach data the app never shows you. That file is what everything else rests on.
3. Work out each like date
The file you receive tells you when you played a song, never when you liked it. You have to infer it.
- Do not use the first play: people keep a song for months before hitting the heart. I found gaps of up to two years.
- Use the moment the song settles in: drop the plays that lasted a few seconds, and among the rest, take a point around the first third.
- Check it against songs whose real date you know. On mine: 78% of pairs correctly ordered using the first play, 87% with this method.
You should end up with one thing only: your songs listed from oldest to newest.
4. Write the order back
The idea: remove each song and add it back straight away, from oldest to newest. Every date becomes today’s, but the displayed order is exact again — that is what the video shows. One song at a time, so the library is never empty.
- Open open.spotify.com in Chrome, signed in to your account.
- Open the browser console (Option + Command + I on Mac, F12 on Windows), Console tab.
- Type allow pasting and press Enter — Chrome requires it before a paste.
- Paste the script below once you have put your songs in it, then press Enter. Click around Spotify for three seconds when it asks.
- Try five songs first. Check the result, then run it again with the full list: the script picks up where it stopped.
(async () => {
// 1. Paste your songs here, from OLDEST to NEWEST
const ORDER = [
'spotify:track:xxxxxxxxxxxxxxxxxxxxxx',
'spotify:track:yyyyyyyyyyyyyyyyyyyyyy',
];
const ADD = '1ad0d40b3c09660d818b9e770eb1e84745dfbe941df159a64f8772b6fa2bfc3a';
const DEL = '05b739a3a73091c213385233b9d3ed8a857c2ca29d2eebadb3d04ed12e288697';
// grabs your session credentials: click around Spotify when asked
const h = {}, of = window.fetch;
window.fetch = function (i, o) {
try {
const x = new Headers((o && o.headers) || (i && i.headers) || {});
if (x.get('authorization')) h.a = x.get('authorization');
if (x.get('client-token')) h.c = x.get('client-token');
} catch (e) {}
return of.apply(this, arguments);
};
console.log('Click around Spotify (sidebar, a playlist) for 3 seconds...');
const t0 = Date.now();
while ((!h.a || !h.c) && Date.now() - t0 < 90000) await new Promise(r => setTimeout(r, 250));
window.fetch = of;
if (!h.a || !h.c) return console.error('Session not captured: run it again and click around Spotify.');
const call = (operationName, variables, sha256Hash) =>
of('https://api-partner.spotify.com/pathfinder/v2/query', {
method: 'POST',
credentials: 'include',
headers: { authorization: h.a, 'client-token': h.c, 'content-type': 'application/json' },
body: JSON.stringify({ variables, operationName, extensions: { persistedQuery: { version: 1, sha256Hash } } }),
}).then(r => { if (!r.ok) throw new Error(operationName + ' -> ' + r.status); });
const start = Number(localStorage.getItem('reorder') || 0);
for (let i = start; i < ORDER.length; i++) {
const u = ORDER[i];
await call('applyCurations', { input: { curations: [{ contextUri: 'spotify:collection:tracks', curationType: 'UNCURATE' }], itemUris: [u] } }, DEL);
await new Promise(r => setTimeout(r, 120));
await call('addToLibrary', { libraryItemUris: [u] }, ADD);
localStorage.setItem('reorder', String(i + 1));
if ((i + 1) % 10 === 0) console.log((i + 1) + '/' + ORDER.length);
await new Promise(r => setTimeout(r, 1100));
}
localStorage.removeItem('reorder');
console.log('Done.');
})();This script works today. Spotify changes its site regularly: if one day it stops on an error, paste it into a free AI along with the error message and ask it to bring the script up to date. It takes two minutes.
What not to do
- Accepting a reset offered by support: it also wipes the dates that survived.
- Waiting: every extra week of listening adds noise.
- Rebuilding the order from memory: past fifty songs it is wrong, and invisibly so.
- Paying for a service that promises to “restore” your liked songs: it copies the broken order.
Then back it up
Data that only exists on someone else’s service is not really yours. Export the list with its dates into a spreadsheet once a quarter: ten minutes, and next time it is a simple copy.
How I can help
I build websites and custom tools, and I regularly recover data stuck somewhere: an unreadable export, a customer list scattered across three tools, a history to piece back together. Concretely, I build:
- business websites and online shops;
- custom applications and tools, including for recovering or reordering data;
- redesigns of existing websites, without losing their place on Google;
- maintenance once the site is live.
Frequently asked questions
Can Spotify restore my dates itself?
Ask, but do not count on it. Support can sometimes roll a playlist back to an earlier state; for Liked Songs dates that is rare. Start the reconstruction in parallel rather than waiting for an answer.
How long does it take?
Waiting for the extended history is the long part: up to thirty days. After that, a few hours of work for several hundred songs.
Is the rebuilt order accurate?
About 87% of pairs come out correctly ordered. Two songs liked in the same week can be swapped; the year and the period are right.
What if my history does not go back far enough?
It covers the whole life of the account, but nothing before. Songs liked before your first recorded play leave no trace: put them at the top and reposition them by hand rather than inventing a date.
Do you take on this kind of project?
Yes. The first conversation is free and comes with no obligation: you tell me what was lost, I tell you what is recoverable, and you get a detailed quote within 24 hours.
I build websites, online shops and custom tools for businesses. Got a project in mind? Let’s talk it through — reply within 24 h, free quote, no commitment.
