Add one or more tracks to a user’s playlist.

Endpoints

POST https://api.spotify.com/v1/users/{user_id}/playlists/{playlist_id}/tracks

Request Parameters

Path parameter
Value
user_id
The user's Spotify user ID.
playlist_id
The Spotify ID for the playlist.

Header field
Value
AuthorizationRequired. A valid access token from the Spotify Accounts service: see the Web API Authorization Guide for details. The access token must have been issued on behalf of the user.

Adding tracks to the current user's public playlists requires authorization of the playlist-modify-public scope; adding tracks to the current user's private playlist (including collaborative playlists) requires the playlist-modify-private scope. See Using Scopes.
Content-TypeRequired if URIs are passed in the request body, otherwise ignored. The content type of the request body: application/json

The Spotify URIs of the tracks to add can be passed either in the query string or as a JSON array in the request body.

Passing them in the query string:

Query parameterValue typeValue
urislist of Spotify URIsOptional. A comma-separated list of Spotify track URIs to add. For example:
uris=spotify:track:4iV5W9uYEdYUVa79Axb7Rh,
spotify:track:1301WleyT98MSxVHPZCA6M


A maximum of 100 tracks can be added in one request.
positionintegerOptional. The position to insert the tracks, a zero-based index. For example, to insert the tracks in the first position: position=0; to insert the tracks in the third position: position=2. If omitted, the tracks will be appended to the playlist. Tracks are added in the order they are listed in the query string or request body.

Passing them in the request body:

Request body dataValue typeValue
urisarray of Spotify URI stringsOptional. A JSON array of the Spotify track URIs to add. For example:
{"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh",
"spotify:track:1301WleyT98MSxVHPZCA6M"]}


A maximum of 100 tracks can be added in one request. Note: if the uris parameter is present in the query string, any URIs listed here in the body will be ignored.

Response Format

On success, the HTTP status code in the response header is 201 Created. The response body contains a snapshot_id in JSON format. The snapshot_id can be used to identify your playlist version in future requests. On error, the header status code is an error code and the response body contains an error object. Trying to add a track when you do not have the user’s authorization returns error 403 Forbidden.

curl -i -X POST "https://api.spotify.com/v1/users/wizzler/playlists/7oi0w0SLbJ4YyjrOxhZbUv/tracks?uris=spotify%3Atrack%3A4iV5W9uYEdYUVa79Axb7Rh,spotify%3Atrack%3A1301WleyT98MSxVHPZCA6M" -H "Authorization: Bearer {your access token}" -H "Accept: application/json"
HTTP/1.1 201 Created
{ "snapshot_id" : "JbtmHBDBAYu3/bt8BOXKjzKx3i0b6LCa/wVjyl6qQ2Yf6nFXkbmzuEa+ZI/U1yF+" }

Try it in our Web API Console