Commands

sonos search spotify

sonos search spotify

Searches Spotify via the Spotify Web API (client credentials). Requires SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET (or the matching flags). Prints Spotify URIs you can hand to sonos open / sonos enqueue, or have the command play directly.

#Synopsis

sonos search spotify <query> [flags]

#Flags

FlagDefaultWhat it does
--type stringtracktrack, album, playlist, show, episode.
--limit int10Max results (1–50).
--market stringOptional market (e.g. US); empty = global.
--index int1Which search result to use with --open / --enqueue (1-based).
--openoffOpen the selected result on Sonos (requires --name / --ip).
--enqueueoffEnqueue the selected result on Sonos (requires --name / --ip).
--client-id stringSpotify Web API client id (or env SPOTIFY_CLIENT_ID).
--client-secret stringSpotify Web API client secret (or env SPOTIFY_CLIENT_SECRET).

#Examples

export SPOTIFY_CLIENT_ID=…
export SPOTIFY_CLIENT_SECRET=…

# Just print URIs
sonos search spotify "miles davis" --type album --limit 5

# Pick result #2 and play on Sonos
sonos search spotify "blue train" --type album --index 2 --open --name "Kitchen"

# Enqueue without playing
sonos search spotify "deep focus" --type playlist --enqueue --name "Kitchen"

#When to use this vs SMAPI

Prefer sonos play spotify (SMAPI) if you don't need Spotify-specific filters — it works with the credentials Sonos already has.

Reach for search spotify when you specifically need:

  • Market-specific filtering
  • show / episode (podcasts)
  • Spotify-side scoring rather than Sonos-side scoring