# Spotify

> Search tracks, albums, and artists, build and edit playlists, save music to your library, and see what's playing on Spotify.

App · Music & Podcasts · 10 actions. Web page: https://docs.lodol.com/docs/integrations/spotify

## Actions

### Add tracks to playlist

Add one or more tracks to a Spotify playlist.

**Inputs**

- Playlist (`playlist_id`, text, required): The playlist to add tracks to. Paste a Spotify playlist link, a spotify:playlist: URI, or the playlist's ID.
- Tracks to add (`track_uris`, list, required): A list of tracks to add (up to 100). Each item can be a Spotify track link, a spotify:track: URI, or a track ID. Build the list with a Create a list step.
- Insert position (`position`, number): Where to place the tracks, counting from 0. Leave empty to add them at the end. At least 0.

**Outputs**

- `snapshot_id` (text): Playlist snapshot ID representing the current version after tracks were added.

**Example output**

```json
{
  "snapshot_id": "abc123xyz789"
}
```

### Create playlist

Create a new playlist in your connected Spotify account. You can add a description, choose whether it's public, and make it collaborative.

**Inputs**

- Playlist name (`name`, text, required): The name of the new playlist.
- Description (`description`, text): An optional description shown on the playlist in Spotify.
- Public (`public`, true/false): Make the playlist visible on your public profile. Default: `false`.
- Collaborative (`collaborative`, true/false): Let others add and remove tracks. A collaborative playlist must be private, so keep Public set to No. Default: `false`.

**Outputs**

- `playlist` (object): Playlist details

**Example output**

```json
{
  "playlist": {
    "collaborative": false,
    "id": "abc123xyz789",
    "name": "Sample Item",
    "public": false,
    "uri": "spotify:playlist:abc123xyz"
  }
}
```

### Get album details

Look up a Spotify album by its ID, including its track list.

**Inputs**

- Album (`album_id`, text, required): The album to look up. Paste a Spotify album link, a spotify:album: URI, or the album's ID.

**Outputs**

- `album` (object): Album details

**Example output**

```json
{
  "album": {
    "artists": [
      "mock_value"
    ],
    "id": "abc123xyz789",
    "name": "Sample Item",
    "release_date": "2020-01-01",
    "total_tracks": 1,
    "tracks": [
      {
        "id": "trk123",
        "name": "Sample Track",
        "uri": "spotify:track:trk123"
      }
    ],
    "uri": "spotify:album:abc123xyz"
  }
}
```

### Get artist details

Look up a Spotify artist by their ID.

**Inputs**

- Artist (`artist_id`, text, required): The artist to look up. Paste a Spotify artist link, a spotify:artist: URI, or the artist's ID.

**Outputs**

- `artist` (object): Artist details

**Example output**

```json
{
  "artist": {
    "followers": 1,
    "genres": [
      "mock_value"
    ],
    "id": "abc123xyz789",
    "name": "Sample Item",
    "popularity": 1,
    "uri": "spotify:artist:abc123xyz"
  }
}
```

### Get current playback

Get details about what's currently playing on Spotify.

**Inputs**: None.

**Outputs**

- `device` (text): Active device name, or null when no device is active
- `is_playing` (true/false): True if a track is currently playing, false if paused or nothing is playing
- `progress_ms` (number): Current playback position in milliseconds, or null when nothing is playing
- `track` (object): Currently playing track, or null when nothing is playing

**Example output**

```json
{
  "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

Look up the details of a Spotify track by its ID.

**Inputs**

- Track (`track_id`, text, required): The track to look up. Paste a Spotify track link, a spotify:track: URI, or the track's ID.

**Outputs**

- `track` (object): Track details

**Example output**

```json
{
  "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"
  }
}
```

### Remove tracks from playlist

Remove one or more tracks from a Spotify playlist.

**Inputs**

- Playlist (`playlist_id`, text, required): The playlist to remove tracks from. Paste a Spotify playlist link, a spotify:playlist: URI, or the playlist's ID.
- Tracks to remove (`track_uris`, list, required): A list of tracks to remove (up to 100). Each item can be a Spotify track link, a spotify:track: URI, or a track ID. Build the list with a Create a list step.

**Outputs**

- `snapshot_id` (text): Playlist snapshot ID representing the current version after tracks were removed.

**Example output**

```json
{
  "snapshot_id": "abc123xyz789"
}
```

### Save albums to library

Save one or more albums to your Spotify library.

**Inputs**

- Albums to save (`album_uris`, list, required): A list of albums to save (up to 50). Each item can be a Spotify album link, a spotify:album: URI, or an album ID. Build the list with a Create a list step.

**Outputs**

- `count` (number): How many albums were saved.
- `saved` (true/false): True when the albums were saved.

**Example output**

```json
{
  "count": 1,
  "saved": true
}
```

### Save tracks to library

Save one or more tracks to your Spotify library (Liked Songs).

**Inputs**

- Tracks to save (`track_uris`, list, required): A list of tracks to save (up to 50). Each item can be a Spotify track link, a spotify:track: URI, or a track ID. Build the list with a Create a list step.

**Outputs**

- `count` (number): How many tracks were saved.
- `saved` (true/false): True when the tracks were saved.

**Example output**

```json
{
  "count": 1,
  "saved": true
}
```

### Search Spotify

Search Spotify for tracks, albums, artists, or playlists by keyword and return the top matches.

**Inputs**

- Search terms (`query`, text, required): What to look for: a song, album, artist, or playlist.
- What to search for (`search_type`, text): Choose the kind of item to search for. One of: `track`, `album`, `artist`, `playlist`. Default: `track`.
- Number of results (`limit`, number): How many results to return (1-50). Defaults to 5. From 1 to 50. Default: `5`.

**Outputs**

- `results` (list): List of matching items.

**Example output**

```json
{
  "results": [
    {
      "artists": [
        "mock_value"
      ],
      "id": "abc123xyz789",
      "name": "Sample Item",
      "type": "track",
      "uri": "spotify:track:abc123xyz"
    }
  ]
}
```
