Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

getPlaylist

getPlaylist(params)

Get a playlist by id.

Example:

const { data: playlist } = await audiusSdk.playlists.getPlaylist({
  playlistId: 'D7KyD',
})
 
console.log(playlist)

Params

Create an object with the following fields and pass it as the first argument, as shown in the example above.

NameTypeDescriptionRequired?
playlistIdstringThe ID of the playlistRequired

Returns

Returns a Promise containing an object with a data field. data contains a PlaylistResponse object.


getBulkPlaylists

getBulkPlaylists(params)

Get a list of playlists by ID, UPC, or permalink.

Example:

const { data: playlists } = await audiusSdk.playlists.getBulkPlaylists({
  id: ['D7KyD', '68yPZb'],
})
 
console.log(playlists)

Params

Create an object with the following fields and pass it as the first argument, as shown in the example above.

NameTypeDescriptionRequired?
idstring[]An array of playlist IDsOptional
permalinkstring[]An array of permalinks of playlistsOptional
upcstring[]An array of UPC codesOptional
userIdstringThe ID of the user making the requestOptional

Returns

Returns a Promise containing an object with a data field. data is an array of PlaylistResponse objects.


getPlaylistTracks

getPlaylistTracks(params)

Get the tracks in a playlist.

Example:

const { data: tracks } = await audiusSdk.playlists.getPlaylistTracks({
  playlistId: 'D7KyD',
})
 
console.log(tracks)

Params

Create an object with the following fields and pass it as the first argument, as shown in the example above.

NameTypeDescriptionRequired?
playlistIdstringThe ID of the playlistRequired

Returns

The return type is the same as getBulkTracks


getTrendingPlaylists

getTrendingPlaylists(params?)

Get the top trending playlists on Audius.

Example:

const { data: playlists } = await audiusSdk.playlists.getTrendingPlaylists()
 
console.log(playlists)

Params

Create an object with the following fields and pass it as the first argument, as shown in the example above.

NameTypeDescriptionRequired?
timeGetTrendingPlaylistsTimeEnumThe time period for trending playlists. Default: 'week'Optional

Returns

Returns a Promise containing an object with a data field. data is an array of PlaylistResponse objects.


searchPlaylists

searchPlaylists(params)

Search for playlists.

Example:

const { data: playlists } = await audiusSdk.playlists.searchPlaylists({
  query: 'skrillex',
})
 
console.log(playlists)

Params

Create an object with the following fields and pass it as the first argument, as shown in the example above.

NameTypeDescriptionRequired?
querystringThe query to search forRequired

Returns

Returns a Promise containing an object with a data field. data is an array of PlaylistResponse objects.


createPlaylist

createPlaylist(params, requestInit?)

Create a new playlist.

To upload a cover image, use the Uploads API. Upload your image first to obtain a CID, then pass it as playlistImageSizesMultihash in the metadata object.

Example:

// Optional: Upload a cover image first
const { start: startImageUpload } = audiusSdk.uploads.createImageUpload({
  file: coverImageFile,
})
const coverArtCid = await startImageUpload()
 
const { data } = await audiusSdk.playlists.createPlaylist({
  userId: '7eP5n',
  metadata: {
    playlistName: 'Summer Vibes 2024',
    description: 'The best summer tracks',
    playlistContents: [
      { trackId: 'ePR5Ll', timestamp: Math.round(Date.now() / 1000) },
      { trackId: 'GManBz', timestamp: Math.round(Date.now() / 1000) },
    ],
    playlistImageSizesMultihash: coverArtCid,
  },
})
 
console.log('New playlist ID:', data.playlistId)

Params

Create an object with the following fields and pass it as the first argument, as shown in the example above.

NameTypeDescriptionRequired?
userIdstringThe ID of the userRequired
metadataCreatePlaylistRequestBodyThe playlist metadataRequired

See CreatePlaylistRequestBody for all available metadata fields.

You can pass an optional RequestInit object as the second argument to customize the underlying fetch request (e.g. set custom headers, abort signal, etc.).

Returns

Returns a Promise resolving to an object with the following fields:

{
  playlistId?: string
  transactionHash?: string
}

updatePlaylist

updatePlaylist(params, requestInit?)

Update an existing playlist's metadata. If any metadata fields are not provided, their values will be kept the same as before. To replace cover art, upload a new image via the Uploads API and pass the new CID in metadata.

Example:

// Optional: Upload a new cover image
const { start: startImageUpload } = audiusSdk.uploads.createImageUpload({
  file: newCoverImageFile,
})
const coverArtCid = await startImageUpload()
 
const { data } = await audiusSdk.playlists.updatePlaylist({
  playlistId: 'D7KyD',
  userId: '7eP5n',
  metadata: {
    playlistName: 'Summer Vibes 2024 (Updated)',
    description: 'Updated playlist description',
    playlistContents: [
      { trackId: 'ePR5Ll', timestamp: Math.round(Date.now() / 1000) },
      { trackId: 'GManBz', timestamp: Math.round(Date.now() / 1000) },
      { trackId: 'KWJm0x', timestamp: Math.round(Date.now() / 1000) },
    ],
    playlistImageSizesMultihash: coverArtCid,
  },
})
 
console.log('Updated playlist:', data)

Params

Create an object with the following fields and pass it as the first argument, as shown in the example above.

NameTypeDescriptionRequired?
playlistIdstringThe ID of the playlistRequired
userIdstringThe ID of the userRequired
metadataUpdatePlaylistRequestBodyThe playlist metadata to updateRequired

All fields are optional — only include the fields you want to change. See UpdatePlaylistRequestBody for all available fields.

You can pass an optional RequestInit object as the second argument to customize the underlying fetch request (e.g. set custom headers, abort signal, etc.).

Returns

Returns a Promise resolving to an object with the following fields:

{
  transactionHash?: string
}

deletePlaylist

deletePlaylist(params, requestInit?)

Delete a playlist.

Example:

await audiusSdk.playlists.deletePlaylist({
  playlistId: 'D7KyD',
  userId: '7eP5n',
})

Params

Create an object with the following fields and pass it as the first argument, as shown in the example above.

NameTypeDescriptionRequired?
playlistIdstringThe ID of the playlistRequired
userIdstringThe ID of the userRequired

You can pass an optional RequestInit object as the second argument to customize the underlying fetch request (e.g. set custom headers, abort signal, etc.).

Returns

Returns a Promise resolving to an object with the following fields:

{
  transactionHash?: string
}

favoritePlaylist

favoritePlaylist(params, requestInit?)

Favorite a playlist.

Example:

await audiusSdk.playlists.favoritePlaylist({
  playlistId: 'D7KyD',
  userId: '7eP5n',
})

Params

Create an object with the following fields and pass it as the first argument, as shown in the example above.

NameTypeDescriptionRequired?
playlistIdstringThe ID of the playlistRequired
userIdstringThe ID of the userRequired

You can pass an optional RequestInit object as the second argument to customize the underlying fetch request (e.g. set custom headers, abort signal, etc.).

Returns

Returns a Promise resolving to an object with the following fields:

{
  transactionHash?: string
}

unfavoritePlaylist

unfavoritePlaylist(params, requestInit?)

Unfavorite a playlist.

Example:

await audiusSdk.playlists.unfavoritePlaylist({
  playlistId: 'D7KyD',
  userId: '7eP5n',
})

Params

Create an object with the following fields and pass it as the first argument, as shown in the example above.

NameTypeDescriptionRequired?
playlistIdstringThe ID of the playlistRequired
userIdstringThe ID of the userRequired

You can pass an optional RequestInit object as the second argument to customize the underlying fetch request (e.g. set custom headers, abort signal, etc.).

Returns

Returns a Promise resolving to an object with the following fields:

{
  transactionHash?: string
}

repostPlaylist

repostPlaylist(params, requestInit?)

Repost a playlist.

Example:

await audiusSdk.playlists.repostPlaylist({
  playlistId: 'D7KyD',
  userId: '7eP5n',
})

Params

Create an object with the following fields and pass it as the first argument, as shown in the example above.

NameTypeDescriptionRequired?
playlistIdstringThe ID of the playlistRequired
userIdstringThe ID of the userRequired

You can pass an optional RequestInit object as the second argument to customize the underlying fetch request (e.g. set custom headers, abort signal, etc.).

Returns

Returns a Promise resolving to an object with the following fields:

{
  transactionHash?: string
}

unrepostPlaylist

unrepostPlaylist(params, requestInit?)

Unrepost a playlist.

Example:

await audiusSdk.playlists.unrepostPlaylist({
  playlistId: 'D7KyD',
  userId: '7eP5n',
})

Params

Create an object with the following fields and pass it as the first argument, as shown in the example above.

NameTypeDescriptionRequired?
playlistIdstringThe ID of the playlistRequired
userIdstringThe ID of the userRequired

You can pass an optional RequestInit object as the second argument to customize the underlying fetch request (e.g. set custom headers, abort signal, etc.).

Returns

Returns a Promise resolving to an object with the following fields:

{
  transactionHash?: string
}

Type Reference

PlaylistResponse

FieldTypeDescription
artworkobjectArtwork images (see below)
artwork._1000x1000stringURL of 1000x1000 artwork
artwork._150x150stringURL of 150x150 artwork
artwork._480x480stringURL of 480x480 artwork
coverArtSizesstringCID of the cover art sizes
descriptionstringPlaylist description
favoriteCountnumberNumber of favorites
idstringPlaylist ID
isAlbumbooleanWhether this is an album
isImageAutogeneratedbooleanWhether the cover art is auto-generated
isPrivatebooleanWhether the playlist is private
permalinkstringPermalink URL
playlistContentsobject[]Array of track entries (trackId, timestamp, metadataTimestamp)
playlistNamestringName of the playlist
repostCountnumberNumber of reposts
totalPlayCountnumberTotal play count
userobjectThe playlist owner (see User)

GetTrendingPlaylistsTimeEnum

ValueStringDescription
Week'week'Past week (default)
Month'month'Past month
Year'year'Past year
AllTime'allTime'All time

CreatePlaylistRequestBody

FieldTypeRequiredDescription
playlistNamestringYesThe name of the playlist
playlistIdstringNoOptional playlist ID (auto-generated if not provided)
playlistImageSizesMultihashstringNoCID of the cover art image (from Uploads API)
descriptionstringNoThe playlist description
isAlbumbooleanNoWhether this is an album
isPrivatebooleanNoWhether the playlist is private
genreGenreNoPlaylist/album genre
moodMoodNoPlaylist/album mood
tagsstringNoComma-separated tags
licensestringNoLicense type
upcstringNoUniversal Product Code (for albums)
releaseDateDateNoRelease date
playlistContentsPlaylistAddedTimestamp[]NoArray of tracks to include in the playlist
isStreamGatedbooleanNoWhether streaming is behind an access gate
isScheduledReleasebooleanNoWhether this is a scheduled release
streamConditionsAccessGateNoConditions for stream access gating
ddexAppstringNoDDEX application identifier
ddexReleaseIdsobjectNoDDEX release identifiers
artistsDdexResourceContributor[]NoDDEX resource contributors / artists
copyrightLineobjectNoCopyright line
producerCopyrightLineobjectNoProducer copyright line
parentalWarningTypestringNoParental warning type
isImageAutogeneratedbooleanNoWhether the image is autogenerated

UpdatePlaylistRequestBody

All fields are optional — only include the fields you want to change.

FieldTypeRequiredDescription
playlistNamestringNoThe name of the playlist
playlistImageSizesMultihashstringNoCID of the cover art image (from Uploads API)
descriptionstringNoThe playlist description
isAlbumbooleanNoWhether this is an album
isPrivatebooleanNoWhether the playlist is private
genreGenreNoPlaylist/album genre
moodMoodNoPlaylist/album mood
tagsstringNoComma-separated tags
licensestringNoLicense type
upcstringNoUniversal Product Code (for albums)
releaseDateDateNoRelease date
playlistContentsPlaylistAddedTimestamp[]NoArray of tracks in the playlist (replaces all)
isStreamGatedbooleanNoWhether streaming is behind an access gate
isScheduledReleasebooleanNoWhether this is a scheduled release
streamConditionsAccessGateNoConditions for stream access gating
ddexAppstringNoDDEX application identifier
ddexReleaseIdsobjectNoDDEX release identifiers
artistsDdexResourceContributor[]NoDDEX resource contributors / artists
copyrightLineobjectNoCopyright line
producerCopyrightLineobjectNoProducer copyright line
parentalWarningTypestringNoParental warning type
isImageAutogeneratedbooleanNoWhether the image is autogenerated

PlaylistAddedTimestamp

Represents a track entry within a playlist.

FieldTypeRequiredDescription
trackIdstringYesThe ID of the track
timestampnumberYesTimestamp when the track was added (seconds)
metadataTimestampnumberNoOptional metadata timestamp (seconds)