Help Wizard

Step 1



Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...


Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...


Give us an endpoint to decode new shortened share links

Give us an endpoint to decode new shortened share links

On mobile share-links are now shortened.

For example:

As a developer who relied on the URL containing the trackID this makes it impossible for me to find which track is being passed on. The website redirects to the correct song but it's not using 301 or 302 redirects which means that it probably is a client side JS redirect. 

Giving us an endpoint to paste the short url and retrieve the long url would be nice.


Redirect Chain

To further clearify that the short links are not a good idea is that embeds in popular chat programs like Discord won't work anymore. Even Spotify's own oEmbed endpoint does not work with this kind of URL:



"error": {
    "code": 404,
    "message": "Invalid URI: error in parsing"



9 Replies

I just ran into this issue myself, you don't actually need a dedicated endpoint for it because it's just a redirect. Just send a HEAD request to the URL and follow the redirects. Here's how you can unfurl it in Python.

import requests
r = requests.head("< url>", allow_redirects=True)

  And similarly in cURL.

curl -vILsw %{url_effective}

Even though it gives the response code for forbidden it returns the full URL. This is, albeit not ideal, the solution.



This is still impossible in some popular programming languages, Dart for example. Without the 3xx redirect code Dart cannot properly expand the URL all the way. A Spotify endpoint that gives you the full URL would be very helpful. 

The "allow_redirects" param is not helpful as I'm redirected to this page: which is not the playlist linked by the Spotify link:

This is because Spotify does the redirect through js - specifically

Ok; so how can I handle that correctly using CURL in PHP to have the correct destination URL?

EDIT: good by parsing the HTML. Still need a proper API endpoint for that.

You can use the cURL command or python snippet to get the final destination. Here is a Replit using the python snippet:

This is still broken in 2024 

Set your user agent to curl! Example in Dart:

Future<String> getShortLinkID(String url) async {
Dio dio = Dio();
dio.options.followRedirects = true;
dio.options.maxRedirects = 10;
Response<void> response = await dio.head(url,
options: Options(headers: {"User-Agent": "curl/7.79.1"}));
if (response.statusCode == 200) {
return response.realUri.toString();
} else {
throw Exception();
It will give you the real URL. 

Suggested posts