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

Possible to play local file through API?

Solved!

Possible to play local file through API?

Plan: Premium

Country: DK

Device: Spotify on Linux Ubuntu (PC)

 

My Question or Issue

Hi, I'm playing songs using the Web API like this without issues:

 

PUT /v1/me/player/play HTTP/1.1
Content-Type: application/json
Authorization: xxxxx
Host: api.spotify.com
Content-Length: 116
 
{"context_uri": "spotify:album:5ht7ItJgpBH7W6vJ5BqpPr""offset": {"position": 5},"position_ms": 0}
 

Is it possible to play a local file (added to a playlist) through the same Web API call by using a different URI e.g. something like:

"spotify:local:Grandmaster+Flash::The+Message:392"

 

I got that URI format from checking the playlist where the local song was added.

 

I'm getting http code 400 and the following error message when trying this:

"Invalid track uri: spotify:local:Grandmaster+Flash::The+Message:392"

 

Regards,

Flemming

Reply

Accepted Solutions
Marked as solution

You make the exact same request as is shown at the beginning of your first post, except you replace the album URI with a playlist URI.

View solution in original post

4 Replies
You cannot play local files using the web API unless they are already in a playlist and you reference them by their index in the playlist.

Thanks, that sounds interesting.

Which API call or URI would I use to play a local file by its index?

 

Marked as solution

You make the exact same request as is shown at the beginning of your first post, except you replace the album URI with a playlist URI.

thanks, it worked using e.g. :

 

PUT /v1/me/player/play HTTP/1.1
Content-Type: application/json
Authorization: xxxxx
Host: api.spotify.com
Content-Length: nnn
 
{"context_uri": "spotify:playlist:5ht7ItJgpBH7W6vJ5BqpPr""offset": {"position": 5},"position_ms": 0}

Suggested posts

Staff
Let's introduce ourselves!

Hey there you,   Yeah, you! 😁   Welcome - we're glad you joined the Spotify Community!   While you here, let's have a fun game and get…

Staff
ModeratorStaff / Moderator/ 3 years ago  in Social & Random

Type a product name