Help Wizard

Step 1


Updating playlist cover image with base64 data

Updating playlist cover image with base64 data




(iPhone 12)

Operating System

(iOS 15)


My Question or Issue

Hi. I'm using iOS Shortcuts app as a low code environment for some simple Spotify API activities. Authentication is working and I'm able to GET and POST with other Spotify APIs (e.g. update playlist tracks, update playlist description). As other forum posts have observed, there's not a lot of detail on how to actually use the Add Custom Playlist Cover Image API. I've authenticated the app with ugc-image-upload, playlist-modify-public, playlist-modify-private scope.


I'm making a PUT call to{my playlist ID}/images with headers Accept: application/json, Content-Type: image/jpeg (I've also tried application/json), and Authorization: Bearer {token}


I've encoded my image filed with base64 and confirmed there's no preface text with image/jpeg. My question is how to actually post the encoded image data? I don't think it's part of the URL call ( ... /images/image=), but rather in the request body. But using a tag of some kind, as a file, etc? All of my various attempts are generating a 400 error: "Bad request"




Can anyone shed more light on this? Any verified examples to point to that would show URL, header and body elements? Thanks!

4 Replies

did you ever figure this out by any chance? Trying to do something similar and running into the same issue.

5 minutes ago I would have said, still no luck, but I changed one parameter and actually had success for the first time. The trick seems to have been in the encoding -- looks like there may have been line breaks (every 64 characters) that was messing this up. Switching to no line breaks and sending the encoded image as a file is working for me now.

Think you could provide an example of this? Thanks!!

I’m not sure how much iOS Shortcuts pseudo code will help here. Here’s a sample shortcut that gets a random Bob’s Burgers image and encodes to base64.

Once I have the encoded image, I pass that to the Spotify endpoint using PUT, content type image/jpeg, and the encoded image in the body request. Hope that helps a little. 



Suggested posts