Keyboard Shortcut to Like Song Spotify: Practical Guide
Learn practical, developer-friendly ways to 'like' a Spotify track using keyboard shortcuts, OS automation, and the Spotify Web API. This guide covers setup, code samples, and safe testing across Windows and macOS.

There is no native built-in keyboard shortcut in Spotify to 'like' a track on desktop. To achieve a one-key save, you can use OS automation or the Spotify Web API to save a track programmatically. This guide shows practical scripts and workflows you can adapt across Windows and macOS.
Native shortcuts and the gap for 'like'\nSpotify exposes core playback controls (Play/Pause, Next, Previous) and system-wide media keys, but there is no universal keyboard shortcut to press the heart icon and save the currently playing track. This creates a gap for power users who want a single keystroke to save a track without switching apps. The three robust approaches are: (1) OS automation that clicks the Save button, (2) the Spotify Web API to save a track with an ID, and (3) a small client-side script that fetches the current track and saves it. The Python example demonstrates a reliable API-based approach you can integrate into any workflow. In addition, you’ll see a curl example for direct API usage and a Windows AutoHotkey script that wires a hotkey to perform a UI action. The USD of this approach is simplicity, portability, and auditability of the action.
# Python: save a track by ID using Spotipy
from spotipy import Spotify
from spotipy.oauth2 import SpotifyOAuth
sp = Spotify(auth_manager=SpotifyOAuth(
scope="user-library-modify",
client_id="YOUR_CLIENT_ID",
client_secret="YOUR_CLIENT_SECRET",
redirect_uri="http://localhost:8888/callback"
))
track_id = "TRACK_ID" # Replace with actual Spotify track ID
sp.current_user_saved_tracks_add([track_id])
print("Liked:", track_id)# cURL: save a track via Web API (requires OAuth token)
TRACK_ID=TRACK_ID
TOKEN=YOUR_ACCESS_TOKEN
curl -X PUT "https://api.spotify.com/v1/me/tracks?ids=${TRACK_ID}" \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json"; AutoHotkey example: press a hotkey, click Save button (coordinates vary by screen)
^!s:: ; Ctrl+Alt+S
Coordinate := {x: 320, y: 420} ; adjust for your layout
MouseMove, Coordinate.x, Coordinate.y
MouseClick, left
returnExplanation: The Python example demonstrates a clean API-based save, the curl example shows a direct HTTP call, and the AutoHotkey script gives a data-free path for Windows users who rely on UI automation when the API or SDK is unavailable. Consider safety and rate limits when automating actions.
Steps
Estimated time: 1-2 hours
- 1
Assess the preferred path
Decide if you will rely on API calls, OS automation, or a hybrid approach. This determines what environment to prepare and which credentials you need.
Tip: Start with API-based saving to avoid UI fragility. - 2
Set up API credentials
Register a Spotify app to obtain Client ID and Client Secret, then configure the OAuth flow to obtain a token with user-library-modify scope.
Tip: Store credentials securely; rotate tokens regularly. - 3
Prototype a save function (API)
Create a small script that calls the Spotify API to save a given track ID, handling errors and rate limits.
Tip: Test with a private track or a test playlist. - 4
Prototype a native hotkey (Windows/macOS)
Implement a hotkey that triggers API calls or UI automation to save the currently playing track.
Tip: Use image recognition or element IDs if possible for reliability. - 5
Test in controlled environment
Run the workflow while music plays, verify the track is saved, and monitor for failures or edge cases.
Tip: Log every save action for auditing. - 6
Document and share the workflow
Write a short README with setup steps, caveats, and how to customize coordinates or IDs for your setup.
Tip: Include security notes about tokens and scopes.
Prerequisites
Required
- Required
- Required
- Required
Keyboard Shortcuts
| Action | Shortcut |
|---|---|
| Play/PauseToggles playback of the current track | ␣ |
| Next trackSkip to the next track | Ctrl+→ |
| Previous trackReturn to the previous track | Ctrl+← |
| Volume upIncrease volume (system/app dependent) | Ctrl+↑ |
Questions & Answers
Is there a native keyboard shortcut to like a song on Spotify?
No universal built-in shortcut exists for saving a track in the desktop Spotify app. You must rely on API-based savings or UI automation if you want a one-key save.
Spotify does not have a native shortcut to like a track; use API scripts or automation instead.
Can I use this on both Windows and macOS without changing code?
Yes, but you will typically need separate automation scripts for Windows and macOS. The API approach works uniformly across platforms with token management.
Cross-platform API usage works consistently; UI automation may require platform-specific tweaks.
What are the safest ways to implement a shortcut?
Prefer the Spotify Web API for saving tracks and minimal UI automation. Avoid heavy UI automation in critical workflows to reduce flaky behavior and terms-of-service issues.
API-based saving is safest; minimize UI automation where possible.
Do I need to know programming to implement this?
Basic scripting knowledge helps, but you can start with simple curl commands or a ready-made script and adapt it to your environment with minimal changes.
Some scripting helps, but you can start with ready-made examples.
How do I test token expiration and refresh in my workflow?
Plan for token refresh logic in your script. Use OAuth libraries that handle refresh automatically and include error handling for expired tokens.
Include automatic token refresh and error handling in your scripts.
Main Points
- Identify the right path: API, automation, or hybrid.
- API-based saving is the most robust long-term solution.
- Verify with test tracks before deploying widely.
- Document setup and edge cases for reliability.