Music
Spotify
target_app: "spotify" · endpoint /v1/music/execute · OAuth — connects per end-user automatically
Setup
Per end-user OAuth, no developer credentials needed. Send the user to /auth/spotify/connect?user_id=X&callback_url=... . Playback control requires an active Spotify session on one of their devices (phone, desktop app, web player) — Spotify's API can't "wake up" a fully closed app.
Actions
search
Search for a track.
Request body:
{
"user_id": "...",
"action": "search",
"payload": { "query": "So Will I Hillsong Worship" },
"target_app": "spotify"
}provider_response.result shape:
{ "tracks": { "items": [{"uri":"spotify:track:...","name":"...","artists":[...]}] } }play
Start playback of a specific track URI on the active device.
Request body:
{
"user_id": "...",
"action": "play",
"payload": { "uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" },
"target_app": "spotify"
}provider_response.result shape:
{} (204 No Content)pause
Pause playback.
Request body:
{
"user_id": "...",
"action": "pause",
"payload": {},
"target_app": "spotify"
}provider_response.result shape:
{} (204 No Content)skip
Skip to the next track.
Request body:
{
"user_id": "...",
"action": "skip",
"payload": {},
"target_app": "spotify"
}provider_response.result shape:
{} (204 No Content)get_current
Get what's currently playing.
Request body:
{
"user_id": "...",
"action": "get_current",
"payload": {},
"target_app": "spotify"
}provider_response.result shape:
{ "item": {"name":"...","artists":[...]}, "is_playing": true }get_devices
List the user's active/available devices.
Request body:
{
"user_id": "...",
"action": "get_devices",
"payload": {},
"target_app": "spotify"
}provider_response.result shape:
{ "devices": [{"id":"...","name":"iPhone","is_active":true}] }add_to_queue
Add a track to the playback queue.
Request body:
{
"user_id": "...",
"action": "add_to_queue",
"payload": { "uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" },
"target_app": "spotify"
}provider_response.result shape:
{} (204 No Content)get_recently_played
List recently played tracks.
Request body:
{
"user_id": "...",
"action": "get_recently_played",
"payload": {},
"target_app": "spotify"
}provider_response.result shape:
{ "items": [{"track":{"name":"..."},"played_at":"..."}] }Anticipated errors & fixes
404 "NO_ACTIVE_DEVICE" on play/pause/skip
Cause: Nothing is currently open/active in Spotify on any of the user's devices — Spotify's API has nothing to control.
Fix: Tell the user to open Spotify (phone or desktop) and start any playback first, or call get_devices to check first.
search / everything returns "no token" errors
Cause: Almost always a canonical user_id mismatch — the OAuth connection happened under a different session/device ID than the one calling now (this looks identical to "not connected" but a real connection exists).
Fix: Verify the exact user_id used to connect matches the one used for this call.
401 "The access token expired"
Cause: Token expired and couldn't auto-refresh (missing refresh token from an old/incomplete OAuth grant).
Fix: Have the user reconnect via the OAuth flow.
401 "Unauthorized: Invalid API key."
Cause: Your eConnect Authorization header is missing, malformed, or the key was regenerated/revoked.
Fix: Copy your api_key fresh from the eConnect dashboard and confirm the header reads exactly "Authorization: Bearer <key>".
429 "Too many requests"
Cause: You've exceeded your plan's per-minute rate limit.
Fix: Wait a minute and retry, or upgrade your plan for a higher per-minute limit.
429 "Monthly API limit exceeded"
Cause: You've used your plan's full monthly request allowance.
Fix: Wait for your next billing cycle reset, or upgrade to a plan with a higher monthly limit.