Skip to content

Users

getUser(params, requestInit?)

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

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 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;
};

getMe(requestInit?)

Get the currently authenticated user. Requires authentication.

Example:

const { data: user } = await audiusSdk.users.getMe()
console.log(user)

You can pass an optional RequestInit object as the first 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 with the same shape as getUser.

getBulkUsers(params, requestInit?)

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 usersOptional
userIdstringThe ID of the user making the requestOptional

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 an array of users, see getUser.

getAIAttributedTracksByUserHandle(params, requestInit?)

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

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

The return type is the same as getBulkTracks

getAuthorizedApps(params, requestInit?)

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

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 items containing information about the authorized apps as described below.

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

getConnectedWallets(params, requestInit?)

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

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 object containing information about the wallets as described below.

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

getFavorites(params, requestInit?)

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

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 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(params, requestInit?)

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
userIdstringThe ID of the user making the requestOptional

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 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(params, requestInit?)

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
userIdstringThe ID of the user making the requestOptional

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

The return type is the same as getFollowers

getRelatedUsers(params, requestInit?)

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
userIdstringThe ID of the user making the requestOptional
filterFollowedbooleanFilter to only users that the current user followsOptional

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

The return type is the same as getFollowers

getReposts(params, requestInit?)

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
userIdstringThe ID of the user making the requestOptional

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 items containing information about the reposts as described below.

{
  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(params, requestInit?)

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
userIdstringThe ID of the user making the requestOptional

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

The return type is the same as getFollowers

getSupporters(params, requestInit?)

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
userIdstringThe ID of the user making the requestOptional

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 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;
  };
}[];

getSupportedUsers(params, requestInit?)

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

Example:

const { data: supportedUsers } = await audiusSdk.users.getSupportedUsers({
  id: 'eAZl3',
})
 
console.log(supportedUsers)

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
userIdstringThe ID of the user making the requestOptional

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 items containing information about the supported users 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(params, requestInit?)

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 tags to return. Default value is 10Optional
userIdstringThe ID of the user making the requestOptional

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 strings representing the tags

string[]

getTracksByUser(params, requestInit?)

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

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

The return type is the same as getBulkTracks

getUserByHandle(params, requestInit?)

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
userIdstringThe ID of the user making the requestOptional

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

The return type is the same as getUser

searchUsers(params, requestInit?)

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 searchOptional
offsetnumberThe number of items to skip (for pagination)Optional
limitnumberThe number of items to fetch (for pagination)Optional
genreGenre[]Array of genres to filter byOptional
sortMethodstringSort method: 'relevant', 'popular', or 'recent'Optional
isVerifiedstringFilter to only verified usersOptional

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

The return type is the same as getFollowers

updateUser(params, requestInit?)

Update a user profile. To update a profile picture or cover photo, first upload the image via the Uploads API and pass the resulting CID in metadata.

Example:

import fs from 'fs'
 
// Upload a new profile picture
const profilePicBuffer = fs.readFileSync('path/to/profile-pic.png')
const profilePicUpload = audiusSdk.uploads.createImageUpload({
  file: {
    buffer: Buffer.from(profilePicBuffer),
    name: 'profilePic.png',
  },
})
const profilePicCid = await profilePicUpload.start()
 
await audiusSdk.users.updateUser({
  id: '7eP5n',
  userId: '7eP5n',
  metadata: {
    bio: 'up and coming artist from the Bronx',
    profilePicture: profilePicCid,
  },
})

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
userIdstringThe ID of the user (same as id)Required
metadataUpdateUserRequestBodyAn object with details about the userRequired

UpdateUserRequestBody — all fields are optional, only include the fields you want to change:

NameTypeDescription
namestringDisplay name
handlestringUser handle (set only if not already set)
biostringUser bio
locationstringUser location
websitestringWebsite URL
donationstringDonation link
twitterHandlestringTwitter handle (without @)
instagramHandlestringInstagram handle (without @)
tiktokHandlestringTikTok handle (without @)
profilePicturestringProfile picture CID or URL (from Uploads API)
profilePictureSizesstringProfile picture sizes metadata
coverPhotostringCover photo CID or URL (from Uploads API)
coverPhotoSizesstringCover photo sizes metadata
profileType'label' | nullSet to 'label' for record label profiles
isDeactivatedbooleanWhether the user is deactivated
artistPickTrackIdstringTrack hash ID for artist pick
allowAiAttributionbooleanWhether to allow AI attribution
splUsdcPayoutWalletstringSolana USDC payout wallet address
coinFlairMintstringCoin flair mint address

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
  blockHash?: string
  blockNumber?: number
}

followUser(params, requestInit?)

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

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
  blockHash?: string
  blockNumber?: number
}

unfollowUser(params, requestInit?)

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

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
  blockHash?: string
  blockNumber?: number
}

subscribeToUser(params, requestInit?)

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

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
  blockHash?: string
  blockNumber?: number
}

unsubscribeFromUser(params, requestInit?)

Unsubscribe from a user.

Example:

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

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

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
  blockHash?: string
  blockNumber?: number
}