I’ve been checking out the Spotify API documentation and I can see there’s a way to check if someone is following a playlist. But what I really need is to let users actually follow or unfollow playlists from within my application.
I’m working with JavaScript and wondering if there’s any method available to handle playlist following actions. Can users actually subscribe and unsubscribe from playlists through the JS API, or is this functionality not available? I need to implement both follow and unfollow features for my project.
Has anyone managed to get this working before? Any guidance would be helpful.
yeah, this got me too at first. you need the right headers: Authorization: Bearer {token} and Content-Type: application/json. even with an empty PUT body, Spotify still wants that content-type header or you’ll get a 400 error. if it’s still failing, check the playlist visibility settings.
The endpoint is /v1/playlists/{playlist_id}/followers for both operations. Use PUT with an empty body to follow, DELETE to unfollow. Here’s what caught me off guard - the playlist owner has to set it to public or collaborative first, otherwise following won’t work. You also can’t follow your own playlists through the API (makes sense but the docs don’t mention it). You’ll get a 200 response for success, so handle that in your app flow.
had the same issue! you need playlist-modify-public and playlist-modify-private scopes in the Spotify API. use PUT to follow playlists and DELETE to unfollow. worked perfectly once I got the auth sorted out!
Just a heads up - you need OAuth 2.0 authentication before the follow/unfollow stuff works. I screwed this up at first by calling endpoints without the right token scope. Your access token needs those playlist scopes Luke talked about. The API also throttles requests, so bulk operations or frequent follow/unfollow actions will get rate limited. I always wrap these calls in try-catch blocks since the API throws different error codes based on playlist permissions and user auth status.