add_to_playlist
Add tracks to an existing Spotify playlist. Automatically batches track URIs to comply with the Spotify API 100-track limit.
Instructions
Add one or more tracks to an existing Spotify playlist.
Handles batching automatically (Spotify API limit: 100 tracks per request).
Parameters
playlist_id : str Spotify playlist ID or full URI. track_uris : list[str] Spotify track URIs or bare track IDs.
Returns
dict
Keys: playlist_id (str), tracks_added (int).
Raises
ValueError
If track_uris is empty.
spotipy.SpotifyException
Propagated if the Spotify API returns a non-2xx response.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| track_uris | Yes | ||
| playlist_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||