Overview
TheAsyncUserService provides operations for retrieving user profile information, managing follows (artists and users), accessing top artists and tracks, and working with playlist followers.
This service is available in both async (
AsyncUserService) and sync (UserService) variants.Get Current User Profile
Retrieve detailed profile information about the currently authenticated user.Returns
Complete user profile with account details.Key fields:
id- User’s Spotify IDdisplay_name- User’s display nameemail- User’s email address (requiresuser-read-emailscope)country- User’s countryproduct- Subscription level (“premium”, “free”, etc.)followers- Follower countimages- Profile imagesexternal_urls- Links to Spotify profile
Example
Get Top Artists
Retrieve the current user’s top artists based on listening history.Time period over which affinities are computed.Valid values:
"long_term"- Calculated from several years of data"medium_term"- Approximately last 6 months (default)"short_term"- Approximately last 4 weeks
Maximum number of artists to return. Default: 20. Range: 1-50.
Index of the first artist to return. Default: 0.
Returns
Paginated list of the user’s top artists, ordered by affinity.
Example
Get Top Tracks
Retrieve the current user’s top tracks based on listening history.Time period for affinity calculation.Values:
"long_term", "medium_term" (default), "short_term"Maximum tracks to return. Default: 20. Range: 1-50.
Index of first track. Default: 0.
Returns
Paginated list of the user’s top tracks, ordered by affinity.
Example
Follow Playlist
Add the current user as a follower of a playlist.The Spotify ID of the playlist to follow.
If
True, the playlist is included in user’s public playlists. If False, it remains private.Example
Unfollow Playlist
Remove the current user as a follower of a playlist.The Spotify ID of the playlist to unfollow.
Example
Get Followed Artists
Retrieve the current user’s followed artists (cursor-based pagination).The last artist ID from the previous request (for cursor pagination).
Maximum number of artists to return. Default: 20. Range: 1-50.
Returns
Cursor-paginated list of followed artists with
cursors.after for pagination.Example
Follow Artists or Users
Add artists or users to the current user’s follows.Type of resource to follow.Valid values:
"artist"- Follow artists"user"- Follow users
List of Spotify IDs to follow.
Example
Unfollow Artists or Users
Remove artists or users from the current user’s follows.Type of resource:
"artist" or "user"List of Spotify IDs to unfollow.
Example
Check Follows Artists or Users
Check if the current user follows specific artists or users.Type of resource:
"artist" or "user"List of Spotify IDs to check.
Returns
List of booleans aligned to input IDs indicating follow status.
Example
Check if Follows Playlist
Check if specific users follow a playlist.The Spotify ID of the playlist.
List of Spotify user IDs to check.
Returns
List of booleans indicating whether each user follows the playlist.
Example
Complete Example
Here’s a comprehensive example using multiple user operations:Time Range Reference
Valid time range values for top items:
| Value | Description | Approximate Period |
|---|---|---|
"short_term" | Recent listening | Last 4 weeks |
"medium_term" | Medium-term listening (default) | Last 6 months |
"long_term" | All-time favorites | Several years |
Error Handling
Many user operations require specific OAuth scopes:
user-read-private- Read user profileuser-read-email- Read email addressuser-top-read- Read top artists and tracksuser-follow-read- Read followed artistsuser-follow-modify- Modify followsplaylist-modify-public/playlist-modify-private- Follow/unfollow playlists