Announcements

Help Wizard

Step 1

NEXT STEP

Create Spotify Playlist not allowed Spotify Web Api

Create Spotify Playlist not allowed Spotify Web Api

Plan

Premium

 

Country

USA

 

Operating System

Mac OS Catalina

 

I have a question related to the Spotify Web API. I am working on a small script in Python to create a playlist of random tracks. I have gone through the Authentication flow and used the refresh token to get an access token. This access token has been double checked with proper scopes to create a playlist (playlist-modify-public and private). I have tried to use the same inputs (user_id and auth token) on the web console and it is able to create a playlist. However, when I try through my script, I am returned this 403 error: {'error': {'status': 403, 'message': 'You cannot create a playlist for another user.'}}. The Web API endpoint: https://developer.spotify.com/console/post-playlists/

 

To recap, I have double checked my scopes and tried it on the web console. It is not working when I make the POST request. Are there any suggestions on what I could try next or is this an issue being seen by others?

 

Thanks!

Reply
2 Replies

Hey @tyleryun1, thanks for reaching out here!

That's odd. You should be able to create playlists for the authenticated user. Let's see, could you make sure the 'user-id' parameter is exactly the same as the 'id' you get from the Get Current User's Profile-endpoint? That might work here. Let me know how you get on!

 

Have a good one,

Hubo

HuboSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Hi Hubo,
I have identified the problem and found that it was more of a Python syntax error. For future reference and others that might have similar issues:
url = 'https://api.spotify.com/v1/users/{spotify_user_id}/playlists' -> This is wrong Python syntax
url = f'https://api.spotify.com/v1/users/{spotify_user_id}/playlists' -> Need to add the f in order to properly get the user id

Suggested posts