getTrack
getTrack(
params,requestInit?)
Get a track by id.
Example:
const { data: track } = await audiusSdk.tracks.getTrack({
trackId: 'D7KyD',
})
console.log(track)Params
Create an object with the following fields and pass it as the first argument, as shown in the example above.
| Name | Type | Description | Required? |
|---|---|---|---|
trackId | string | The ID of the track | Required |
userId | string | The ID of the user making the request | Optional |
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 containing an object with a data field. data contains a
TrackResponse object.
getBulkTracks
getBulkTracks(
params,requestInit?)
Get a list of tracks using their IDs or permalinks.
Example:
const { data: tracks } = await audiusSdk.tracks.getBulkTracks({
id: ['D7KyD', 'PjdWN', 'Jwo2A'],
})
console.log(tracks)Params
Create an object with the following fields and pass it as the first argument, as shown in the example above.
| Name | Type | Description | Required? |
|---|---|---|---|
id | string[] | An array of IDs of tracks | Optional |
permalink | string[] | An array of permalinks of tracks | Optional |
userId | string | The ID of the user making the request | Optional |
isrc | string[] | An array of ISRC codes to query tracks by | Optional |
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 containing an object with a data field. data is an array of
TrackResponse objects.
getTrendingTracks
getTrendingTracks(
params,requestInit?)
Get the top 100 trending (most popular) tracks on Audius.
Example:
const { data: tracks } = await audiusSdk.tracks.getTrendingTracks()
console.log(tracks)Params
Optionally create an object with the following fields and pass it as the first argument, as shown in the example above.
| Name | Type | Description | Required? |
|---|---|---|---|
genre | Genre | If provided, the top 100 trending tracks of the genre will be returned | Optional |
time | 'week' | 'month' | 'year' | 'allTime' | A time range for which to return the trending tracks. Default value is 'allTime' | Optional |
offset | number | The number of items to skip (for pagination) | Optional |
limit | number | The number of items to fetch (for pagination) | Optional |
userId | string | The ID of the user making the request | Optional |
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 containing an object with a data field. data is an array of
TrackResponse objects.
getUndergroundTrendingTracks
getUndergroundTrendingTracks(
params,requestInit?)
Get the top 100 trending underground tracks on Audius.
Example:
const { data: tracks } = await audiusSdk.tracks.getUndergroundTrendingTracks()
console.log(tracks)Params
Optionally create an object with the following fields and pass it as the first argument, as shown in the example above.
| Name | Type | Description | Required? |
|---|---|---|---|
limit | number | If provided, will return only the given number of tracks. Default is 100 | Optional |
offset | number | An offset to apply to the list of results. Default value is 0 | Optional |
userId | string | The ID of the user making the request | Optional |
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 containing an object with a data field. data is an array of
TrackResponse objects.
searchTracks
searchTracks(
params,requestInit?)
Search for tracks.
Example:
const { data: tracks } = await audiusSdk.tracks.searchTracks({
query: 'skrillex',
})
console.log(tracks)Params
Create an object with the following fields and pass it as the first argument, as shown in the example above.
| Name | Type | Description | Required? |
|---|---|---|---|
query | string | The query to search for | Optional |
offset | number | The number of items to skip (for pagination) | Optional |
limit | number | The number of items to fetch (for pagination) | Optional |
genre | Genre[] | Array of genres to filter by | Optional |
sortMethod | string | Sort method: 'relevant', 'popular', or 'recent' | Optional |
mood | Mood[] | Array of moods to filter by | Optional |
onlyDownloadable | string | Filter to only downloadable tracks | Optional |
includePurchaseable | string | Include purchaseable tracks in results | Optional |
isPurchaseable | string | Filter to only purchaseable tracks | Optional |
hasDownloads | string | Filter tracks that have stems/downloads | Optional |
key | string[] | Array of musical keys to filter by (e.g., ['C', 'Am']) | Optional |
bpmMin | string | Minimum BPM to filter by | Optional |
bpmMax | string | Maximum BPM to filter by | Optional |
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 containing an object with a data field. data is an array of
TrackResponse objects.
createTrack
createTrack(
params,requestInit?)
Create a track by registering its metadata on the protocol. This method accepts metadata including CIDs (Content Identifiers) that reference previously uploaded files — it does not accept raw audio or image files directly.
Example:
import fs from 'fs'
// First, upload files using the Uploads API
const trackBuffer = fs.readFileSync('path/to/track.mp3')
const audioUpload = audiusSdk.uploads.createAudioUpload({
file: {
buffer: Buffer.from(trackBuffer),
name: 'track.mp3',
type: 'audio/mpeg',
},
})
const audioResult = await audioUpload.start()
const coverArtBuffer = fs.readFileSync('path/to/cover-art.png')
const imageUpload = audiusSdk.uploads.createImageUpload({
file: {
buffer: Buffer.from(coverArtBuffer),
name: 'cover-art.png',
type: 'image/png',
},
})
const coverArtCid = await imageUpload.start()
// Then, create the track with the returned CIDs.
// The audio upload result fields (trackCid, origFileCid, etc.) match
// the metadata field names, so you can spread them directly.
const { data } = await audiusSdk.tracks.createTrack({
userId: '7eP5n',
metadata: {
title: 'Monstera',
description: 'Dedicated to my favorite plant',
genre: 'Metal',
mood: 'Aggressive',
...audioResult,
coverArtSizes: coverArtCid,
},
})Params
Create an object with the following fields and pass it as the first argument, as shown in the example above.
| Name | Type | Description | Required? |
|---|---|---|---|
userId | string | The ID of the user | Required |
metadata | CreateTrackRequestBody | An object containing the details of the track | Required |
See CreateTrackRequestBody 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:
{
transactionHash?: string
trackId?: string
}
---
## updateTrack
> #### updateTrack(`params`, `requestInit?`)
Update a track's metadata. If any metadata fields are not provided, their values will be kept the
same as before. To replace audio or cover art, upload new files via the
[Uploads API](/sdk/uploads) and pass the new CIDs in `metadata`.
Example:
```ts
const { data } = await audiusSdk.tracks.updateTrack({
trackId: 'h5pJ3Bz',
userId: '7eP5n',
metadata: {
description: 'Dedicated to my favorite plant... updated!',
mood: 'Yearning',
},
})Params
Create an object with the following fields and pass it as the first argument, as shown in the example above.
| Name | Type | Description | Required? |
|---|---|---|---|
trackId | string | The ID of the track | Required |
userId | string | The ID of the user | Required |
metadata | UpdateTrackRequestBody | An object containing the fields to update | Required |
All fields are optional — only include the fields you want to change. See
UpdateTrackRequestBody 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
}deleteTrack
deleteTrack(
params,requestInit?)
Delete a track
Example:
await audiusSdk.tracks.deleteTrack({
trackId: 'h5pJ3Bz',
userId: '7eP5n',
})Params
Create an object with the following fields and pass it as the first argument, as shown in the example above.
| Name | Type | Description | Required? |
|---|---|---|---|
trackId | string | The ID of the track | Required |
userId | string | The ID of the user | Required |
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
}favoriteTrack
favoriteTrack(
params,requestInit?)
Favorite a track
Example:
await audiusSdk.tracks.favoriteTrack({
trackId: 'x5pJ3Az'
userId: "7eP5n",
});Params
Create an object with the following fields and pass it as the first argument, as shown in the example above.
| Name | Type | Description | Required? |
|---|---|---|---|
trackId | string | The ID of the track | Required |
userId | string | The ID of the user | Required |
metadata | see code block below | Set isSaveOfRepost to true if you are favoriting a reposted track. | Optional |
{
isSaveOfRepost: boolean
}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
}unfavoriteTrack
unfavoriteTrack(
params,requestInit?)
Unfavorite a track
Example:
await audiusSdk.tracks.unfavoriteTrack({
trackId: 'x5pJ3Az'
userId: "7eP5n",
});Params
Create an object with the following fields and pass it as the first argument, as shown in the example above.
| Name | Type | Description | Required? |
|---|---|---|---|
trackId | string | The ID of the track | Required |
userId | string | The ID of the user | Required |
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
}repostTrack
repostTrack(
params,requestInit?)
Repost a track
Example:
await audiusSdk.tracks.repostTrack({
trackId: 'x5pJ3Az'
userId: "7eP5n",
});Params
Create an object with the following fields and pass it as the first argument, as shown in the example above.
| Name | Type | Description | Required? |
|---|---|---|---|
trackId | string | The ID of the track | Required |
userId | string | The ID of the user | Required |
metadata | see code block below | Set isRepostOfRepost to true if you are reposting a reposted track. | Optional |
{
isRepostOfRepost: boolean
}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
}unrepostTrack
unrepostTrack(
params,requestInit?)
Unrepost a track
Example:
await audiusSdk.tracks.unrepostTrack({
trackId: 'x5pJ3Az',
userId: '7eP5n',
})Params
Create an object with the following fields and pass it as the first argument, as shown in the example above.
| Name | Type | Description | Required? |
|---|---|---|---|
trackId | string | The ID of the track | Required |
userId | string | The ID of the user | Required |
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
TrackResponse
| Field | Type | Description |
|---|---|---|
artwork | object | Artwork images (see below) |
artwork._1000x1000 | string | URL of 1000x1000 artwork |
artwork._150x150 | string | URL of 150x150 artwork |
artwork._480x480 | string | URL of 480x480 artwork |
description | string | Track description |
downloadable | boolean | Whether the track is downloadable |
duration | number | Track duration in seconds |
favoriteCount | number | Number of favorites |
genre | Genre | Track genre |
id | string | Track ID |
isStreamable | string | Whether the track is streamable |
mood | Mood | Track mood |
permalink | string | Permalink URL |
playCount | number | Number of plays |
releaseDate | string | Release date |
remixOf | object | Remix parent info (tracks: { parentTrackId: string }[]) |
repostCount | number | Number of reposts |
tags | string[] | Array of tags |
title | string | Track title |
trackCid | string | CID of the track audio |
user | object | The track owner (see User) |
CreateTrackRequestBody
Metadata object for creating a new track. Fields marked Required must be provided.
| Name | Type | Description | Required? |
|---|---|---|---|
title | string | Track title | Required |
genre | Genre | Track genre | Required |
trackCid | string | CID of the transcoded audio (from Uploads API) | Required |
trackId | string | Track ID (auto-generated if not provided) | Optional |
description | string | Track description | Optional |
mood | Mood | Track mood | Optional |
bpm | number | Beats per minute | Optional |
musicalKey | string | Musical key of the track | Optional |
tags | string | Comma-separated tags | Optional |
license | string | License type | Optional |
isrc | string | International Standard Recording Code | Optional |
iswc | string | International Standard Musical Work Code | Optional |
releaseDate | Date | Release date | Optional |
origFileCid | string | CID of the original audio file (from Uploads API) | Optional |
origFilename | string | Original filename of the audio file | Optional |
coverArtSizes | string | CID of the cover art image (from Uploads API) | Optional |
previewCid | string | CID of the preview clip (from Uploads API) | Optional |
previewStartSeconds | number | Preview start time in seconds | Optional |
duration | number | Track duration in seconds | Optional |
isDownloadable | boolean | Whether the track is downloadable | Optional |
isUnlisted | boolean | Whether the track is unlisted (hidden) | Optional |
isStreamGated | boolean | Whether streaming is behind an access gate | Optional |
streamConditions | AccessGate | Conditions for stream access gating | Optional |
downloadConditions | AccessGate | Conditions for download access gating | Optional |
fieldVisibility | FieldVisibility | Controls visibility of individual track fields | Optional |
placementHosts | string | Preferred storage node placement hosts | Optional |
stemOf | StemParent | Parent track if this track is a stem | Optional |
remixOf | RemixParentWrite | Parent track(s) if this track is a remix | Optional |
noAiUse | boolean | Whether AI use is prohibited | Optional |
isOwnedByUser | boolean | Whether the track is owned by the user | Optional |
coverOriginalSongTitle | string | Original song title (for cover tracks) | Optional |
coverOriginalArtist | string | Original artist (for cover tracks) | Optional |
parentalWarningType | string | Parental warning type | Optional |
territoryCodes | string[] | Territory codes for distribution | Optional |
ddexApp | string | DDEX application identifier | Optional |
ddexReleaseIds | object | DDEX release identifiers | Optional |
artists | object[] | DDEX resource contributors / artists | Optional |
resourceContributors | DdexResourceContributor[] | DDEX resource contributors | Optional |
indirectResourceContributors | DdexResourceContributor[] | DDEX indirect resource contributors | Optional |
rightsController | DdexRightsController | DDEX rights controller | Optional |
copyrightLine | CopyrightLine | Copyright line | Optional |
producerCopyrightLine | ProducerCopyrightLine | Producer copyright line | Optional |
UpdateTrackRequestBody
Metadata object for updating an existing track. All fields are optional — only include the fields you want to change. Omitted fields retain their current values.
| Name | Type | Description |
|---|---|---|
title | string | Track title |
genre | Genre | Track genre |
description | string | Track description |
mood | Mood | Track mood |
bpm | number | Beats per minute |
musicalKey | string | Musical key of the track |
tags | string | Comma-separated tags |
license | string | License type |
isrc | string | International Standard Recording Code |
iswc | string | International Standard Musical Work Code |
releaseDate | Date | Release date |
trackCid | string | CID of the transcoded audio (from Uploads API) |
origFileCid | string | CID of the original audio file (from Uploads API) |
origFilename | string | Original filename of the audio file |
coverArtSizes | string | CID of the cover art image (from Uploads API) |
previewCid | string | CID of the preview clip (from Uploads API) |
previewStartSeconds | number | Preview start time in seconds |
duration | number | Track duration in seconds |
isDownloadable | boolean | Whether the track is downloadable |
isUnlisted | boolean | Whether the track is unlisted (hidden) |
isStreamGated | boolean | Whether streaming is behind an access gate |
streamConditions | AccessGate | Conditions for stream access gating |
downloadConditions | AccessGate | Conditions for download access gating |
fieldVisibility | FieldVisibility | Controls visibility of individual track fields |
placementHosts | string | Preferred storage node placement hosts |
stemOf | StemParent | Parent track if this track is a stem |
remixOf | RemixParentWrite | Parent track(s) if this track is a remix |
parentalWarningType | string | Parental warning type |
ddexApp | string | DDEX application identifier |
AccessGate
AccessGate is a union type representing the conditions required to access a gated track. Used by
both streamConditions and downloadConditions. Provide one of the following:
FollowGate
Require the listener to follow a specific user.
{
followUserId: number // The user ID that must be followed
}TipGate
Require the listener to have tipped a specific user.
{
tipUserId: number // The user ID that must be tipped
}PurchaseGate
Require the listener to purchase access with USDC.
{
usdcPurchase: {
price: number // Price in cents
splits: Array<{
userId: number // User ID of the payment recipient
percentage: number // Percentage of the price (0-100)
}>
}
}TokenGate
Require the listener to hold a specific SPL token.
{
tokenGate: {
tokenMint: string // The mint address of the SPL token
tokenAmount: number // The minimum amount of the token required
}
}const metadata = {
title: 'Premium Track',
genre: 'Electronic',
trackCid: '...',
isStreamGated: true,
streamConditions: {
usdcPurchase: {
price: 199, // $1.99 in cents
splits: [{ userId: 12345, percentage: 100 }],
},
},
}FieldVisibility
Controls which track fields are publicly visible. Each field is a boolean.
{
mood: boolean
tags: boolean
genre: boolean
share: boolean
playCount: boolean
remixes: boolean
}RemixParentWrite
Identifies the parent track(s) that a remix is derived from.
{
tracks: Array<{
parentTrackId: string // The ID of the parent track
}>
}const metadata = {
title: 'My Remix',
genre: 'Electronic',
trackCid: '...',
remixOf: {
tracks: [{ parentTrackId: 'D7KyD' }],
},
}StemParent
Identifies the parent track when uploading a stem (e.g. vocals, drums, bass).
{
category: string // Stem category (e.g. 'VOCAL', 'DRUMS', 'BASS', 'INSTRUMENTAL', 'OTHER')
parentTrackId: number // The numeric ID of the parent track
}DdexResourceContributor
Represents a contributor to the track (used for DDEX metadata).
{
name: string // Contributor name
roles: string[] // Contributor roles (e.g. 'Composer', 'Lyricist')
sequenceNumber?: number // Optional ordering index
}DdexRightsController
Represents the rights controller for the track (used for DDEX metadata).
{
name: string // Rights controller name
roles: string[] // Roles (e.g. 'RightsController')
rightsShareUnknown?: string // Optional rights share info
}Genre Values
Valid genre values for the genre field. Use these exact string values:
'Electronic', 'Rock', 'Metal', 'Alternative', 'Hip-Hop/Rap', 'Experimental', 'Punk',
'Folk', 'Pop', 'Ambient', 'Soundtrack', 'World', 'Jazz', 'Acoustic', 'Funk',
'R&B/Soul', 'Devotional', 'Classical', 'Reggae', 'Podcasts', 'Country', 'Spoken Word',
'Comedy', 'Blues', 'Kids', 'Audiobooks', 'Latin', 'Lo-Fi', 'Hyperpop', 'Dancehall',
'Techno', 'Trap', 'House', 'Tech House', 'Deep House', 'Disco', 'Electro', 'Jungle',
'Progressive House', 'Hardstyle', 'Glitch Hop', 'Trance', 'Future Bass', 'Future House',
'Tropical House', 'Downtempo', 'Drum & Bass', 'Dubstep', 'Jersey Club', 'Vaporwave',
'Moombahton'
Mood Values
Valid mood values for the mood field. Use these exact string values:
'Peaceful', 'Romantic', 'Sentimental', 'Tender', 'Easygoing', 'Yearning',
'Sophisticated', 'Sensual', 'Cool', 'Gritty', 'Melancholy', 'Serious', 'Brooding',
'Fiery', 'Defiant', 'Aggressive', 'Rowdy', 'Excited', 'Energizing', 'Empowering',
'Stirring', 'Upbeat', 'Other'