Skip to content
DocumentationAPI Reference

Toggle Playback Shuffle

me().player().toggleShuffle(PlayerToggleShuffleParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
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
PlayerToggleShuffleParams params
boolean state

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

Optional<String> deviceId

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 dev.cjav.spotted.example;

import dev.cjav.spotted.client.SpottedClient;
import dev.cjav.spotted.client.okhttp.SpottedOkHttpClient;
import dev.cjav.spotted.models.me.player.PlayerToggleShuffleParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        SpottedClient client = SpottedOkHttpClient.fromEnv();

        PlayerToggleShuffleParams params = PlayerToggleShuffleParams.builder()
            .state(true)
            .build();
        client.me().player().toggleShuffle(params);
    }
}
Returns Examples