# Public Sonos Documentation Documentation > Documentation for Public Sonos Documentation ## Guides - [How Sonos Works](https://docs.sonos.com/docs/how-sonos-works.md) - [Getting started with Content Services](https://docs.sonos.com/docs/content-service-get-started.md) - [Components and interfaces](https://docs.sonos.com/docs/components-and-interfaces.md) - [Supported audio content](https://docs.sonos.com/docs/supported-audio-content.md) - [Key requirements](https://docs.sonos.com/docs/key-requirements.md) - [SOAP requests and responses](https://docs.sonos.com/docs/soap-requests-and-responses.md) - [Content on Sonos](https://docs.sonos.com/docs/content-on-sonos.md) - [Playback on Sonos](https://docs.sonos.com/docs/playback-on-sonos.md) - [Synchronize your service](https://docs.sonos.com/docs/synchronize-your-service.md) - [Security](https://docs.sonos.com/docs/security.md) - [Error handling](https://docs.sonos.com/docs/error-handling.md) - [Test your service](https://docs.sonos.com/docs/test-your-service.md) - [Use Self Test to Validate Your Service](https://docs.sonos.com/docs/use-self-test-to-validate-your-service.md) - [Submit your service](https://docs.sonos.com/docs/submit-your-service.md) - [Partner account types](https://docs.sonos.com/docs/partner-account-types.md) - [Adding Content Service features](https://docs.sonos.com/docs/content-service-add-features.md) - [Add actions](https://docs.sonos.com/docs/add-actions.md) - [Album & artist](https://docs.sonos.com/docs/album-artist.md) - [Related text](https://docs.sonos.com/docs/related-text.md) - [Related browse](https://docs.sonos.com/docs/related-browse.md) - [Related play](https://docs.sonos.com/docs/related-play.md) - [Webpage](https://docs.sonos.com/docs/web-page.md) - [REST request](https://docs.sonos.com/docs/rest-request.md) - [Add authentication](https://docs.sonos.com/docs/add-authentication.md) - [Add app authentication](https://docs.sonos.com/docs/add-app-authentication.md) - [Use authentication tokens](https://docs.sonos.com/docs/use-authentication-tokens.md) - [Add browser authentication](https://docs.sonos.com/docs/add-browser-authentication.md) - [Add create account ](https://docs.sonos.com/docs/add-create-account.md) - [Handle auth errors](https://docs.sonos.com/docs/handle-auth-errors.md) - [Upgrade to OAuth](https://docs.sonos.com/docs/upgrade-to-oauth.md) - [Add capabilities](https://docs.sonos.com/docs/add-capabilities.md) - [Add favorites](https://docs.sonos.com/docs/add-favorites.md) - [Add images](https://docs.sonos.com/docs/add-images.md) - [Add album art](https://docs.sonos.com/docs/add-album-art.md) - [Add logos](https://docs.sonos.com/docs/add-logos.md) - [Add browse icons](https://docs.sonos.com/docs/add-browse-icons.md) - [Add pagination](https://docs.sonos.com/docs/add-pagination.md) - [Add playlists](https://docs.sonos.com/docs/add-playlists.md) - [Add play/Shuffle all](https://docs.sonos.com/docs/add-play-shuffle-all.md) - [Add podcasts](https://docs.sonos.com/docs/add-podcasts.md) - [Add programmed radio](https://docs.sonos.com/docs/add-programmed-radio.md) - [Add ratings](https://docs.sonos.com/docs/add-ratings.md) - [Configure ratings](https://docs.sonos.com/docs/configure-ratings.md) - [Develop ratings](https://docs.sonos.com/docs/develop-ratings.md) - [Use rating icons](https://docs.sonos.com/docs/use-rating-icons.md) - [Add reporting](https://docs.sonos.com/docs/add-reporting.md) - [Add search](https://docs.sonos.com/docs/add-search.md) - [Encrypt content](https://docs.sonos.com/docs/encrypt-content.md) - [High-definition audio badging](https://docs.sonos.com/docs/high-definition-audio-badging.md) - [Play audio (Cloud queue)](https://docs.sonos.com/docs/cloud-queue-play-audio.md) - [Account matching](https://docs.sonos.com/docs/account-matching.md) - [Error handling (Cloud Queue)](https://docs.sonos.com/docs/cloud-queue-error-handling.md) - [Set playback policies](https://docs.sonos.com/docs/set-playback-policies.md) - [Playback policy list](https://docs.sonos.com/docs/playback-policy-list.md) - [Playback sessions](https://docs.sonos.com/docs/playback-sessions.md) - [Save & resume playback](https://docs.sonos.com/docs/save-resume-playback.md) - [Localization](https://docs.sonos.com/docs/localization.md) - [Supported audio formats](https://docs.sonos.com/docs/supported-audio-formats.md) - [Streaming basics](https://docs.sonos.com/docs/streaming-basics.md) - [HTTP Live Streaming (HLS)](https://docs.sonos.com/docs/http-live-streaming-hls.md) - [FLAC best practices](https://docs.sonos.com/docs/flac-best-practices.md) - [Tag & filter explicit content](https://docs.sonos.com/docs/tag-filter-explicit-content.md) - [Troubleshooting](https://docs.sonos.com/docs/troubleshooting.md) - [URL schemes](https://docs.sonos.com/docs/url-schemes.md) - [Connected Home](https://docs.sonos.com/docs/connected-home-get-started.md) - [Architecture](https://docs.sonos.com/docs/connected-home-architecture.md) - [Features](https://docs.sonos.com/docs/connected-home-features.md) - [Quotas and spike arrests](https://docs.sonos.com/docs/quotas-and-spike-arrests.md) - [Connected Home Security](https://docs.sonos.com/docs/connected-home-security.md) - [Control Sonos Players](https://docs.sonos.com/docs/control-sonos-players.md) - [Authorize](https://docs.sonos.com/docs/authorize.md) - [Discover](https://docs.sonos.com/docs/discover.md) - [Control](https://docs.sonos.com/docs/control.md) - [Subscribe](https://docs.sonos.com/docs/subscribe.md) - [Volume](https://docs.sonos.com/docs/volume.md) - [Sound Experience Guidelines](https://docs.sonos.com/docs/sound-experience-guidelines.md) - [Principles](https://docs.sonos.com/docs/seg-principles.md) - [Households](https://docs.sonos.com/docs/seg-households.md) - [Groups](https://docs.sonos.com/docs/seg-groups.md) - [Playback](https://docs.sonos.com/docs/seg-playback.md) - [Volume](https://docs.sonos.com/docs/seg-volume.md) - [Hardware](https://docs.sonos.com/docs/seg-hardware.md) - [Performance](https://docs.sonos.com/docs/seg-performance.md) - [Restrictions](https://docs.sonos.com/docs/seg-restrictions.md) - [Audio Feedback](https://docs.sonos.com/docs/seg-audio-feedback.md) - [Sonos Music API](https://docs.sonos.com/docs/smapi.md) - [addToContainer](https://docs.sonos.com/docs/addtocontainer.md) - [createContainer](https://docs.sonos.com/docs/createcontainer.md) - [createItem](https://docs.sonos.com/docs/createitem.md) - [deleteContainer](https://docs.sonos.com/docs/deletecontainer.md) - [deleteItem](https://docs.sonos.com/docs/deleteitem.md) - [getAppLink](https://docs.sonos.com/docs/getapplink.md) - [getContentKey](https://docs.sonos.com/docs/getcontentkey.md) - [getDeviceAuthToken](https://docs.sonos.com/docs/getdeviceauthtoken.md) - [getDeviceLinkCode](https://docs.sonos.com/docs/getdevicelinkcode.md) - [getExtendedMetadata](https://docs.sonos.com/docs/getextendedmetadata.md) - [getExtendedMetadataText](https://docs.sonos.com/docs/getextendedmetadatatext.md) - [getLastUpdate](https://docs.sonos.com/docs/getlastupdate.md) - [getMediaMetadata](https://docs.sonos.com/docs/getmediametadata.md) - [getMediaURI](https://docs.sonos.com/docs/getmediauri.md) - [getMetadata](https://docs.sonos.com/docs/getmetadata.md) - [getScrollIndices](https://docs.sonos.com/docs/getscrollindices.md) - [getSessionId](https://docs.sonos.com/docs/getsessionid.md) - [getUserInfo](https://docs.sonos.com/docs/getuserinfo.md) - [rateItem](https://docs.sonos.com/docs/rateitem.md) - [refreshAuthToken](https://docs.sonos.com/docs/refreshauthtoken.md) - [removeFromContainer](https://docs.sonos.com/docs/removefromcontainer.md) - [renameContainer](https://docs.sonos.com/docs/renamecontainer.md) - [reorderContainer](https://docs.sonos.com/docs/reordercontainer.md) - [reportAccountAction](https://docs.sonos.com/docs/reportaccountaction.md) - [reportPlaySeconds](https://docs.sonos.com/docs/reportplayseconds.md) - [reportPlayStatus](https://docs.sonos.com/docs/reportplaystatus.md) - [reportStatus](https://docs.sonos.com/docs/reportstatus.md) - [search](https://docs.sonos.com/docs/search.md) - [setPlayedSeconds](https://docs.sonos.com/docs/setplayedseconds.md) - [SMAPI object types](https://docs.sonos.com/docs/smapi-object-types.md) - [Sample apps](https://docs.sonos.com/docs/sample-apps.md) - [JavaScript Control API Sample App](https://docs.sonos.com/docs/javascript-sample-app.md) - [Types](https://docs.sonos.com/docs/types.md) - [globalError](https://docs.sonos.com/docs/global-error.md) - [playMode](https://docs.sonos.com/docs/play-mode.md) - [queueAction](https://docs.sonos.com/docs/queue-action.md) - [Playback objects](https://docs.sonos.com/docs/playback-objects.md) - [Support](https://docs.sonos.com/docs/support.md) - [Terms of Service](https://docs.sonos.com/docs/terms-of-service.md) - [Sonos Partners' 3P Guidelines & TOU](https://docs.sonos.com/docs/sonos-partners-3p-guidelines-tou.md) - [Media Kit](https://docs.sonos.com/docs/media-kit.md) ## API Reference - [getAuthCode](https://docs.sonos.com/reference/create-authorization-code.md): Use to send a user to the Sonos login service, for example, with a button instructing the user to enable your integration to use Sonos that sends the user to your redirect URI. - [createToken](https://docs.sonos.com/reference/createtoken.md): Generate a Bearer token using your client key and client secret for basic authentication. - [refreshToken](https://docs.sonos.com/reference/refreshtoken.md): Refresh your Bearer token. Each token has a 365-day lifespan. - [loadAudioClip](https://docs.sonos.com/reference/audioclip-loadaudioclip-playerid.md): Use the loadAudioClip command in the audioClip namespace to schedule an audio clip for playback. The command returns immediately, indicating whether the audio clip was successfully scheduled or not. The player can handle multiple audio clips and implements a simple priority system to determine playback order: A High priority audio clip can interrupt another high priority audio clip if the latter has played for more then 10 seconds. A high priority audio clip can interrupt a low priority audio clip at any time. A low priority audio clip can interrupt a low priority audio clip at any time. - [subscribe](https://docs.sonos.com/reference/audioclip-subscribe-playerid.md): Use this command to subscribe to events in the audioClip namespace. - [unsubscribe](https://docs.sonos.com/reference/audioclip-unsubscribe-playerid.md): Use this command to unsubscribe to events in the audioClip namespace. - [audioClip](https://docs.sonos.com/reference/audioclip-parameters.md) - [audioClipStatus](https://docs.sonos.com/reference/audioclipstatus.md) - [audioClipType](https://docs.sonos.com/reference/audiocliptype.md) - [loadFavorite](https://docs.sonos.com/reference/favorites-loadfavorite-groupid.md): The loadFavorite command in the favorites namespace activates a favorite within the default playback session. This command interrupts any active private playback sessions. Sonos adds album, tracklist, and track favorites to the queue and activates the queue. This prevents your app from overwriting user-curated queues. - [getFavorites](https://docs.sonos.com/reference/favorites-getfavorites-householdid.md): Use the getFavorites command in the favorites namespace to get the list of Sonos favorites for a household. Favorites do not include pinned items (any non-playable containers pinned to My Sonos) or Sonos playlists. See the Save your favorites section in the Sonos user guide and Add favorites for details. The player limits the number of Sonos favorites to 70. An array of objects is returned such that a developer can implement the favorites picker from the Sonos controller. - [subscribe](https://docs.sonos.com/reference/favorites-subscribe-householdid.md): Use this command to subscribe to events in the favorites namespace. When subscribed, Sonos sends asynchronous versionChanged events when users update their Sonos favorites. Your app can then choose to fetch the favorites as needed whenever the version changes. This is because the FavoritesList object can be large for asynchronous events. - [unsubscribe](https://docs.sonos.com/reference/favorites-unsubscribe-householdid.md): Use this command to unsubscribe to events in the favorites namespace. - [groups](https://docs.sonos.com/reference/groups.md) - [modifyGroupMembers](https://docs.sonos.com/reference/groups-modifygroupmembers-groupid.md): Use the modifyGroupMembers command in the groups namespace to add players to and remove players from a group. In response to this command, Sonos first adds players to the group, then removes players from the group. - [setGroupMembers](https://docs.sonos.com/reference/groups-setgroupmembers-groupid.md): Use the setGroupMembers command in the groups namespace to replace the players in an existing group with a new set. - [getGroups](https://docs.sonos.com/reference/groups-getgroups-householdid.md): Use the getGroups command in the groups namespace to get information about groups and players in a household. - [createGroup](https://docs.sonos.com/reference/groups-creategroup-householdid.md): Use the createGroup command in the groups namespace to create a new group from a list of players. The player returns a group object with the group ID. This may be an existing group ID if an existing group is a subset of the new group. In this case, Sonos may build the new group by adding new players to the existing group. - [subscribe](https://docs.sonos.com/reference/groups-subscribe-householdid.md): Use this command to subscribe to events in the groups namespace. - [unsubscribe](https://docs.sonos.com/reference/groups-unsubscribe-householdid.md): Use this command to unsubscribe to events in the groups namespace. - [groups objects](https://docs.sonos.com/reference/groups-objects.md) - [setVolume](https://docs.sonos.com/reference/groupvolume-setvolume-groupid.md): Use the setVolume command to set the group volume and the group's mute state. The group is automatically unmuted unless otherwise specified. When your app sets the group volume, the group coordinator calculates the required changes to the volume level for each player in the group so that the result is the average volume level of the group as a whole. The group coordinator then adjusts its local volume and initiates network transactions with the other players in the group to adjust their volumes accordingly. While players adjust their volumes, the group coordinator may generate one or more groupVolume events. Since this command can generate additional network transactions and events, your app should optimize how often it is invoked to maintain a good user experience without flooding the network, such as when implementing a touch screen volume slider that controls a group of five players. - [getVolume](https://docs.sonos.com/reference/groupvolume-getvolume-groupid.md): Use the getVolume command in the groupVolume namespace to get the volume and mute state of a group. - [setMute](https://docs.sonos.com/reference/groupvolume-setmute-groupid.md): Use the setMute command in the groupVolume namespace to mute and unmute the group. The group’s mute state is independent of its group volume. For example a group’s mute state can be true although its group volume is still 20, and the user will not hear any audio coming from the group of players. Individual player volume values are stored by each player in the group while muted, which allows the group to retain the relative volume of players in the group. That is important information to preserve, since users may have carefully configured the individual player volumes in the group with a Sonos controller. Your app should not mute the group by calling setVolume with zero volume, otherwise the relative volume of players in the group will be lost. If some players in the group are muted and others are not, calling setMute to mute the group will mute all the players in the group. The individual player’s mute state prior to calling setMute is not preserved. To get the current group’s mute state, use the getVolume command or subscribe to the groupVolume event. - [setRelativeVolume](https://docs.sonos.com/reference/groupvolume-setrelativevolume-groupid.md): Use the setRelativeVolume command to increase or decrease group volume and set the group's mute state. The group is automatically unmuted unless otherwise specified. Your app can use setRelativeVolume instead of setVolume when the user intent is to increase or decrease the group volume, but not to set the final volume to a particular value. For example, your app should use setRelativeVolume when the user presses hard volume plus/minus buttons on a mobile device. The group will automatically limit the final volume set within the valid range, so your app does not need to worry about that. See setVolume for more details on how group volume works. - [subscribe](https://docs.sonos.com/reference/groupvolume-subscribe-groupid.md): Use this command to subscribe to events in the groupVolume namespace. - [unsubscribe](https://docs.sonos.com/reference/groupvolume-unsubscribe-groupid.md): Use this command to unsubscribe to events in the groupVolume namespace. - [groupVolume](https://docs.sonos.com/reference/groupvolume-object.md) - [getOptions](https://docs.sonos.com/reference/hometheater-getoptions-playerid.md): This command retrieves the current home theater options. - [setOptions](https://docs.sonos.com/reference/hometheater-setoptions-playerid.md): This command is used to customize the home theater experience. The client application can send multiple options to the player concurrently. The player will only change the values of those options which are present. Note: This is a subset of homeTheater options that are being exposed for guest access. - [households](https://docs.sonos.com/reference/households.md) - [getHouseholds](https://docs.sonos.com/reference/households-gethouseholds.md): The getHouseholds command requests information on the households that can be acted upon, based upon the access token used when calling this API. There are no parameters for this command. If successful, Sonos responds with an array of household objects. - [getHousehold](https://docs.sonos.com/reference/households-gethousehold.md): The getHousehold command requests information on the specific household represented by provided resourceId that can be acted upon, based upon the access token used when calling this API. There are no parameters for this command. If successful, Sonos responds with a household object. - [About Control API](https://docs.sonos.com/reference/about-control-api.md) - [match](https://docs.sonos.com/reference/musicserviceaccounts-match-householdid.md): Use the match command in the musicServiceAccounts namespace to get the account ID of a music service user account from the player. All players in the household return the same accounts. Changes made to a player are automatically replicated throughout the household. - [MusicServiceAccount](https://docs.sonos.com/reference/musicserviceaccount.md) - [playback](https://docs.sonos.com/reference/playback.md) - [getPlaybackStatus](https://docs.sonos.com/reference/playback-getplaybackstatus-groupid.md): Use the getPlaybackStatus command in the playback namespace get the current playback status (transport state) for the group, such as PLAYBACK_STATE_IDLE, PLAYBACK_STATE_BUFFERING, or PLAYBACK_STATE_PLAYING. See the playbackStatus object for details. - [loadLineIn](https://docs.sonos.com/reference/playback-loadlinein-groupid.md): Use the loadLineIn command in the playback namespace to change the current group source to the line-in source of a specified player. This can be be any player in the household that supports line-in. See Using Line-In on Sonos on the Sonos Support site for more details about the line-in capabilities of our players. You can tell whether a player has line-in capabilities with the LINE_IN value in the capabilities object. See the groups object for details. The player will switch away from the line-in source when the hardware detects that the user has physically unplugged the line-in cable. - [pause](https://docs.sonos.com/reference/playback-pause-groupid.md): Use the pause command in the playback namespace to pause group playback. After a successful pause command, if your app is subscribed to the playback namespace, it will receive a playbackStatus event with either PLAYBACK_STATE_PAUSED or PLAYBACK_STATE_IDLE, depending on the audio source loaded on the group. - [play](https://docs.sonos.com/reference/playback-play-groupid.md): Use the play command in the playback namespace to initiate group playback. After a successful play command, if your app is subscribed to the playback namespace, it may first receive a playbackStatus event with PLAYBACK_STATE_BUFFERING before another event with PLAYBACK_STATE_PLAYING. Sonos players will buffer the audio ahead of time when possible, in order to provide the shortest time to play for the user, and to prevent any audio gaps between tracks. - [playbackError](https://docs.sonos.com/reference/playback-playbackerror.md) - [playbackStatus](https://docs.sonos.com/reference/playback-playbackstatus.md) - [setPlayModes](https://docs.sonos.com/reference/playback-setplaymodes-groupid.md): Use the setPlayModes command in the playback namespace to change group play modes, such as repeat, repeat one track, shuffle, and crossfade. See Play Modes for details. Configure a play mode in the playModes array by adding a “true” or “false” value for the mode, or omit a play mode to leave it unchanged. - [seek](https://docs.sonos.com/reference/playback-seek-groupid.md): Use the seek command in the playback namespace to go to a specific position in the current track. Optionally add the cloud queue itemId to target a specific track. Use itemId to ensure the group seeks on the current item. If the current item’s itemId does not match the one provided, the player returns an ERROR_INVALID_OBJECT_ID error. - [seekRelative](https://docs.sonos.com/reference/playback-seekrelative-groupid.md): Use the seekRelative command in the playback namespace to seek to the a relative position in the current track. Optionally add the cloud queue itemId to target a specific track. Use itemId to ensure the group seeks on the current item. If the current item’s itemId does not match the one provided, the player returns ERROR_INVALID_OBJECT_ID. - [skipToNextTrack](https://docs.sonos.com/reference/playback-skiptonexttrack-groupid.md): Use the skipToNextTrack command in the playback namespace to skip to the next track. Not all audio sources allow multiple tracks. For example, when a group is streaming an Internet radio station, there is no next track to skip to. If you send a skipToNextTrack command when the audio source does not support multiple tracks, your app will receive an ERROR_PLAYBACK_FAILED, but the audio will continue playing. - [skipToPreviousTrack](https://docs.sonos.com/reference/playback-skiptoprevioustrack-groupid.md): Use the skipToPreviousTrack command in the playback namespace to skip to the previous track. Not all audio sources allow multiple tracks. For example, when a group is streaming an Internet radio station, there is no previous track to skip to. If you send a skipToPreviousTrack command when the audio source does not support multiple tracks, your app will receive an ERROR_PLAYBACK_FAILED, but audio will continue playing. - [subscribe](https://docs.sonos.com/reference/playback-subscribe-groupid.md): Use this command to subscribe to events in the playback namespace. - [unsubscribe](https://docs.sonos.com/reference/playback-unsubscribe-groupid.md): Use this command to unsubscribe to events in the playback namespace. - [togglePlayPause](https://docs.sonos.com/reference/playback-toggleplaypause-groupid.md): Use the togglePlayPause command in the playback namespace to toggle the playback state on the given group, if possible. Upon completion of the command, the player sends playbackStatus events to all subscribers. When toggling from pause to play, this functions similar to the play command. When transitioning from play to pause, it functions like the pause command. See those commands for more details about the functionality of those states. - [getMetadataStatus](https://docs.sonos.com/reference/playbackmetadata-getmetadatastatus-groupid.md): Use this command to poll for metadata changes. This command returns a metadataStatus object for the target group. - [subscribe](https://docs.sonos.com/reference/playbackmetadata-subscribe-groupid.md): Use this command to subscribe to events in the playbackMetadata namespace. Returns an empty body with a success value of true if successful and sends a metadataStatus event only to the subscriber. - [unsubscribe](https://docs.sonos.com/reference/playbackmetadata-unsubscribe-groupid.md): Use this command to unsubscribe to events in the playbackMetadata namespace. Returns an empty body with a success value of true if successful. - [metadataStatus](https://docs.sonos.com/reference/metadatastatus.md) - [createSession](https://docs.sonos.com/reference/playbacksession-createsession-groupid.md): Use the createSession command in the playbackSession namespace to unconditionally create a new session and clobber any existing sessions. Use appContext to determine how multiple instances of your app can share control of a session. For example, if you provide a user account identifier as appContext, then two instances of your app logged into the same user account would be able to control the same session on a group. If you choose to implement your app to always provide an appContext that is unique for all app instances, then only one app instance can control a session at any time. Use customData to save information in the session that your app finds useful. For example, your app could store a playlist identifier in customData, so that another app instance could automatically load the right playlist when joining a session. - [loadCloudQueue](https://docs.sonos.com/reference/playbacksession-loadcloudqueue-sessionid.md): One way to play audio on Sonos is by using a cloud queue, a list of tracks that you host on a server that the player can access. See Play audio for details. Use the loadCloudQueue command in the playbackSession namespace to load, and optionally start playback of, an item in a cloud queue. This command requires that your app has an open playback session with a cloud queue, created or joined using the createSession, joinSession, or joinOrCreateSession command. If you want to immediately start playing the track, set the playOnCompletion parameter to true. This bypasses the need to send a play command after the player loads the track. You should also send playback objects with information about the track in the trackMetadata parameter. This optimization improves the user experience by starting playback for the first track before the player fetches tracks from the cloud queue server. After receiving the loadCloudQueue command, the player will fetch a window of tracks from the cloud queue server centered around the item with the itemId that your app provided. If the track was deleted, the group will play the next track in the queue. For more details, see the Cloud Queue API /itemWindow endpoint. All commands in the playback and playbackMetadata namespace also apply to the cloud queue playback. For example, you can send the play or pause command in the playback namespace to play or pause a cloud queue track on a player. - [loadStreamUrl](https://docs.sonos.com/reference/playbacksession-loadstreamurl-sessionid.md): The loadStreamUrl command in the playbackSession namespace loads a streaming (live) radio station URL and optionally starts playback. Upon successful completion, the player sends a playbackStatus event to your app or hardware integration. Your app should subscribe to the playback namespace before sending the loadStreamUrl command to avoid race conditions in receiving playbackStatus or playbackError events. This command requires that your app has an open playback session with a cloud queue, created or joined using the createSession, joinSession, or joinOrCreateSession command. If you want to immediately start playing the stream, set the playOnCompletion parameter to true. This bypasses the need to send a play command after the player loads the stream. - [refreshCloudQueue](https://docs.sonos.com/reference/playbacksession-refreshcloudqueue-sessionid.md): Use the refreshCloudQueue command in the playbackSession namespace to signal the player to re-fetch tracks from the cloud queue server centered around the current item. See the Cloud Queue API /itemWindow endpoint for details. This command requires your app to have either created a new session or joined an existing session, and also loaded a cloud queue on the group with loadCloudQueue. Your app should only use this command when it detects a change in the cloud queue content that should immediately be reflected in the group. For example, if a user removes the currently playing track with your app, use this command to remove the track from the group and stop it from playing. This helps provide a good user experience. - [seek](https://docs.sonos.com/reference/playbacksession-seek-sessionid.md): Use the seek command in the playbackSession namespace to seek to the position in the track with the specified itemId in a cloud queue. This command requires your app to have either created a new session or joined an existing session, and also loaded a cloud queue on the group with loadCloudQueue. Use itemId to ensure the group seeks on the current item. If the current item’s itemId does not match the one provided, the player returns an ERROR_INVALID_OBJECT_ID error. - [seekRelative](https://docs.sonos.com/reference/playbacksession-seekrelative-sessionid.md): Use the seekRelative command in the playbackSession namespace to seek to the a relative position in the track with the specified cloud queue itemId. Use itemId to ensure the group seeks on the current item. If the current item’s itemId does not match the one provided, the player returns ERROR_INVALID_OBJECT_ID. - [skipToItem](https://docs.sonos.com/reference/playbacksession-skiptoitem-sessionid.md): Use the skipToItem command in the playbackSession namespace to skip to the track with the specified itemId in a cloud queue and optionally seek and initiate playback. This command requires your app to have either created a new session or joined an existing session, and also loaded a cloud queue on the group with loadCloudQueue. Use playOnCompletion to start playing the cloud queue item being loaded, so your app doesn’t have to send an extra play command. Most of the times your app already has access to the track metadata of the cloud queue item that is being loaded. Use the optional trackMetadata parameter to provide that information so the group can start playing the track immediately after receiving the loadCloudQueue command. This optimization improves the user experience by starting playback before the player fetches tracks from the cloud queue server. - [subscribe](https://docs.sonos.com/reference/playbacksession-subscribe-sessionid.md): Use this command to subscribe to events in the playbackSession namespace for a specific sessionId. Your app can only be subscribed to one session at a time. Returns an empty body with a success value of true if successful. - [unsubscribe](https://docs.sonos.com/reference/playbacksession-unsubscribe-sessionid.md): Use this command to unsubscribe to events in the playbackSession namespace. Returns an empty body with a success value of true if successful. - [suspend](https://docs.sonos.com/reference/playbacksession-suspend-sessionid.md): Use the suspend command in the playbackSession namespace to suspend a specified session. The player will clear the stored item window of tracks and send a playbackStatus event to tell clients that the current item is null. As described in a cloud queue use case in Play audio, if your app sends a play command when the cloud queue is empty, the player will attempt to resume playback of content that was playing prior to this command. For example, if the user was previously listening to a radio station or had a playlist queued, it will attempt to resume playback of that content. When a session is suspended, the player won’t revert to the previous music source in this case. Instead, the player delivers a sessionInfo event with a suspended value of true for the suspended session. The session stays suspended until one of the following occurs: The player receives a play command. If the player receives a play command, it sends a sessionInfo event with a suspended value of false. The player receives either a loadCloudQueue or skipToItem command for the suspended session. The player follows these commands as specified. The player receives a createSession command. The suspended session receives an ERROR_SESSION_EVICTED sessionError. The user or an action picks a new music source. This can either be from the Sonos app or through the loadFavorite command. The suspended session receives an ERROR_SESSION_EVICTED sessionError. - [sessionError](https://docs.sonos.com/reference/playbacksession-sessionerror.md) - [sessionInfo](https://docs.sonos.com/reference/sessioninfo.md) - [sessionStatus](https://docs.sonos.com/reference/sessionstatus.md) - [setVolume](https://docs.sonos.com/reference/playervolume-setvolume-playerid.md): Use the setVolume command to set the player's volume and mute state. Returns an empty body with a success value of true if successful. The player generates a playerVolume event if the volume was changed. Additionally, if setVolume is called on a player that has a fixed player volume state that is true, the command will fail and you will receive an ERROR_COMMAND_FAILED globalError. This is because players with fixed volumes cannot be changed, for example, a CONNECT with fixed line out would respond with this error if your app tried to set the volume on it. - [getVolume](https://docs.sonos.com/reference/playervolume-getvolume-playerid.md): Use the getVolume command in the playerVolume namespace to get the volume and mute state of a player. - [duck](https://docs.sonos.com/reference/playervolume-duck-playerid.md): Ducking temporarily lowers the zone's volume without affecting the observed system volume. Sending another "duck" command to a system that is already ducking does not affect the output level. However, it does reset the duration. - [setMute](https://docs.sonos.com/reference/playervolume-setmute-playerid.md): Use the setMute command in the playerVolume namespace to mute and unmute a player. Returns an empty body with a success value of true if successful. The player generates a playerVolume event if the mute state was changed. - [setRelativeVolume](https://docs.sonos.com/reference/playervolume-setrelativevolume-playerid.md): Use the setRelativeVolume command to increase or decrease volume and set the player's mute state. Returns an empty body with a success value of true if successful. The player generates a playerVolume event if the volume was changed. - [subscribe](https://docs.sonos.com/reference/playervolume-subscribe-playerid.md): Use this command to subscribe to events in the playerVolume namespace. Returns an empty body with a success value of true if successful and sends a playerVolume event only for the subscriber. - [unsubscribe](https://docs.sonos.com/reference/playervolume-unsubscribe-playerid.md): Use this command to unsubscribe to events in the playerVolume namespace. - [unduck](https://docs.sonos.com/reference/playervolume-unduck-playerid.md): This command is the dual of duck. The volume is restored if there is a ducking operation in progress. Otherwise, the system accepts this command and does not change any internal state. - [playerVolume object](https://docs.sonos.com/reference/playervolume-object.md) - [loadPlaylist](https://docs.sonos.com/reference/playlists-loadplaylist-groupid.md): The loadPlaylist command activates a playlist within the default playback session. This command interrupts any active private playback sessions. Sonos adds tracks from the playlist to the queue and activates the queue. This prevents your app from overwriting user-curated queues. - [getPlaylists](https://docs.sonos.com/reference/playlists-getplaylists-householdid.md): Use the getPlaylists command to get the list of Sonos playlists for a household. Playlists do not include pinned items (any non-playable containers pinned to My Sonos) or Sonos favorites. See the Save your favorites section in the Sonos user guide for details about My Sonos. Returns a playlistsList object, which is an array of playlist objects with a version number. - [subscribe](https://docs.sonos.com/reference/playlists-subscribe-householdid.md): Use this command to subscribe to events in the playlists namespace. When subscribed, Sonos sends asynchronous versionChanged events when users update their Sonos playlists. Your app can then choose to fetch the playlists as needed whenever the version changes. This is because the playlistsList object can be large for asynchronous events. - [unsubscribe](https://docs.sonos.com/reference/playlists-unsubscribe-householdid.md): Use this command to unsubscribe to events in the playlists namespace. - [playlist object](https://docs.sonos.com/reference/playlist-object.md) - [About Cloud Queue API](https://docs.sonos.com/reference/about-cloud-queue-api.md) - [context](https://docs.sonos.com/reference/context.md) - [reports object](https://docs.sonos.com/reference/reports-object.md) - [itemWindow](https://docs.sonos.com/reference/itemwindow.md) - [reason parameter](https://docs.sonos.com/reference/reason-parameter.md) - [timePlayed](https://docs.sonos.com/reference/timeplayed.md) - [v2.3 item attributes](https://docs.sonos.com/reference/v23-item-attributes.md) - [v2.2 item attributes](https://docs.sonos.com/reference/v22-item-attributes.md) - [v2.1 item attributes](https://docs.sonos.com/reference/v21-item-attributes.md) - [v2.0 item attributes](https://docs.sonos.com/reference/v20-item-attributes.md) - [v1.0 item attributes](https://docs.sonos.com/reference/v10-item-attributes.md) - [SMAPI error objects](https://docs.sonos.com/reference/smapi-error-objects.md) - [Cloud queue response](https://docs.sonos.com/reference/cloud-queue-response.md) - [version](https://docs.sonos.com/reference/version.md) ## Pages - [404](https://docs.sonos.com/page/404.md)