Control Spotify from the command line with Spotify Web API + Spotify Connect.
This tool controls the Spotify app running on your phone, desktop, or speaker. It does not play audio inside the terminal.
- Log in with Spotify PKCE auth
- List your available Spotify Connect devices
- Transfer playback between devices
- Play, pause, skip, seek, shuffle, repeat, and set volume
- Search Spotify and print reusable URIs
- View the current queue and add tracks to it
- Show recently played tracks
- Save, remove, and check library items
- Node.js 20+
- npm
- A Spotify Premium account for playback control
- A Spotify developer app with a client ID
npm install
npm run build
npm link
spot --helpThat gives you a global spot command.
- Go to
https://developer.spotify.com/dashboard - Create a new app
- Set the redirect URI to:
https://szakacsmedia.com/spotify-cli/callback
- Select
Web API - Save the app
- Copy the app's
Client ID
You do not need a client secret for this CLI.
spot config set-client-id YOUR_CLIENT_ID
spot config showIf you want to override the default redirect URI:
spot config set-redirect-uri https://szakacsmedia.com/spotify-cli/callbackYou can also use environment variables:
export SPOTIFY_CLIENT_ID=YOUR_CLIENT_ID
export SPOTIFY_REDIRECT_URI=https://szakacsmedia.com/spotify-cli/callbackStart the login flow:
spot auth loginSpotify will send you to a browser. After you approve access, it will redirect to:
https://szakacsmedia.com/spotify-cli/callback?code=...
Copy that full final URL and finish the login:
spot auth finish 'PASTE_THE_FULL_CALLBACK_URL_HERE'
spot auth statusspot devices list
spot playback status
spot search "fear nf" --type track --limit 5
spot playback play spotify:track:3HfKlhohNNTLIv2t9uvmzz
spot playback pausespot auth login
spot auth finish 'PASTE_THE_FULL_CALLBACK_URL_HERE'
spot auth status
spot auth logoutspot devices list
spot devices transfer "MacBook Pro"spot playback status
spot playback play
spot playback play spotify:playlist:37i9dQZF1DXcBWIGoYBM5M
spot playback play "https://open.spotify.com/track/4uLU6hMCjMI75M1A2tKUQC"
spot playback pause
spot playback next
spot playback previous
spot playback volume 35
spot playback seek 60000
spot playback shuffle on
spot playback repeat contextspot playback queue
spot playback add spotify:track:4uLU6hMCjMI75M1A2tKUQCspot search "daft punk"
spot recentspot library save spotify:album:4m2880jivSbbyEGAKfITCa
spot library contains spotify:track:4uLU6hMCjMI75M1A2tKUQC
spot library remove spotify:track:4uLU6hMCjMI75M1A2tKUQCSpotify changed parts of its development-mode behavior in early 2026. The main things that matter here:
- Playback control requires Spotify Premium
- New apps need a secure redirect URI
- Search results are limited to
10per type in development mode
Relevant docs:
https://developer.spotify.com/documentation/web-api/tutorials/code-pkce-flowhttps://developer.spotify.com/documentation/web-api/tutorials/refreshing-tokenshttps://developer.spotify.com/documentation/web-api/tutorials/february-2026-migration-guide
Run the login flow again:
spot auth login
spot auth finish 'PASTE_THE_FULL_CALLBACK_URL_HERE'Open Spotify on your phone, desktop, or speaker first, then run:
spot devices listUsually one of these is true:
- Spotify is not open on any active device
- The selected device is restricted
- The account tied to the developer app is not Premium
npm run build
npm link
hash -r~/.config/spotify-cli/config.json
~/.config/spotify-cli/tokens.json
~/.config/spotify-cli/auth-session.json
Current release: v1.1.0
Next release target: v1.2.0
- better search-to-play shortcuts
- stronger playlist workflows
- broader command coverage across the useful Spotify control surface
- more end-to-end smoke coverage
npm test
npm run build
node dist/index.js --helpMIT