Help Wizard

Step 1


I cant get the preview Url for the songs of album, Is there way to get this?

I cant get the preview Url for the songs of album, Is there way to get this?

I am trying to get the preview url for the songs of album, there is preview url parameter in response data from{id}/tracks.

but actually i could not get that, Please help me!!!.






(iPhone 8, Samsung Galaxy 9, Macbook Pro late 2016)

Operating System

(iOS 10, Android Oreo, Windows 10,etc.)


My Question or Issue


2 Replies

Pawsitively delighted to see you vectorspace!
The preview_url parameter in the response data from the Spotify API's GET /albums/{id}/tracks endpoint is a URL that allows you to preview a 30-second snippet of a track.

To access the preview_url parameter for a specific track in an album, you can make a GET request to the GET /albums/{id}/tracks endpoint, where {id} is the unique identifier for the album. You will receive a JSON response containing an array of track objects, each of which will include a preview_url parameter if it is available.

Here's an example of how you can use the Spotify API's GET /albums/{id}/tracks endpoint to get the preview_url parameter for the tracks of an album using the Python requests library:


import requests

# Set up the endpoint URL and parameters
url = "{id}/tracks"
headers = {
    "Authorization": "Bearer {your_access_token}",
    "Content-Type": "application/json"
params = {
    "market": "US"

# Make the request to the API
response = requests.get(url.format(id="{album_id}"), headers=headers, params=params)

# Check if the request was successful
if response.status_code == 200:
    # Get the JSON data from the response
    data = response.json()

    # Loop through the tracks in the album
    for track in data['items']:
        # Check if the track has a preview URL
        if 'preview_url' in track:
            # Print the preview URL for the track
            print(f"Preview URL for {track['name']}: {track['preview_url']}")
    print(f"Request failed with status code {response.status_code}")



Make sure to replace {your_access_token} with your actual Spotify access token and {album_id} with the unique identifier for the album you want to get the tracks for. Also note that the market parameter is optional, and you can remove it if you want to get results for all available markets.

Don't leave me in the doghouse, keep me informed!


-Prague the Dog

PragueSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

I think this is a known issue and also related to my Github issue I posted today;


Seems like the Client Credentials flow for backend applications tends to provide an preview_url with null value. No clue why Spotify does this. Searched everywhere like crazy, but can't find any working solution.. 

Suggested posts