API Reference

tidalapi

class tidalapi.Session(config=<tidalapi.Config object>)[source]
access_token = None

The TIDAL access token, this is what you use with load_oauth_session

basic_request(method, path, params=None, data=None, headers=None)[source]
check_login()[source]

Returns true if current session is valid, false otherwise.

country_code = None
expiry_time = None

A datetime object containing the date the access token will expire

get_album(album_id)[source]
get_album_items(album_id)[source]
get_album_tracks(album_id)[source]
get_album_videos(album_id)[source]
get_artist(artist_id)[source]
get_artist_albums(artist_id)[source]
get_artist_albums_ep_singles(artist_id)[source]
get_artist_albums_other(artist_id)[source]
get_artist_bio(artist_id)[source]
get_artist_radio(artist_id)[source]
get_artist_similar(artist_id)[source]
get_artist_top_tracks(artist_id)[source]
get_artist_videos(artist_id)[source]
get_genre_items(genre_id, content_type)[source]
get_genres()[source]
get_media_url(track_id)[source]
get_mood_playlists(mood_id)[source]
get_moods()[source]
get_playlist(playlist_id)[source]
get_playlist_items(playlist_id)[source]
get_playlist_tracks(playlist_id)[source]
get_playlist_videos(playlist_id)[source]
get_track(track_id)[source]
get_track_radio(track_id)[source]
get_track_url(track_id)[source]
get_user(user_id)[source]
get_user_playlists(user_id)[source]
get_video(video_id)[source]
get_video_url(video_id)[source]
load_oauth_session(session_id, token_type, access_token, refresh_token=None)[source]

Login to TIDAL using details from a previous OAuth login, automatically refreshes expired access tokens if refresh_token is supplied as well.

Parameters:
  • token_type – The type of token, e.g. Bearer
  • session_id – The TIDAL session id, has to be a UUID
  • access_token – The access token received from an oauth login or refresh
  • refresh_token – (Optional) A refresh token that lets you get a new access token after it has expired
Returns:

True if we believe the log in was successful, otherwise false.

load_session(session_id, country_code=None, user_id=None)[source]
login(username, password)[source]
login_oauth()[source]

Login to TIDAL with a remote link for limited input devices. The function will return everything you need to log in through a web browser, and will return an future that will run until login. :return: A LinkLogin object containing all the data needed to log in remotely, and

a concurrent.futures.Future that will poll until the login is completed, or until the link expires.
Raises:TimeoutError: If the login takes too long
login_oauth_simple(function=<built-in function print>)[source]

Login to TIDAL using a remote link. You can select what function you want to use to display the link

Parameters:function – The function you want to display the link with
Raises:TimeoutError: If the login takes too long
refresh_token = None

A refresh token for retrieving a new access token through refresh_token

request(method, path, params=None, data=None, headers=None)[source]
search(field, value, limit=50)[source]
session_id = None

The id for a TIDAL session, you also need this to use load_oauth_session

token_refresh(refresh_token)[source]

Retrieves a new access token using the specified refresh token, updating the current access token :param refresh_token: The refresh token retrieved when using the OAuth login. :return: True if we believe the token was successfully refreshed, otherwise False

token_type = None

The type of access token, e.g. Bearer

user = None

A User object containing the currently logged in user.

class tidalapi.User(session, id)[source]
favorites = None
playlists()[source]
class tidalapi.Favorites(session, user_id)[source]
add_album(album_id)[source]
add_artist(artist_id)[source]
add_track(track_id)[source]
albums()[source]
artists()[source]
playlists()[source]
remove_album(album_id)[source]
remove_artist(artist_id)[source]
remove_track(track_id)[source]
tracks()[source]

tidalapi.models

class tidalapi.models.Artist(**kwargs)[source]
image
picture(width, height)[source]

A url to an artist picture

Parameters:
  • width (int) – pixel width, maximum 750
  • height (int) – pixel height, maximum 750

Accepted sizes: 80x80, 160x160, 320x320, 480x480, 750x750

role = None
roles = []
class tidalapi.models.Album(**kwargs)[source]
artist = None
artists = []
duration = -1
image
num_tracks = -1
picture(width, height)[source]

A url to an album picture

Parameters:
  • width (int) – pixel width, maximum 2000
  • height (int) – pixel height, maximum 2000

Accepted sizes: 80x80, 160x160, 320x320, 640x640 and 1280x1280

release_date = None
class tidalapi.models.Media(**kwargs)[source]
album = None
artist = None
artists = []
available = True
disc_num = 1
duration = -1
popularity = -1
track_num = -1
version = None
class tidalapi.models.Track(**kwargs)[source]

Bases: tidalapi.models.Media

class tidalapi.models.Video(**kwargs)[source]

Bases: tidalapi.models.Media

type = None
class tidalapi.models.Playlist(**kwargs)[source]
created = None
creator = None
description = None
duration = -1
image
is_public = None
last_updated = None
num_tracks = -1
picture(width, height)[source]

A url to a playlist picture

Parameters:
  • width (int) – pixel width, maximum 1080
  • height (int) – pixel height, maximum 1080

Accepted sizes: 160x160, 320x320, 480x480, 640x640, 750x750, 1080x1080

type = None
class tidalapi.models.SearchResult(**kwargs)[source]
albums = []
artists = []
playlists = []
tracks = []