# Playlists

#### fetchFeaturedPlaylists(): Promise<[IPlaylist](https://spinamp.gitbook.io/spinamp-sdk/reference/types#iplaylist)\[]>

Returns list of playlists, which are currently marked as featured on spinamp.

#### fetchPlaylistById(playlistId: string): Promise<{playlist: [IPlaylist](https://spinamp.gitbook.io/spinamp-sdk/reference/types#iplaylist)\[], playlistTracks: [ITrack](https://spinamp.gitbook.io/spinamp-sdk/reference/types#itrack)\[]}>

Gets playlist by provided playlist id. Returns `playlist` object and list of full tracks belonging to this playlist.

#### fetchCollectorPlaylists(collectorAddress: string): Promise<[IPlaylist](https://spinamp.gitbook.io/spinamp-sdk/reference/types#iplaylist)\[]>

Returns list of playlists created by user with provided address.

#### createPlaylist(playlist: Omit<[IPlaylist](https://spinamp.gitbook.io/spinamp-sdk/reference/types#iplaylist), 'id'>, signer: [Signer](https://docs.ethers.io/v5/api/signer/)): Promise<{id: string}>

Creates a new playlist and returns the playlist id

{% hint style="info" %}
An ethers signer object is required for API authentication
{% endhint %}

```
  const wallet = ethers.Wallet.createRandom();
  const vibeyPlaylist = {
    title: 'vibey',
    trackIds: ['ethereum/0xd5b2c770dc0a9677cf672d53f554f6f806e75e07/1'],
  };

  const {id} = await createPlaylist(vibeyPlaylist, wallet);

```

#### updatePlaylist(id: string, playlist: Partial<[IPlaylist](https://spinamp.gitbook.io/spinamp-sdk/reference/types#iplaylist)>, signer: [Signer](https://docs.ethers.io/v5/api/signer/)): Promise<{id: string; title: string: trackIds: string\[] }>

Updates a playlist and returns the new values

{% hint style="info" %}
Only the signer that created the playlist is able to update it
{% endhint %}

```
  const wallet = ethers.Wallet.createRandom();
  const vibeyPlaylist = {
    id: 'kfF8MuFHmW6MwHIWNKQF',
    title: 'super vibey',
    trackIds: ['ethereum/0xd5b2c770dc0a9677cf672d53f554f6f806e75e07/1'],
  };

  const playlist = await updatePlaylist(vibeyPlaylist.id, vibeyPlaylist, wallet);

```
