Endpoints

POST 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. 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-Type Required 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 Parameters

Query Parameter Value Type Value
uris list of Spotify URIs Optional. 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. Note: it is likely that passing a large number of track URIs as a query parameter will exceed the maximum length of the request URI. When adding a large number of tracks it is recommended to pass them in the request body, see below.
position integer Optional. 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:

Body Parameters

Request Body Data Value Type Value
uris array of Spotify URI strings Optional. 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.
position integer Optional. 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 appear in the uris array. For example: {"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh","spotify:track:1301WleyT98MSxVHPZCA6M"], "position": 3}

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, or when there are more than 10.000 tracks in the playlist, returns error 403 Forbidden.

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

Try it

NOTE: looking for POST https://api.spotify.com/v1/users/{user_id}/playlists/{playlist_id}/tracks? Read the blog post.