Spotify
API actions for the Spotify integration.
Spotify
Control playlists and playback in Spotify.
Add tracks to playlist
Add one or more tracks to a Spotify playlist.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
playlist_id | string | Yes | playlist ID to update |
track_uris | array | Yes | Array of Spotify track URIs to add |
position | number | No | insertion index for the new tracks |
Response
{
"snapshot_id": "abc123xyz789"
}Create playlist
Create a Spotify playlist for a user with an optional description and visibility.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | string | Yes | Spotify user ID that will own the playlist |
name | string | Yes | playlist name |
description | string | No | description shown in Spotify |
public | boolean | No | Whether the playlist should be public |
Response
{
"playlist": {
"id": "abc123xyz789",
"name": "Sample Item",
"uri": "spotify:track:abc123xyz"
}
}Get current playback
Retrieve information about the user's current Spotify playback state.
Response
{
"device": "Web Player",
"is_playing": true,
"progress_ms": 1,
"track": {
"artists": [
"mock_value"
],
"id": "abc123xyz789",
"name": "Sample Item",
"uri": "spotify:track:abc123xyz"
}
}Get track details
Fetch metadata for a specific Spotify track by its ID.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
track_id | string | Yes | Spotify track ID to fetch |
Response
{
"track": {
"album": "Greatest Hits",
"artists": [
"mock_value"
],
"duration_ms": 1,
"id": "abc123xyz789",
"name": "Sample Item",
"preview_url": "https://example.com/path/123",
"uri": "spotify:track:abc123xyz"
}
}Pause playback
Pause playback on the active Spotify device.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
device_id | string | No | device ID to target |
Response
{
"status": "paused"
}Remove tracks from playlist
Remove one or more tracks from a Spotify playlist by URI.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
playlist_id | string | Yes | playlist ID to update |
track_uris | array | Yes | Array of Spotify track URIs to remove |
Response
{
"snapshot_id": "abc123xyz789"
}Search Spotify tracks
Search for tracks on Spotify by keyword and return the top matches.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | search string to query (song, artist, or album) |
limit | number | No | How many results to return |
Response
{
"tracks": [
{
"album": "Greatest Hits",
"artists": [
"mock_value"
],
"id": "abc123xyz789",
"name": "Sample Item",
"uri": "spotify:track:abc123xyz"
}
]
}Start playback
Start or resume playback on the active Spotify device.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
uris | array | No | list of track URIs to play immediately |
device_id | string | No | device ID to target |
position_ms | number | No | starting position in milliseconds |
Response
{
"status": "started"
}