Skip to main content

Users

getUser​

getUser(params)​

Get a user.

Example:

const { data: user } = await audiusSdk.users.getUser({
id: 'eAZl3',
})

console.log(user)

Params​

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

NameTypeDescriptionRequired?
idstringThe ID of the userRequired

Returns​

Returns a Promise containing an object with a data field. data contains information about the user as described below.

{
albumCount: number;
artistPickTrackId?: string;
bio?: string;
coverPhoto?: {
_2000?: string;
_640?: string;
};
doesFollowCurrentUser?: boolean;
ercWallet: string;
followeeCount: number;
followerCount: number;
handle: string;
id: string;
isAvailable: boolean;
isDeactivated: boolean;
isVerified: boolean;
location?: string;
name: string;
playlistCount: number;
profilePicture?: {
_1000x1000?: string;
_150x150?: string;
_480x480?: string;
};
repostCount: number;
splWallet: string;
supporterCount: number;
supportingCount: number;
totalAudioBalance: number;
trackCount: number;
};

getBulkUsers​

getBulkUser(params)​

Gets a list of users.

Example:

const { data: users } = await audiusSdk.users.getBulkUsers({
id: ['eAZl3', 'v7O9O'],
})

console.log(users)

Params​

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

NameTypeDescriptionRequired?
idstring[]The IDs of the usersRequired

Returns​

Returns an array of users, see getUser.


getAIAttributedTracksByUserHandle​

getAIAttributedTracksByUserHandle(params)​

Get the AI generated tracks attributed to a user using the user's handle.

Example:

const { data: tracks } = await audiusSdk.users.getAIAttributedTracksByUserHandle({
handle: '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.

NameTypeDescriptionRequired?
handlestringThe handle of the userRequired
limitnumberThe maximum number of tracks to return. Default value is 10Optional
offsetnumberThe offset to apply to the list of results. Default value is 0Optional
filterTracksGetAIAttributedTracksByUserHandleFilterTracksEnum (can be imported from @audius/sdk)A filter to apply to the returned tracks. Default value is GetAIAttributableTracksByUserHandleFilterTracksEnum.AllOptional
querystringA query to search for in a user's tracksOptional
sortDirectionGetAIAttributedTracksByUserHandleSortDirectionEnum (can be imported from @audius/sdk)A sort direction to apply to the returned tracks. Default value is GetAIAttributableTracksByUserHandleSortDirectionEnum.AscOptional
sortMethodGetAIAttributedTracksByUserTracksByUserHandleSortMethodEnum (can be imported from @audius/sdk)A sort method to apply to the returned tracksOptional

Returns​

The return type is the same as getBulkTracks


getAuthorizedApps​

getAuthorizedApps(params)​

Get the apps that a user has authorized to write to their account.

Example:

const { data: apps } = await audiusSdk.users.getAuthorizedApps({
id: 'eAZl3',
})

console.log(apps)

Params​

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

NameTypeDescriptionRequired?
idstringThe ID of the userRequired

Returns​

Returns a Promise containing an object with a data field. data is an array of items containing information about the authorized apps as described below.

{
address: string;
description?: string;
grantCreatedAt: string;
grantUpdatedAt: string;
grantorUserId: string;
name: string;
}[];

getConnectedWallets​

getConnectedWallets(params)​

Get a user's connected ERC and SPL wallets.

Example:

const { data: wallets } = await audiusSdk.users.getConnectedWallets({
id: 'eAZl3',
})

console.log(wallets)

Params​

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

NameTypeDescriptionRequired?
idstringThe ID of the userRequired

Returns​

Returns a Promise containing an object with a data field. data is an object containing information about the wallets as described below.

{
ercWallets: string[];
splWallets: string[];
};

getDeveloperApps​

getDeveloperApps(params)​

Get the developer apps a user owns.

Example:

const { data: developerApps } = await audiusSdk.users.getDeveloperApps({
id: 'eAZl3',
})

console.log(developerApps)

Params​

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

NameTypeDescriptionRequired?
idstringThe ID of the userRequired

Returns​

Returns a Promise containing an object with a data field. data is an array of items containing information about the developer apps as described below.

{
address: string;
description?: string;
name: string;
userId: string;
}[];

getFavorites​

getFavorites(params)​

Get a user's favorites.

Example:

const { data: favorites } = await audiusSdk.users.getFavorites({
id: 'eAZl3',
})

console.log(favorites)

Params​

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

NameTypeDescriptionRequired?
idstringThe ID of the userRequired

Returns​

Returns a Promise containing an object with a data field. data is an array of items containing information about the favorites as described below.

{
createdAt: string
favoriteItemId: string // The ID of the track, playlist, or album
favoriteType: string // The type of favorite ("track", "playlist", or "album")
userId: string
}
;[]

getFollowers​

getFollowers(params)​

Get a user's followers

Example:

const { data: followers } = await audiusSdk.users.getFollowers({
id: 'eAZl3',
})

console.log(followers)

Params​

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

NameTypeDescriptionRequired?
idstringThe ID of the userRequired
limitnumberThe maximum number of followers to return. Default value is 10Optional
offsetnumberThe offset to apply to the list of results. Default value is 0Optional

Returns​

Returns a Promise containing an object with a data field. data is an array of items containing information about the followers as described below.

{
albumCount: number;
artistPickTrackId?: string;
bio?: string;
coverPhoto?: {
_2000?: string;
_640?: string;
};
doesFollowCurrentUser?: boolean;
ercWallet: string;
followeeCount: number;
followerCount: number;
handle: string;
id: string;
isAvailable: boolean;
isDeactivated: boolean;
isVerified: boolean;
location?: string;
name: string;
playlistCount: number;
profilePicture?: {
_1000x1000?: string;
_150x150?: string;
_480x480?: string;
};
repostCount: number;
splWallet: string;
supporterCount: number;
supportingCount: number;
totalAudioBalance: number;
trackCount: number;
}[];

getFollowing​

getFollowing(params)​

Get users that a user is following

Example:

const { data: following } = await audiusSdk.users.getFollowing({
id: 'eAZl3',
})

console.log(following)

Params​

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

NameTypeDescriptionRequired?
idstringThe ID of the userRequired
limitnumberThe maximum number of users to return. Default value is 10Optional
offsetnumberThe offset to apply to the list of results. Default value is 0Optional

Returns​

The return type is the same as getFollowers


getRelatedUsers​

getRelatedUsers(params)​

Get a list of users that might be of interest to followers of this user.

Example:

const { data: relatedUsers } = await audiusSdk.users.getRelatedUsers({
id: 'eAZl3',
})

console.log(relatedUsers)

Params​

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

NameTypeDescriptionRequired?
idstringThe ID of the userRequired
limitnumberThe maximum number of users to return. Default value is 10Optional
offsetnumberThe offset to apply to the list of results. Default value is 0Optional

Returns​

The return type is the same as getFollowers


getReposts(params)​

Get a user's reposts.

Example:

const { data: reposts } = await audiusSdk.users.getReposts({
id: 'eAZl3',
})

console.log(reposts)

Params​

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

NameTypeDescriptionRequired?
idstringThe ID of the userRequired
limitnumberThe maximum number of reposts to return. Default value is 100Optional
offsetnumberThe offset to apply to the list of results. Default value is 0Optional

Returns​

Returns a Promise containing an object with a data field. data is an array of items containing information about the reposts as described below.

Return type:

{
item?: {
id: string;
}; // The entire item is returned, always contains id
itemType?: string; // The type of the item ("track", "playlist", or "album")
timestamp?: string;
}[];

getSubscribers​

getSubscribers(params)​

Get users that are subscribed to a user.

Example:

const { data: subscribers } = await audiusSdk.users.getSubscribers({
id: 'eAZl3',
})

console.log(subscribers)

Params​

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

NameTypeDescriptionRequired?
idstringThe ID of the userRequired
limitnumberThe maximum number of users to return. Default value is 10Optional
offsetnumberThe offset to apply to the list of results. Default value is 0Optional

Returns​

The return type is the same as getFollowers


getSupporters​

getSupporters(params)​

Get users that are supporting a user (they have sent them a tip).

Example:

const { data: supporters } = await audiusSdk.users.getSupporters({
id: 'eAZl3',
})

console.log(supporters)

Params​

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

NameTypeDescriptionRequired?
idstringThe ID of the userRequired
limitnumberThe maximum number of users to return. Default value is 10Optional
offsetnumberThe offset to apply to the list of results. Default value is 0Optional

Returns​

Returns​

Returns a Promise containing an object with a data field. data is an array of items containing information about the supporters as described below.

{
amount: string;
rank: number;
sender: {
albumCount: number;
artistPickTrackId?: string;
bio?: string;
coverPhoto?: {
_2000?: string;
_640?: string;
};
doesFollowCurrentUser?: boolean;
ercWallet: string;
followeeCount: number;
followerCount: number;
handle: string;
id: string;
isAvailable: boolean;
isDeactivated: boolean;
isVerified: boolean;
location?: string;
name: string;
playlistCount: number;
profilePicture?: {
_1000x1000?: string;
_150x150?: string;
_480x480?: string;
};
repostCount: number;
splWallet: string;
supporterCount: number;
supportingCount: number;
totalAudioBalance: number;
trackCount: number;
};
}[];

getSupportings​

getSupportings(params)​

Get users that a user is supporting (they have sent them a tip).

Example:

const { data: supportings } = await audiusSdk.users.getSupportings({
id: 'eAZl3',
})

console.log(supportings)

Params​

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

NameTypeDescriptionRequired?
idstringThe ID of the userRequired
limitnumberThe maximum number of users to return. Default value is 10Optional
offsetnumberThe offset to apply to the list of results. Default value is 0Optional

Returns​

Returns a Promise containing an object with a data field. data is an array of items containing information about the supportings as described below.

{
amount: string;
rank: number;
receiver: {
albumCount: number;
artistPickTrackId?: string;
bio?: string;
coverPhoto?: {
_2000?: string;
_640?: string;
};
doesFollowCurrentUser?: boolean;
ercWallet: string;
followeeCount: number;
followerCount: number;
handle: string;
id: string;
isAvailable: boolean;
isDeactivated: boolean;
isVerified: boolean;
location?: string;
name: string;
playlistCount: number;
profilePicture?: {
_1000x1000?: string;
_150x150?: string;
_480x480?: string;
};
repostCount: number;
splWallet: string;
supporterCount: number;
supportingCount: number;
totalAudioBalance: number;
trackCount: number;
};
}[];

getTopTrackTags​

getTopTrackTags(params)​

Get the most used track tags by a user.

Example:

const { data: tags } = await audiusSdk.users.getTopTrackTags({
id: 'eAZl3',
})

console.log(tags)

Params​

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

NameTypeDescriptionRequired?
idstringThe ID of the userRequired
limitnumberThe maximum number of users to return. Default value is 10Optional
offsetnumberThe offset to apply to the list of results. Default value is 0Optional

Returns​

Returns a Promise containing an object with a data field. data is an array of strings representing the tags

string[]

getTracksByUser​

getTracksByUser(params)​

Get a user's tracks.

Example:

const { data: tracks } = await audiusSdk.users.getTracksByUser({
id: 'eAZl3',
})

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?
idstringThe ID of the userRequired
limitnumberThe maximum number of tracks to return. Default value is 10Optional
offsetnumberThe offset to apply to the list of results. Default value is 0Optional
filterTracksGetTracksByUserFilterTracksEnum (can be imported from @audius/sdk)A filter to apply to the returned tracks. Default value is GetTracksByUserFilterTracksEnum.AllOptional
querystringA query to search for in a user's tracksOptional
sortDirectionGetTracksByUserSortDirectionEnum (can be imported from @audius/sdk)A sort direction to apply to the returned tracks. Default value is GetTracksByUserSortDirectionEnum.AscOptional
sortMethodGetTracksByUserSortMethodEnum (can be imported from @audius/sdk)A sort method to apply to the returned tracksOptional

Returns​

The return type is the same as getBulkTracks


getUserByHandle​

getUserByHandle(params)​

Get a user by their handle.

Example:

const { data: user } = await audiusSdk.users.getUserByHandle({
handle: 'skrillex',
})

console.log(user)

Params​

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

NameTypeDescriptionRequired?
handlestringThe handle of the userRequired

Returns​

The return type is the same as getUser


getUserIdByWallet​

getUserIdByWallet(params)​

Get a user ID by an associated wallet address.

Example:

const { data: userId } = await audiusSdk.users.getUserIdByWallet({
associatedWallet: '6f229f7e8462f198e5be9139175a0b460a9fa35b',
})

console.log(userId)

Params​

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

NameTypeDescriptionRequired?
associatedWalletstringA wallet address associated with the userRequired

Returns​

Returns a Promise containing an object with a data field. data is an object containing the user id as described below.

{
userId: string
}

searchUsers​

searchUsers(params)​

Search for users.

Example:

const { data: users } = await audiusSdk.users.searchUsers({
query: 'skrillex',
})

console.log(users)

Params​

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

NameTypeDescriptionRequired?
querystringThe query for which to searchRequired

Returns​

The return type is the same as getFollowers


updateProfile​

updateProfile(params, advancedOptions?)​

Update a user profile.

Example:

import { Mood, Genre } from '@audius/sdk'
import fs from 'fs'

const profilePicBuffer = fs.readFileSync('path/to/profile-pic.png')

await audiusSdk.users.updateProfile({
userId: '7eP5n',
profilePictureFile: {
buffer: Buffer.from(profilePicBuffer),
name: 'profilePic',
},
metadata: {
bio: 'up and coming artist from the Bronx',
},
onProgress: (progress) => console.log('Progress: ', progress),
})

params​

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

NameTypeDescriptionRequired?
profilePictureFileFileA file to be used as the profile pictureOptional
coverArtFileFileA file to be used as the cover art. This is the header on a profile pageOptional
metadatasee code block belowAn object with details about the userRequired
onProgress(progress: number) => voidA function that will be called with progress events as the image files uploadOptional
userIdstringThe ID of the userRequired
updateProfile metadata payload
{
name?: string;
bio?: string;
location?: string;
isDeactivated?: boolean;
artistPickTrackId?: string;
}

advancedOptions​

You can pass an optional advancedOptions object as the second argument.

Returns​

Returns a Promise containing an object with the block hash (blockHash) and block number (blockNumber) for the transaction.

{
blockHash: string
blockNumber: number
}

followUser​

followUser(params, advancedOptions?)​

Follow a user.

Example:

await audiusSdk.users.followUser({
userId: '7eP5n',
followeeUserId: '2kN2a', // User id to follow
})

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
followeeUserIdstringThe ID of the user to followRequired

advancedOptions​

You can pass an optional advancedOptions object as the second argument.

Returns​

Returns a Promise containing an object with the block hash (blockHash) and block number (blockNumber) for the transaction.

{
blockHash: string
blockNumber: number
}

unfollowUser​

unfollowUser(params, advancedOptions?)​

Unfollow a user.

Example:

await audiusSdk.users.unfollowUser({
userId: '7eP5n',
followeeUserId: '2kN2a', // User id to unfollow
})

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
followeeUserIdstringThe ID of the user to unfollowRequired

advancedOptions​

You can pass an optional advancedOptions object as the second argument.

Returns​

Returns a Promise containing an object with the block hash (blockHash) and block number (blockNumber) for the transaction.

{
blockHash: string
blockNumber: number
}

subscribeToUser​

subscribeToUser(params, advancedOptions?)​

Subscribe to a user.

Example:

await audiusSdk.users.subscribeToUser({
userId: '7eP5n',
subscribeeUserId: '2kN2a', // User id to subscribe to
})

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
subscribeeUserIdstringThe ID of the user to subscribe toRequired

`advancedOptions​

You can pass an optional advancedOptions object as the second argument.

Returns​

Returns a Promise containing an object with the block hash (blockHash) and block number (blockNumber) for the transaction.

{
blockHash: string
blockNumber: number
}

unsubscribeFromUser​

unsubscribeFromUser(params, advancedOptions?)​

Unsubscribe from a user.

Example:

await audiusSdk.users.unsubscribeFromUser({
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.

NameTypeDescriptionRequired?
userIdstringThe ID of the userRequired
subscribeeUserIdstringThe ID of the user to unsubscribe fromRequired

advancedOptions​

You can pass an optional advancedOptions object as the second argument.

Returns​

Returns a Promise containing an object with the block hash (blockHash) and block number (blockNumber) for the transaction.

{
blockHash: string
blockNumber: number
}