Skip to content

Tracks

API #

Implementation to make API calls with.

Parameters:

get_track #

get_track(track_id: str, *, market: MissingOr[str] = MISSING) -> TrackWithSimpleArtist

Get Spotify catalog information for a single track.

Parameters:

Returns:

get_several_tracks #

get_several_tracks(track_ids: list[str], *, market: MissingOr[str] = MISSING) -> list[TrackWithSimpleArtist]

Get Spotify catalog information for several tracks.

Parameters:

Returns:

get_users_saved_tracks #

get_users_saved_tracks(*, limit: MissingOr[int] = MISSING, offset: MissingOr[int] = MISSING, market: MissingOr[str] = MISSING) -> Paginator[SavedTrack]

Get a list of the tracks saved in the current user's 'Your Music' library.

Required Authorization Scope

USER_LIBRARY_READ

Parameters:

  • limit (int, default: 20 ) –

    The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.

  • offset (int, default: 0 ) –

    The index of the first item to return. Default: 0 (the first item).

  • market (str, default: MISSING ) –

    Only get content available in that market. Must be an ISO 3166-1 alpha-2 country code.

Returns:

save_tracks_for_current_user #

save_tracks_for_current_user(track_ids: list[str]) -> None

Save one or more tracks to the current user's 'Your Music' library.

Required Authorization Scope

USER_LIBRARY_MODIFY

Parameters:

  • track_ids (list[str]) –

    The IDs of the tracks. Maximum: 50.

remove_users_saved_tracks #

remove_users_saved_tracks(track_ids: list[str]) -> None

Remove one or more tracks from the current user's 'Your Music' library.

Required Authorization Scope

USER_LIBRARY_MODIFY

Parameters:

  • track_ids (list[str]) –

    The IDs of the tracks. Maximum: 50.

check_users_saved_tracks #

check_users_saved_tracks(track_ids: list[str]) -> list[bool]

Check if one or more tracks is already saved in the current user's 'Your Music' library.

Required Authorization Scope

USER_LIBRARY_READ

Parameters:

  • track_ids (list[str]) –

    The IDs of the tracks. Maximum: 50.

Returns:

  • list[bool]

    A list of booleans dictating whether or not the corresponding tracks are already saved.

SimpleTrack #

A simplified track.

Track #

A track.

TrackWithSimpleArtist #

A track where the [artist][spotify.models.TrackWithSimpleArtist.artist] field is a SimpleArtist object.

LinkedFromTrack #

Information about the originally requested track when Track Relinking is applied.

external_urls #

external_urls: ExternalURLs

Known external URLs for the track.

href #

href: str

A link to the Web API endpoint providing full details of the track.

id #

id: str

The Spotify ID for the track.

uri #

uri: str

The Spotify URI for the track.

SavedTrack #

Information about a track saved to a user's 'Your Music' library.

added_at #

added_at: datetime

The date and time the track was saved.

track #

The track.