Overview
TheAsyncTrackService provides operations for retrieving detailed track information from Spotify’s catalog, including metadata, audio features, and artist information.
This service is available in both async (
AsyncTrackService) and sync (TrackService) variants.Get Track
Retrieve detailed information about a single track.The Spotify ID for the track.Example:
"11dFghVXANMlKmJXsNCbNl"An ISO 3166-1 alpha-2 country code. If provided, track relinking is applied for regional availability.Example:
"US", "GB", "CA"Track relinking ensures the returned track is playable in the specified market. If the original track isn’t available, a relinked version may be returned.Returns
Complete track object with all metadata and related information.Key fields:
name- Track titleartists- List of artist objectsalbum- Album object containing the trackduration_ms- Track duration in millisecondsexplicit- Whether track has explicit contentpopularity- Track popularity (0-100)track_number- Position on albumdisc_number- Disc number (for multi-disc albums)is_playable- Whether track is playable in the given marketpreview_url- URL to 30-second preview (if available)external_urls- External URLs (Spotify web player, etc.)uri- Spotify URI
Example
Get Several Tracks
Retrieve information for multiple tracks in a single request.List of Spotify track IDs. Maximum 20 IDs per request.Example:
["11dFghVXANMlKmJXsNCbNl", "1301WleyT98MSxVHPZCA6M"]An ISO 3166-1 alpha-2 country code for track relinking.
Returns
List of track objects in the same order as the requested IDs.Note: If a track ID is invalid or not found, the corresponding position may contain
None or be omitted depending on the API response.Example
Complete Example
Here’s a comprehensive example demonstrating track operations:Error Handling
Track Relinking
When you provide amarket parameter, Spotify may return a relinked track if the original isn’t available in that market:
The Spotify API enforces a maximum of 20 track IDs per
get_several() request. For larger batches, split your requests into groups of 20.