Using API to play Spotify album?


I am new to Volumio, got it successfully running on a Raspberry Pi Zero (sloowww) with Spotify Premium.

I would like to play a full album from Spotify, initiated with a hardware interface using NFC cards.

Example, something like this with 23 tracks:

How can I do that via REST API or WebSocket? I checked the docs and tried some initial code, but its not working for me.


I might add that Spotify is behaving strangely on the Pi.

  1. Featured playlists aren’t playing at all
  2. Personal playlists are not shown
  3. It only plays songs and albums from “What’s new”

Using volumio latest.

No one using Spotify and the API (in this forum)?

Is there another better place to ask?


For the api part, it is tricky as Spotify is stand alone, and doesn’t use mpd like the rest of Volumio. You might need to dig a litter further into the uri structure that Volumio uses and check if you can coax it to play an album.

Thank you very much for the link! :sunglasses:

I did not realize that my Spotify login wasn’t actually working.

:exclamation: [b]It would be great to have

  1. latest Spotify plugin installable via GUI
  2. indicator if Spotify login was (not) successful[/b]

I worked my way through some Github source code and it seems the REST API can’t handle playing a URI … i/index.js

After diving into the WebSocket API I found “replaceAndPlay” in the source which is not listed in the documentation :cry: … t/index.js

I can now play a full Spotify album with a node script :smiley: Strangely I don’t get any messages back :blush:

var socket = require('')('http://volumio.local:3000');
socket.on('connect', function(){
    socket.emit('getDeviceInfo'); // test
    socket.emit('getState', ""); // test
    socket.emit('getQueue', {}); // test
    socket.emit('replaceAndPlay', {"name": "Spotify", "service": "spop", "uri": "spotify:album:7a5U0GPoAvT3gvEY66FRuN"});
socket.on('event', function(data){
socket.on('message', function(data){
socket.on('disconnect', function(){

I am also trying to play a spotifty album using the web API how exactly did you compile and run this command here?

is there a way to do it like this?

Hello, have you considered the rest api to manipulate spotify? You can just try this url volumio.local/api/v1/browse?uri= … /playlists, on my setup it works pretty well and you can go forward easily from there.

I struggled a bit with this too, and a quick solution is to add a spotify playlist to queue, and then save the queue to a volumio playlist, then one can trigger the playlist easily with the rest API.

Hope it helps


I was working on it for several hours with the REST API Volumio for playing a spotify track/album, here is how i make it works hoping to help you.

With Python i only use “requests” library to interact with REST API, and it works for me :

import requests“”, json={“name”: “Spotify”, “service”: “spop”, “uri”: “spotify:track:1ACqqQiBkxSOoEYUW57Itl”})

You can try the “addToQueue” command or use a Spotify album url, it should work.