Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Trouble with Create Playlist

Solved!

Trouble with Create Playlist

Plan

Premium

Country

US
Device

Node
Operating System

Macos

My Question or Issue

Today I set off to build a Spotify app. Everything was going swimmingly till I hit the createPlaylist endpoint. 

I can log in and retrieve an access token, from there I am able to query for the user and get the user's id. I can list tracks in a playlist, but what I can't do is create a playlist. Any help would be awesome.

 

 

 

 

 

 

export const createPlaylist = async (accessToken, userId, playlistName) => {
  const url = `https://api.spotify.com/v1/users/${userId}/playlists`;
  console.log(url);
  const headers = { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json' };
  const data = { name: playlistName, public: "false" };
  try {
    const response = await axios.post(url, data, { headers });
    return response.data;  // Assuming it returns the created playlist details
  } catch (error) {
    console.error('\n\nError creating playlist:\n', error);
    return null;
  }
};

 

 

 

 

 

 

 
Reply

Accepted Solutions
Marked as solution

Do you have used the right scopes? You can find them at the top of each endpoint reference page.

XimzendSpotify 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.

View solution in original post

3 Replies
Marked as solution

Do you have used the right scopes? You can find them at the top of each endpoint reference page.

XimzendSpotify 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.

Playlist creation worked fine for me until today.

Now, I have a 502 error.

I have it even when trying to create a playlist from here https://developer.spotify.com/documentation/web-api/reference/create-playlist

Yes I got an error but it works perfectly fine at the developers page.

"error": {"status": 403, "message": "Insufficient client scope"

Suggested posts