musicServiceAccounts > match

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.

The createSession and joinOrCreateSession commands in the playbackSession namespace use the account returned by this command to specify the music service account to use for playback during the session. See Account Matching for implementation details.


Endpoint

POST


Request Parameters

This command requires a householdId to determine the target of the command. See the Control documentation for details.

See the table below for descriptions of parameters in the body.

Parameter Type Value
userIdHashCode string Opaque hash of the user account. You must use the same algorithm used by your SMAPI server. See getDeviceAuthToken and getUserInfo SMAPI requests for details.
nickname string The name for the music service account presented to the user when they view their account from the Sonos app.
serviceId string The unique identifier for the music service. Maximum length of 20 characters.
linkCode string
(1024)
(Optional) The link code generated for device authentication. Your SMAPI service can also send this to the player in the getAppLink SMAPI request. The player can send it back in the getDeviceAuthToken SMAPI request.
linkDeviceId string
(1024)
(Optional) Private data associated with the link code to prevent phishing. Like linkCode, also sent in the getAppLink SMAPI request and returned in the getDeviceAuthToken SMAPI request.

Response

Returns a MusicServiceAccount object on success. In the event of a failure, returns an ERROR_COMMAND_FAILED globalError.


Example

Request

Response