Skip to content
DocumentationAPI Reference

Toggle Playback Shuffle

client.Me.Player.ToggleShuffle(ctx, body) error
PUT/me/player/shuffle

Toggle shuffle on or off for user’s playback. This API only works for users who have Spotify Premium. The order of execution is not guaranteed when you use this API with other Player API endpoints.

ParametersExpand Collapse
body MePlayerToggleShuffleParams
State param.Field[bool]

true : Shuffle user's playback.
false : Do not shuffle user's playback.

DeviceID param.Field[string]optional

The id of the device this command is targeting. If not supplied, the user's currently active device is the target.

Toggle Playback Shuffle

package main

import (
  "context"

  "github.com/cjavdev/spotted-go"
  "github.com/cjavdev/spotted-go/option"
)

func main() {
  client := spotted.NewClient(
    option.WithAccessToken("My Access Token"),
  )
  err := client.Me.Player.ToggleShuffle(context.TODO(), spotted.MePlayerToggleShuffleParams{
    State: true,
  })
  if err != nil {
    panic(err.Error())
  }
}
Returns Examples