Get a Playlist's Tracks
Get full details of the tracks of a playlist owned by a Spotify user.
Endpoint
GET https://api.spotify.com/v1/playlists/{playlist_id}/tracks
Request Parameters
Path Parameters
| Path Parameter | Value |
|---|---|
| playlist_id | The Spotify ID for the playlist. |
Header Fields
| Header Field | Value |
|---|---|
| Authorization | Required. A valid access token from the Spotify Accounts service: see the Web API Authorization Guide for details. Both Public and Private playlists belonging to any user are retrievable on provision of a valid access token. |
Query Parameters
| Query Parameter | Value |
|---|---|
| fields | Optional. Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are returned. For example, to get just the total number of tracks and the request limit:fields=total,limitA dot separator can be used to specify non-reoccurring fields, while parentheses can be used to specify reoccurring fields within objects. For example, to get just the added date and user ID of the adder: fields=items(added_at,added_by.id)Use multiple parentheses to drill down into nested objects, for example: fields=items(track(name,href,album(name,href)))Fields can be excluded by prefixing them with an exclamation mark, for example: fields=items.track.album(!external_urls,images) |
| limit | Optional. The maximum number of tracks to return. Default: 100. Minimum: 1. Maximum: 100. |
| offset | Optional. The index of the first track to return. Default: 0 (the first object). |
| market | Optional. An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking. |
Response Format
On success, the response body contains an array of playlist track objects (wrapped in a paging object) in JSON format and the HTTP status code in the response header is 200 OK. On error, the header status code is an error code and the response body contains an error object. Requesting playlists that you do not have the user’s authorization to access returns error 403 Forbidden.
Example (get the tracks of a user’s playlist)
curl -X GET "https://api.spotify.com/v1/playlists/21THa8j9TaSGuXYNBU5tsC/tracks" -H "Authorization: Bearer {your access token}"
{
"href" : "https://api.spotify.com/v1/users/spotify_espa%C3%B1a/playlists/21THa8j9TaSGuXYNBU5tsC/tracks",
"items" : [ {
"added_at" : "2016-10-11T13:44:40Z",
"added_by" : {
"external_urls" : {
"spotify" : "http://open.spotify.com/user/spotify_espa%C3%B1a"
},
"href" : "https://api.spotify.com/v1/users/spotify_espa%C3%B1a",
"id" : "spotify_españa",
"type" : "user",
"uri" : "spotify:user:spotify_espa%C3%B1a"
},
"is_local" : false,
"track" : {
"album" : {
"album_type" : "single",
"artists" : [ {
"external_urls" : {
"spotify" : "https://open.spotify.com/artist/21451j1KhjAiaYKflxBjr1"
},
"href" : "https://api.spotify.com/v1/artists/21451j1KhjAiaYKflxBjr1",
"id" : "21451j1KhjAiaYKflxBjr1",
"name" : "Zion & Lennox",
"type" : "artist",
"uri" : "spotify:artist:21451j1KhjAiaYKflxBjr1"
} ],
"available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "ID", "IE", "IS", "IT", "JP", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "SE", "SG", "SK", "SV", "TR", "TW", "UY" ],
"external_urls" : {
"spotify" : "https://open.spotify.com/album/5GjKG3Y8OvSVJO55dQTFyD"
},
"href" : "https://api.spotify.com/v1/albums/5GjKG3Y8OvSVJO55dQTFyD",
"id" : "5GjKG3Y8OvSVJO55dQTFyD",
"images" : [ {
"height" : 640,
"url" : "https://i.scdn.co/image/b16064142fcd2bd318b08aab0b93b46e87b1ebf5",
"width" : 640
}, {
"height" : 300,
"url" : "https://i.scdn.co/image/9f05124de35d807b78563ea2ca69550325081747",
"width" : 300
}, {
"height" : 64,
"url" : "https://i.scdn.co/image/863c805b580a29c184fc447327e28af5dac9490b",
"width" : 64
} ],
"name" : "Otra Vez (feat. J Balvin)",
"type" : "album",
"uri" : "spotify:album:5GjKG3Y8OvSVJO55dQTFyD"
},
"artists" : [ {
"external_urls" : {
"spotify" : "https://open.spotify.com/artist/21451j1KhjAiaYKflxBjr1"
},
"href" : "https://api.spotify.com/v1/artists/21451j1KhjAiaYKflxBjr1",
"id" : "21451j1KhjAiaYKflxBjr1",
"name" : "Zion & Lennox",
"type" : "artist",
"uri" : "spotify:artist:21451j1KhjAiaYKflxBjr1"
}, {
"external_urls" : {
"spotify" : "https://open.spotify.com/artist/1vyhD5VmyZ7KMfW5gqLgo5"
},
"href" : "https://api.spotify.com/v1/artists/1vyhD5VmyZ7KMfW5gqLgo5",
"id" : "1vyhD5VmyZ7KMfW5gqLgo5",
"name" : "J Balvin",
"type" : "artist",
"uri" : "spotify:artist:1vyhD5VmyZ7KMfW5gqLgo5"
} ],
"available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "ID", "IE", "IS", "IT", "JP", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "SE", "SG", "SK", "SV", "TR", "TW", "UY" ],
"disc_number" : 1,
"duration_ms" : 209453,
"explicit" : false,
"external_ids" : {
"isrc" : "USWL11600423"
},
"external_urls" : {
"spotify" : "https://open.spotify.com/track/7pk3EpFtmsOdj8iUhjmeCM"
},
"href" : "https://api.spotify.com/v1/tracks/7pk3EpFtmsOdj8iUhjmeCM",
"id" : "7pk3EpFtmsOdj8iUhjmeCM",
"name" : "Otra Vez (feat. J Balvin)",
"popularity" : 85,
"preview_url" : "https://p.scdn.co/mp3-preview/79c8c9edc4f1ced9dbc368f24374421ed0a33005",
"track_number" : 1,
"type" : "track",
"uri" : "spotify:track:7pk3EpFtmsOdj8iUhjmeCM"
}
}, {
"added_at" : "2016-10-11T13:44:40Z",
"added_by" : {
"external_urls" : {
"spotify" : "http://open.spotify.com/user/spotify_espa%C3%B1a"
},
"href" : "https://api.spotify.com/v1/users/spotify_espa%C3%B1a",
"id" : "spotify_españa",
"type" : "user",
"uri" : "spotify:user:spotify_espa%C3%B1a"
},
"is_local" : false,
...
} ],
"limit" : 100,
"next" : null,
"offset" : 0,
"previous" : null,
"total" : 58
}
playlist track object
| Key | Value Type | Value Description |
|---|---|---|
| added_at | a timestamp | The date and time the track was added. Note that some very old playlists may return null in this field. |
| added_by | a user object | The Spotify user who added the track. Note that some very old playlists may return null in this field. |
| is_local | a Boolean | Whether this track is a local file or not. |
| track | a track object | Information about the track. |
track object (full)
| Key | Value Type | Value Description |
|---|---|---|
| album | a simplified album object | The album on which the track appears. The album object includes a link in href to full information about the album. |
| artists | an array of simplified artist objects | The artists who performed the track. Each artist object includes a link in href to more detailed information about the artist. |
| available_markets | array of strings | A list of the countries in which the track can be played, identified by their ISO 3166-1 alpha-2 code. |
| disc_number | integer | The disc number (usually 1 unless the album consists of more than one disc). |
| duration_ms | integer | The track length in milliseconds. |
| explicit | Boolean | Whether or not the track has explicit lyrics ( true = yes it does; false = no it does not OR unknown). |
| external_ids | an external ID object | Known external IDs for the track. |
| external_urls | an external URL object | Known external URLs for this track. |
| href | string | A link to the Web API endpoint providing full details of the track. |
| id | string | The Spotify ID for the track. |
| is_playable | boolean | Part of the response when Track Relinking is applied. If true , the track is playable in the given market. Otherwise false. |
| linked_from | a linked track object | Part of the response when Track Relinking is applied, and the requested track has been replaced with different track. The track in the linked_from object contains information about the originally requested track. |
| restrictions | a restrictions object | Part of the response when Track Relinking is applied, the original track is not available in the given market, and Spotify did not have any tracks to relink it with. The track response will still contain metadata for the original track, and a restrictions object containing the reason why the track is not available: "restrictions" : {"reason" : "market"} |
| name | string | The name of the track. |
| popularity | integer | The popularity of the track. The value will be between 0 and 100, with 100 being the most popular. The popularity of a track is a value between 0 and 100, with 100 being the most popular. The popularity is calculated by algorithm and is based, in the most part, on the total number of plays the track has had and how recent those plays are. Generally speaking, songs that are being played a lot now will have a higher popularity than songs that were played a lot in the past. Duplicate tracks (e.g. the same track from a single and an album) are rated independently. Artist and album popularity is derived mathematically from track popularity. Note that the popularity value may lag actual popularity by a few days: the value is not updated in real time. |
| preview_url | string | A link to a 30 second preview (MP3 format) of the track. Can be null |
| track_number | integer | The number of the track. If an album has several discs, the track number is the number on the specified disc. |
| type | string | The object type: “track”. |
| uri | string | The Spotify URI for the track. |
paging object
| Key | Value Type | Value Description |
|---|---|---|
| href | string | A link to the Web API endpoint returning the full result of the request. |
| items | an array of objects | The requested data. |
| limit | integer | The maximum number of items in the response (as set in the query or by default). |
| next | string | URL to the next page of items. ( null if none) |
| offset | integer | The offset of the items returned (as set in the query or by default). |
| previous | string | URL to the previous page of items. ( null if none) |
| total | integer | The total number of items available to return. |
NOTE: looking for GET https://api.spotify.com/v1/users/{user_id}/playlists/{playlist_id}/tracks? Read the blog post.