# Spotify — Pipedream Connect

> Spotify is a digital music service that gives you access to millions of songs.

- API slug: `spotify` (use in MCP headers and tool keys)
- Auth: OAuth (Pipedream-managed)
- Categories: Entertainment
- Website: https://www.spotify.com/
- Managed OAuth scopes: `playlist-read-collaborative` · `playlist-modify-private` · `playlist-modify-public` · `playlist-read-private` · `user-modify-playback-state` · `user-read-currently-playing` · `user-read-playback-state` · `user-read-private` · `user-read-email` · `user-library-modify` · `user-library-read` · `user-follow-modify` · `user-follow-read` · `user-read-recently-played` · `user-top-read` · `streaming` · `app-remote-control` · `ugc-image-upload` · `user-read-playback-position`
- This page (HTML): https://pipedream.com/apps/spotify
- Tools: 20 actions · 4 triggers

## Connect via MCP (recommended)

- Endpoint: `https://remote.mcp.pipedream.net/v3`
- Headers: `Authorization: Bearer <token>` · `x-pd-project-id` · `x-pd-environment` · `x-pd-external-user-id` · `x-pd-app-slug: spotify`

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "spotify",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// e.g. run Add Items to a Playlist:
const result = await mcp.callTool({
  name: "spotify-add-items-to-playlist",
  arguments: {
    playlistId: "Playlist ID",
    uris: ["Track or Episode URIs"],
  },
})
```

Docs: [MCP guide](https://pipedream.com/docs/connect/mcp/developers.md)

## API proxy

For a Spotify endpoint with no pre-built tool, the proxy forwards your request with the connected user's credentials attached.

```bash
# The path segment is the target URL, URL-safe base64 encoded:
# https://api.spotify.com/v1/me

curl "https://api.pipedream.com/v1/connect/{project_id}/proxy/aHR0cHM6Ly9hcGkuc3BvdGlmeS5jb20vdjEvbWU?external_user_id={external_user_id}&account_id=apn_xxxxxxx" \
  -H "Authorization: Bearer {access_token}" \
  -H "x-pd-environment: production"
```

Docs: [API proxy guide](https://pipedream.com/docs/connect/api-proxy.md)

## SDK

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "spotify-add-items-to-playlist",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    spotify: { authProvisionId: "apn_xxxxxxx" },
    playlistId: "Playlist ID",
    uris: ["Track or Episode URIs"],
  },
})
```

Docs: [Managed auth guide](https://pipedream.com/docs/connect/managed-auth/quickstart.md) · [Tools guide](https://pipedream.com/docs/connect/components.md)

## Actions (20)

### `spotify-add-items-to-playlist` — Add Items to a Playlist (Write)

Add one or more items to a user’s playlist. See the docs here.

Full schema: https://pipedream.com/apps/spotify/actions/add-items-to-playlist.md

### `spotify-create-playlist` — Create a Playlist (Write)

Create a playlist for a Spotify user. The playlist will be empty until you add tracks. See the docs here.

Full schema: https://pipedream.com/apps/spotify/actions/create-playlist.md

### `spotify-get-categorys-playlist` — Get a Category's Playlists (Read-only)

Get a list of Spotify playlists tagged with a particular category. See the docs here.

Full schema: https://pipedream.com/apps/spotify/actions/get-categorys-playlist.md

### `spotify-get-playlist` — Get a Playlist (Read-only)

Get a playlist owned by a Spotify user. See the documentation.

Full schema: https://pipedream.com/apps/spotify/actions/get-playlist.md

### `spotify-get-playlist-items` — Get a Playlist's Items (Read-only)

Get full details of the items of a playlist owned by a Spotify user. See the docs here.

Full schema: https://pipedream.com/apps/spotify/actions/get-playlist-items.md

### `spotify-get-track` — Get a Track (Read-only)

Get a track by its name or ID. See the docs here

Full schema: https://pipedream.com/apps/spotify/actions/get-track.md

### `spotify-get-album-tracks` — Get Album Tracks (Read-only)

Get all tracks in an album. See the docs here

Full schema: https://pipedream.com/apps/spotify/actions/get-album-tracks.md

### `spotify-get-all-tracks-by-artist` — Get All Tracks by Artist (Read-only)

Get Spotify tracks information related with an artist's. see docs here.

Full schema: https://pipedream.com/apps/spotify/actions/get-all-tracks-by-artist.md

### `spotify-get-artist-top-tracks` — Get an Artist's Top Tracks (Read-only)

Get Spotify catalog information about an artist's top tracks by country. See the docs here.

Full schema: https://pipedream.com/apps/spotify/actions/get-artist-top-tracks.md

### `spotify-get-audio-features-for-a-track` — Get Audio Features for a Track (Read-only)

Get audio feature information for a single track identified by its unique Spotify ID. See the docs here.

Full schema: https://pipedream.com/apps/spotify/actions/get-audio-features-for-a-track.md

### `spotify-get-currently-playing-track` — Get currently playing track (Read-only)

Get the object currently being played on the user's Spotify account. See the documentation

Full schema: https://pipedream.com/apps/spotify/actions/get-currently-playing-track.md

### `spotify-get-recommendations` — Get Recommendations (Write)

Create a list of recommendations based on the available information for a given seed entity and matched against similar artists and tracks. If there is sufficient information about the provided seeds, a list of tracks will be returned together with pool size details. See the docs here.

Full schema: https://pipedream.com/apps/spotify/actions/get-recommendations.md

### `spotify-list-category-id-options` — List Category ID Options (Read-only)

Retrieves available options for the Category ID field.

Full schema: https://pipedream.com/apps/spotify/actions/list-category-id-options.md

### `spotify-list-playlist-id-options` — List Playlist ID Options (Read-only)

Retrieves available options for the Playlist ID field.

Full schema: https://pipedream.com/apps/spotify/actions/list-playlist-id-options.md

### `spotify-list-genres-options` — List Seed Genres Options (Read-only)

Retrieves available options for the Seed Genres field.

Full schema: https://pipedream.com/apps/spotify/actions/list-genres-options.md

### `spotify-list-saved-user-tracks-id-options` — List Track ID Options (Read-only)

Retrieves available options for the Track ID field.

Full schema: https://pipedream.com/apps/spotify/actions/list-saved-user-tracks-id-options.md

### `spotify-remove-items-from-playlist` — Remove Items from a Playlist (Write)

Remove one or more items from a user's playlist. See the docs here

Full schema: https://pipedream.com/apps/spotify/actions/remove-items-from-playlist.md

### `spotify-remove-user-saved-tracks` — Remove User's Saved Tracks (Write)

Remove one or more tracks from the current user's 'Your Music' library. See the docs here

Full schema: https://pipedream.com/apps/spotify/actions/remove-user-saved-tracks.md

### `spotify-save-track` — Save Tracks for User (Write)

Save one or more tracks to the current user's "Your Music" library. See the docs here.

Full schema: https://pipedream.com/apps/spotify/actions/save-track.md

### `spotify-search` — Search (Read-only)

Search for items on Spotify (tracks, albums, artists, playlists, shows, or episodes). See the docs here

Full schema: https://pipedream.com/apps/spotify/actions/search.md

## Triggers (4)

### `spotify-new-playlist` — New Playlist (Polling)

Emit new event when a new playlist is created or followed by the current Spotify user.

Full schema: https://pipedream.com/apps/spotify/triggers/new-playlist.md

### `spotify-new-saved-track` — New Saved Track (Polling)

Emit new event for each new track saved to the current Spotify user's Music Library.

Full schema: https://pipedream.com/apps/spotify/triggers/new-saved-track.md

### `spotify-new-track-by-artist` — New Track by Artist (Polling)

Emit new event for each new Spotify track related with an artist. See the documentation

Full schema: https://pipedream.com/apps/spotify/triggers/new-track-by-artist.md

### `spotify-new-track-in-playlist` — New Track in Playlist (Polling)

Emit new event for each new Spotify track added to a playlist

Full schema: https://pipedream.com/apps/spotify/triggers/new-track-in-playlist.md

---

- All apps: https://pipedream.com/apps — index: https://pipedream.com/llms.txt
- Pipedream docs for agents: https://pipedream.com/docs/llms.txt
