@dvxch/yandex-music
    Preparing search index...

    Class Client

    Typed, async client for the Yandex Music API.

    import { Client } from '@dvxch/yandex-music';

    const client = await new Client({ token: process.env.YM_TOKEN }).init();
    const [track] = await client.tracks(2);
    console.log(track?.title);

    const [info] = await track!.getDownloadInfo();
    await info.download('track.mp3');

    Construct with an OAuth token and call Client.init once to load account information used by some endpoints. Supported response languages are en, uz, uk, us, ru, kk and hy.

    Hierarchy

    • ComposedClient
      • Client
    Index

    Constructors

    Properties

    Methods

    accountExperiments accountExperimentsDetails accountSettings accountSettingsSet accountStatus afterTrack albums albumsDisclaimer albumsSimilarEntities albumsTrailer albumsWithTracks artists artistsAbout artistsAlsoAlbums artistsBriefInfo artistsClips artistsConcerts artistsDirectAlbums artistsDisclaimer artistsDiscographyAlbums artistsDonation artistsInfo artistsLinks artistsSafeDirectAlbums artistsSimilar artistsSkeleton artistsTrackIds artistsTracks artistsTrailer chart clips clipsCredits clipsDisclaimer clipsWillLike concertInfo concertsFeed concertSkeleton concertsLocations concertsTabConfig consumePromoCode deviceAuth feed feedWizardIsPassed genres init label labelAlbums labelArtists landing metatag metatagAlbums metatagArtists metatagPlaylists metatags musicHistory musicHistoryItems newPlaylists newReleases permissionAlerts pinAlbum pinArtist pinPlaylist pins pinWave playAudio playlist playlists playlistsCollectiveJoin playlistSimilarEntities playlistsList playlistsPersonal podcasts pollDeviceToken queue queueCreate queuesList queueUpdatePosition realtime refreshAccessToken requestDeviceCode rotorAccountStatus rotorStationFeedback rotorStationFeedbackRadioStarted rotorStationFeedbackSkip rotorStationFeedbackTrackFinished rotorStationFeedbackTrackStarted rotorStationInfo rotorStationsDashboard rotorStationSettings2 rotorStationsList rotorStationTracks search searchSuggest settings tags tracks tracksCredits tracksDisclaimer tracksDownloadInfo tracksFullInfo tracksLosslessInfo tracksLyrics tracksSimilar tracksTrailer trackSupplement unpinAlbum unpinArtist unpinPlaylist unpinWave usersDislikesArtists usersDislikesArtistsAdd usersDislikesArtistsRemove usersDislikesTracks usersDislikesTracksAdd usersDislikesTracksRemove usersLikesAlbums usersLikesAlbumsAdd usersLikesAlbumsRemove usersLikesArtists usersLikesArtistsAdd usersLikesArtistsRemove usersLikesClips usersLikesClipsAdd usersLikesClipsRemove usersLikesPlaylists usersLikesPlaylistsAdd usersLikesPlaylistsRemove usersLikesTracks usersLikesTracksAdd usersLikesTracksRemove usersPlaylists usersPlaylistsChange usersPlaylistsCreate usersPlaylistsDelete usersPlaylistsDeleteTrack usersPlaylistsDescription usersPlaylistsInsertTrack usersPlaylistsKinds usersPlaylistsList usersPlaylistsName usersPlaylistsRecommendations usersPlaylistsTrailer usersPlaylistsVisibility usersPresaves usersPresavesAdd usersPresavesRemove usersSettings

    Constructors

    Properties

    accountUid?: number

    Account uid, populated by Client.init.

    baseUrl: string

    API origin used to build request URLs.

    device: string = DEFAULT_DEVICE

    Device descriptor used for queue requests.

    language: string

    Response language code.

    me?: Status

    Account status, populated by Client.init.

    onUnknownField?: UnknownFieldReporter

    Optional hook for unmapped-field reports; see ClientOptions.onUnknownField.

    reportUnknownFields: boolean

    Whether unknown-field warnings are enabled.

    request: Request

    The HTTP transport.

    token?: string

    OAuth token used to authenticate requests, if any.

    Methods

    • Fetch the account's experiment buckets.

      Returns Promise<Experiments | null>

      The experiments, or null.

      On any transport or API error.

    • Fetch detailed experiment configuration for the account.

      Returns Promise<ExperimentsDetails | null>

      The detailed experiments, or null.

      On any transport or API error.

    • Fetch the current user's settings.

      Returns Promise<UserSettings | null>

      The user settings, or null.

      On any transport or API error.

    • Change one or many of the current user's settings.

      Parameters

      • paramOrData: string | Record<string, string | number | boolean>

        A single setting name, or a map of setting names to values.

      • Optionalvalue: string | number | boolean

        The value, when paramOrData is a single setting name.

      Returns Promise<UserSettings | null>

      The updated user settings, or null.

      On any transport or API error.

    • Fetch the status of the authenticated account.

      Returns Promise<Status | null>

      The account status, or null when the token is invalid.

      On any transport or API error.

    • Fetch an ad or an Alice shot to play after a track.

      Parameters

      • nextTrackId: string | number

        The upcoming track id.

      • contextItem: string

        Context identifier (for playlists, ownerId:playlistId).

      • OptionalprevTrackId: string | number

        The previous track id (optional for Alice shots).

      • context: string = 'playlist'

        Context kind. Defaults to playlist.

      • types: string = 'shot'

        What to return after the track. Defaults to shot.

      • from: string = 'mobile-landing-origin-default'

        Where the context was entered from.

      Returns Promise<ShotEvent | null>

      The shot event, or null.

      On any transport or API error.

    • Fetch one or many albums by id (without their track lists).

      Parameters

      • albumIds: string | number | (string | number)[]

        A single id or a list of ids.

      Returns Promise<Album[]>

      The requested albums.

      On any transport or API error.

    • Fetch the disclaimer of an album.

      Parameters

      • albumId: string | number

        The album id.

      Returns Promise<Disclaimer | null>

      The disclaimer, or null.

      On any transport or API error.

    • Fetch entities similar to an album.

      Parameters

      • albumId: string | number

        The album id.

      Returns Promise<AlbumSimilarEntities | null>

      The similar entities, or null.

      On any transport or API error.

    • Fetch the trailer of an album.

      Parameters

      • albumId: string | number

        The album id.

      Returns Promise<AlbumTrailer | null>

      The album trailer, or null.

      On any transport or API error.

    • Fetch a single album together with all of its tracks (grouped by volume).

      Parameters

      • albumId: string | number

        The album id.

      Returns Promise<Album | null>

      The album with its volumes, or null.

      On any transport or API error.

    • Fetch one or many artists by id.

      Parameters

      • artistIds: string | number | (string | number)[]

        A single id or a list of ids.

      Returns Promise<Artist[]>

      The requested artists.

      On any transport or API error.

    • Fetch the "about" block of an artist.

      Parameters

      • artistId: string | number

        The artist id.

      Returns Promise<ArtistAbout | null>

      The about block, or null.

      On any transport or API error.

    • Fetch a page of compilations and albums the artist also appears on.

      Parameters

      • artistId: string | number

        The artist id.

      • page: number = 0

        Page index (0-based). Defaults to 0.

      • pageSize: number = 20

        Albums per page. Defaults to 20.

      • sortBy: ArtistAlbumsSortBy = 'year'

        Sort key. Defaults to 'year'.

      Returns Promise<ArtistAlbums | null>

      The page of albums, or null.

      On any transport or API error.

    • Fetch aggregate information about an artist.

      Parameters

      • artistId: string | number

        The artist id.

      Returns Promise<BriefInfo | null>

      The brief info, or null.

      On any transport or API error.

    • Fetch the artist-clips block of an artist.

      Parameters

      • artistId: string | number

        The artist id.

      Returns Promise<ArtistClips | null>

      The clips block, or null.

      On any transport or API error.

    • Fetch an artist's upcoming concerts.

      Parameters

      • artistId: string | number

        The artist id.

      Returns Promise<ArtistConcerts | null>

      The artist's concerts, or null.

      On any transport or API error.

    • Fetch a page of albums where the artist is the primary author.

      Parameters

      • artistId: string | number

        The artist id.

      • page: number = 0

        Page index (0-based). Defaults to 0.

      • pageSize: number = 20

        Albums per page. Defaults to 20.

      • sortBy: ArtistAlbumsSortBy = 'year'

        Sort key. Defaults to 'year'.

      Returns Promise<ArtistAlbums | null>

      The page of albums, or null.

      On any transport or API error.

    • Fetch the disclaimer of an artist.

      Parameters

      • artistId: string | number

        The artist id.

      Returns Promise<Disclaimer | null>

      The disclaimer, or null.

      On any transport or API error.

    • Fetch a page of the artist's discography.

      Parameters

      • artistId: string | number

        The artist id.

      • page: number = 0

        Page index (0-based). Defaults to 0.

      • pageSize: number = 20

        Albums per page. Defaults to 20.

      • sortBy: ArtistAlbumsSortBy = 'year'

        Sort key. Defaults to 'year'.

      Returns Promise<ArtistAlbums | null>

      The page of albums, or null.

      On any transport or API error.

    • Fetch the artist-donation block of an artist.

      Parameters

      • artistId: string | number

        The artist id.

      Returns Promise<ArtistDonations | null>

      The donation block, or null.

      On any transport or API error.

    • Fetch detailed information about an artist.

      Parameters

      • artistId: string | number

        The artist id.

      Returns Promise<ArtistInfo | null>

      The artist info, or null.

      On any transport or API error.

    • Fetch the external links shown on an artist's page.

      Parameters

      • artistId: string | number

        The artist id.

      Returns Promise<ArtistLinks | null>

      The links, or null.

      On any transport or API error.

    • Fetch the artist's "safe" direct albums (no explicit content).

      Parameters

      • artistId: string | number

        The artist id.

      • sortBy: ArtistAlbumsSortBy = 'year'

        Sort key. Defaults to 'year'.

      • sortOrder: SortOrder = 'desc'

        Sort direction. Defaults to 'desc'.

      • limit: number = 20

        Maximum number of albums. Defaults to 20.

      Returns Promise<ArtistAlbums | null>

      The albums, or null.

      On any transport or API error.

    • Fetch artists similar to the given one.

      Parameters

      • artistId: string | number

        The artist id.

      Returns Promise<ArtistSimilar | null>

      The similar artists, or null.

      On any transport or API error.

    • Fetch a skeleton (page layout) of an artist.

      Parameters

      • artistId: string | number

        The artist id.

      • skeletonId: string

        The skeleton id.

      Returns Promise<ArtistSkeleton | null>

      The skeleton, or null.

      On any transport or API error.

    • Fetch a page of the artist's track ids.

      Parameters

      • artistId: string | number

        The artist id.

      • page: number = 0

        Page index (0-based). Defaults to 0.

      • pageSize: number = 20

        Ids per page. Defaults to 20.

      Returns Promise<(string | number)[]>

      The list of track ids, or an empty array.

      On any transport or API error.

    • Fetch a page of an artist's tracks.

      Parameters

      • artistId: string | number

        The artist id.

      • page: number = 0

        Page index (0-based). Defaults to 0.

      • pageSize: number = 20

        Tracks per page. Defaults to 20.

      Returns Promise<ArtistTracks | null>

      The page of tracks, or null.

      On any transport or API error.

    • Fetch the trailer of an artist.

      Parameters

      • artistId: string | number

        The artist id.

      Returns Promise<ArtistTrailer | null>

      The trailer, or null.

      On any transport or API error.

    • Fetch a chart (/landing3/chart).

      Parameters

      • chartOption: string = ''

        Optional chart option (for example a country code).

      Returns Promise<ChartInfo | null>

      The chart, or null.

      On any transport or API error.

    • Fetch one or many clips by id.

      Parameters

      • clipIds: string | number | (string | number)[]

        A single clip id or a list of ids.

      Returns Promise<Clip[]>

      The requested clips.

      On any transport or API error.

    • Fetch the production credits of a clip.

      Parameters

      • clipId: string | number

        The clip id.

      Returns Promise<Credits | null>

      The credits, or null.

      On any transport or API error.

    • Fetch the disclaimer of a clip.

      Parameters

      • clipId: string | number

        The clip id.

      Returns Promise<Disclaimer | null>

      The disclaimer, or null.

      On any transport or API error.

    • Fetch a recommended page of clips.

      Parameters

      • page: number = 0

        Page index (0-based). Defaults to 0.

      • pageSize: number = 50

        Clips per page. Defaults to 50.

      Returns Promise<ClipsWillLike | null>

      The recommended clips, or null.

      On any transport or API error.

    • Fetch detailed information about a concert.

      Parameters

      • concertId: string | number

        The concert id.

      Returns Promise<ConcertInfo | null>

      The concert info, or null.

      On any transport or API error.

    • Fetch the concert feed, optionally filtered by location.

      Parameters

      • Optionallocations: (string | number)[]

        Location ids to filter by.

      Returns Promise<ConcertFeed | null>

      The concert feed, or null.

      On any transport or API error.

    • Fetch the skeleton (render scaffold) of a concert page.

      Parameters

      • concertId: string | number

        The concert id.

      • skeletonId: string = 'concert_page'

        The skeleton id. Defaults to 'concert_page'.

      Returns Promise<ConcertSkeleton | null>

      The skeleton, or null.

      On any transport or API error.

    • Activate a promo code.

      Parameters

      • code: string

        The promo code.

      • Optionallanguage: string

        Response language. Defaults to the client language.

      Returns Promise<PromoCodeStatus | null>

      The activation result, or null.

      On any transport or API error.

    • Fetch the personalised feed (legacy /feed endpoint).

      Returns Promise<Feed | null>

      The feed, or null.

      On any transport or API error.

    • Check whether the feed onboarding wizard has been completed.

      Returns Promise<boolean>

      true when the wizard has been passed.

      On any transport or API error.

    • Fetch the genre tree.

      Returns Promise<Genre[]>

      The list of top-level genres (each with nested sub-genres).

      On any transport or API error.

    • Initialize the client by loading account status.

      Populates ClientBase.me and ClientBase.accountUid, which a number of other endpoints rely on. Call this once after construction.

      Returns Promise<Client>

      The same client, for chaining.

      On any transport or API error.

    • Fetch a record label by id.

      Parameters

      • labelId: string | number

        The label id.

      Returns Promise<Label | null>

      The label, or null.

      On any transport or API error.

    • Fetch a page of a label's albums.

      Parameters

      • labelId: string | number

        The label id.

      • page: number = 0

        Page index (0-based). Defaults to 0.

      • pageSize: number = 100

        Albums per page. Defaults to 100.

      • OptionalsortBy: ArtistAlbumsSortBy

        Sort key.

      • OptionalsortOrder: SortOrder

        Sort direction.

      Returns Promise<LabelAlbums | null>

      The page of albums, or null.

      On any transport or API error.

    • Fetch a page of a label's artists.

      Parameters

      • labelId: string | number

        The label id.

      • page: number = 0

        Page index (0-based). Defaults to 0.

      • pageSize: number = 100

        Artists per page. Defaults to 100.

      Returns Promise<LabelArtists | null>

      The page of artists, or null.

      On any transport or API error.

    • Fetch one or more landing blocks (/landing3).

      Parameters

      • blocks: string | string[]

        A block name or list of block names (for example personalplaylists, chart).

      Returns Promise<Landing | null>

      The landing page, or null.

      On any transport or API error.

    • Fetch aggregate information about a metatag.

      Parameters

      • metatagId: string

        The metatag id.

      • options: MetatagOptions = {}

        Optional per-section counts and sort keys.

      Returns Promise<Metatag | null>

      The metatag, or null.

      On any transport or API error.

    • Fetch a page of a metatag's albums.

      Parameters

      • metatagId: string

        The metatag id.

      • options: { limit?: number; offset?: number; period?: string; sortBy?: string } = {}

        Optional period, sort key and pagination.

      Returns Promise<MetatagAlbums | null>

      The page of albums, or null.

      On any transport or API error.

    • Fetch a page of a metatag's artists.

      Parameters

      • metatagId: string

        The metatag id.

      • options: {
            limit?: number;
            offset?: number;
            period?: string;
            sortBy?: string;
            tracksPerArtist?: number;
        } = {}

        Period (required by the API, defaults to week), sort key, pagination and tracks-per-artist.

      Returns Promise<MetatagArtists | null>

      The page of artists, or null.

      On any transport or API error.

    • Fetch a page of a metatag's playlists.

      Parameters

      • metatagId: string

        The metatag id.

      • options: { limit?: number; offset?: number; sortBy?: string; withLikesCount?: boolean } = {}

        Optional sort key, pagination and likes-count flag.

      Returns Promise<MetatagPlaylists | null>

      The page of playlists, or null.

      On any transport or API error.

    • Fetch the metatag navigation (moods, activities, genres, epochs).

      Returns Promise<Metatags | null>

      The metatag navigation, or null.

      On any transport or API error.

    • Fetch the user's listening history grouped by day.

      Parameters

      • fullModelsCount: number = 0

        How many items to return with their full models inlined. Defaults to 0.

      Returns Promise<MusicHistory | null>

      The listening history, or null.

      On any transport or API error.

    • Fetch the "new playlists" landing list.

      Returns Promise<LandingList | null>

      The list, or null.

      On any transport or API error.

    • Fetch the "new releases" landing list.

      Returns Promise<LandingList | null>

      The list, or null.

      On any transport or API error.

    • Pin an album.

      Parameters

      • albumId: string | number

        The album id.

      Returns Promise<Pin | null>

      The created pin, or null.

      On any transport or API error.

    • Pin an artist.

      Parameters

      • artistId: string | number

        The artist id.

      Returns Promise<Pin | null>

      The created pin, or null.

      On any transport or API error.

    • Pin a playlist.

      Parameters

      • uid: string | number

        The playlist owner uid.

      • kind: string | number

        The playlist kind.

      Returns Promise<Pin | null>

      The created pin, or null.

      On any transport or API error.

    • Fetch the user's pinned items.

      Returns Promise<PinsList | null>

      The pinned items, or null.

      On any transport or API error.

    • Pin a wave (radio seed, for example artist:12345).

      Parameters

      • seeds: string

        The wave seed identifier.

      Returns Promise<Pin | null>

      The created pin, or null.

      On any transport or API error.

    • Report the current playback state of a track.

      Parameters

      Returns Promise<boolean>

      Whether the report was accepted.

      On any transport or API error.

    • Fetch a playlist by its stable UUID.

      Parameters

      • playlistUuid: string

        The playlist UUID.

      Returns Promise<Playlist | null>

      The Playlist, or null.

      On any transport or API error.

    • Fetch a list of playlists by their uid:kind ids.

      Parameters

      • playlistIds: string | string[]

        A single id or a list of ids in uid:kind form.

      Returns Promise<PlaylistsList | null>

      The playlists, or null.

      On any transport or API error.

    • Join a collaborative playlist as a co-author.

      Parameters

      • userId: number

        The numeric id of the playlist owner.

      • token: string

        The join token (from the "add co-author" link).

      Returns Promise<boolean>

      Whether the operation succeeded.

      On any transport or API error.

    • Fetch entities similar to a playlist.

      Parameters

      • playlistUuid: string

        The playlist UUID.

      Returns Promise<PlaylistSimilarEntities | null>

      The similar entities, or null.

      On any transport or API error.

    • Fetch a short-form list of playlists by their uid:kind ids.

      Parameters

      • playlistIds: string | number | (string | number)[]

        A single id or a list of ids in uid:kind form.

      Returns Promise<Playlist[]>

      The playlists.

      The returned playlists do not carry their track lists; use usersPlaylists to obtain a playlist with tracks populated.

      On any transport or API error.

    • Fetch a personal (auto-generated) playlist.

      Parameters

      • playlistId: string

        The personal-playlist id.

      Returns Promise<GeneratedPlaylist | null>

      The generated playlist, or null.

      Known ids: daily, missedLikes, recentTracks, neverHeard, podcasts, origin.

      On any transport or API error.

    • Fetch the podcasts landing list.

      Returns Promise<LandingList | null>

      The list, or null.

      On any transport or API error.

    • Poll once for the token of a pending device authorization.

      Parameters

      • deviceCode: string

        The deviceCode from requestDeviceCode.

      • OptionalclientId: string

        OAuth client id.

      • OptionalclientSecret: string

        OAuth client secret.

      Returns Promise<OAuthToken | null>

      The token, or null while the user has not yet confirmed.

      On any OAuth error other than authorization_pending.

      On any transport error.

    • Fetch a single queue by id.

      Parameters

      • queueId: string

        The queue id.

      Returns Promise<Queue | null>

      The queue, or null.

      On any transport or API error.

    • Create a new playback queue.

      Parameters

      • queue: string | JSONObject

        The queue, as a JSON object or a pre-serialized JSON string.

      • Optionaldevice: string

        Device descriptor. Defaults to the client device.

      Returns Promise<string | null>

      The id of the created queue, or null.

      On any transport or API error.

    • Fetch the list of the user's queues.

      Parameters

      • Optionaldevice: string

        Device descriptor. Defaults to the client device.

      Returns Promise<QueueItem[]>

      The queue summaries.

      On any transport or API error.

    • Update the current playing position of a queue.

      Parameters

      • queueId: string

        The queue id.

      • currentIndex: number

        The new current track index.

      • Optionaldevice: string

        Device descriptor (must match the queue's creator). Defaults to the client device.

      Returns Promise<boolean>

      Whether the update succeeded.

      On any transport or API error.

    • Create a realtime ("now playing") client backed by Ynison.

      Parameters

      • options: Partial<RealtimeOptions> = {}

        Overrides for token, device identity and reconnection.

      Returns RealtimeClient

      A new realtime client.

      Realtime events are the only server-push channel Yandex Music offers — there are no HTTP webhooks. The returned RealtimeClient handles the handshake, keep-alive and reconnection; just subscribe and start(). By default trackChange events resolve the playing track via Client.tracks.

      Requires the optional ws package (npm install ws).

      const rt = client.realtime();
      rt.on('trackChange', ({ track }) => console.log('now playing:', track?.title));
      await rt.start();
    • Exchange a refresh token for a fresh access token (OAuth refresh_token grant).

      Device-flow tokens expire; persist OAuthToken.refreshToken from deviceAuth and call this to renew the access token without a new login. The response usually rotates the refresh token too — store the new one from the returned OAuthToken.

      Parameters

      • refreshToken: string

        The stored refresh token.

      • OptionalclientId: string

        OAuth client id. Defaults to the Android app's id.

      • OptionalclientSecret: string

        OAuth client secret. Defaults to the Android app's secret.

      Returns Promise<OAuthToken>

      The refreshed OAuthToken.

      When the grant is rejected or the response cannot be parsed.

      On any transport error.

    • Request a device/user code pair to start the OAuth Device Flow.

      Parameters

      • OptionaldeviceId: string

        Device id. Defaults to a random 10-character string.

      • OptionaldeviceName: string

        Device name. Defaults to YandexMusicAPI.

      • OptionalclientId: string

        OAuth client id. Defaults to the Android app's id.

      Returns Promise<DeviceCode>

      The issued DeviceCode.

      When the response cannot be parsed.

      On any transport or API error.

    • Fetch the rotor account status.

      Returns Promise<Status | null>

      The status, or null.

      On any transport or API error.

    • Send listening feedback for a station.

      Parameters

      • station: string

        Station id in type:tag form (for example user:onyourwave).

      • type: RotorFeedbackType

        The kind of feedback.

      • options: {
            batchId?: string;
            from?: string;
            timestamp?: number;
            totalPlayedSeconds?: number;
            trackId?: string | number;
        } = {}

        Optional feedback fields.

        • OptionalbatchId?: string

          Id of the track batch the event refers to.

        • Optionalfrom?: string

          Where playback started (for example mobile-radio-user-123).

        • Optionaltimestamp?: number

          Event time (seconds since the epoch). Defaults to now.

        • OptionaltotalPlayedSeconds?: number

          Seconds of the track played before the event.

        • OptionaltrackId?: string | number

          Id of the track the event refers to.

      Returns Promise<boolean>

      Whether the operation succeeded.

      On any transport or API error.

    • Shortcut for rotorStationFeedback(station, 'radioStarted', …).

      Parameters

      • station: string

        Station id.

      • from: string

        Where playback started.

      • OptionalbatchId: string

        Track batch id.

      • Optionaltimestamp: number

        Event time (seconds since the epoch).

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Shortcut for rotorStationFeedback(station, 'skip', …).

      Parameters

      • station: string

        Station id.

      • trackId: string | number

        The track that was skipped.

      • totalPlayedSeconds: number

        Seconds played before skipping.

      • OptionalbatchId: string

        Track batch id.

      • Optionaltimestamp: number

        Event time (seconds since the epoch).

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Shortcut for rotorStationFeedback(station, 'trackFinished', …).

      Parameters

      • station: string

        Station id.

      • trackId: string | number

        The track that finished.

      • totalPlayedSeconds: number

        Seconds played before finishing.

      • OptionalbatchId: string

        Track batch id.

      • Optionaltimestamp: number

        Event time (seconds since the epoch).

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Shortcut for rotorStationFeedback(station, 'trackStarted', …).

      Parameters

      • station: string

        Station id.

      • trackId: string | number

        The track that started playing.

      • OptionalbatchId: string

        Track batch id.

      • Optionaltimestamp: number

        Event time (seconds since the epoch).

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Fetch information about a specific station.

      Parameters

      • station: string

        Station id in type:tag form (for example genre:pop).

      Returns Promise<StationResult[]>

      The matching station results.

      On any transport or API error.

    • Fetch the personalized station dashboard.

      Returns Promise<Dashboard | null>

      The dashboard, or null.

      On any transport or API error.

    • Change the settings of a station.

      Parameters

      • station: string

        Station id.

      • moodEnergy: RotorMoodEnergy

        The desired mood/energy.

      • diversity: RotorDiversity

        The desired track diversity.

      • language: RotorLanguage = 'not-russian'

        The desired language. Defaults to 'not-russian'.

      • type: RotorStationType = 'rotor'

        The station type. Defaults to 'rotor'.

      Returns Promise<boolean>

      Whether the operation succeeded.

      On any transport or API error.

    • Fetch the full list of available stations.

      Parameters

      • Optionallanguage: string

        Language for station info. Defaults to the client language.

      Returns Promise<StationResult[]>

      The list of stations.

      On any transport or API error.

    • Fetch the next batch of tracks from a station.

      Parameters

      • station: string

        Station id in type:tag form.

      • settings2: boolean = true

        Use the second settings set (as official clients do). Defaults to true.

      • Optionalqueue: string | number

        Id of the track that just played, to inform the next batch.

      Returns Promise<StationTracksResult | null>

      The track batch, or null.

      On any transport or API error.

    • Search the catalogue.

      Parameters

      • text: string

        The query text.

      • nocorrect: boolean = false

        When false, mistyped queries are auto-corrected. Defaults to false.

      • type: SearchType = 'all'

        Entity type to search for. Defaults to all.

      • page: number = 0

        Page index. Defaults to 0.

      • playlistInBest: boolean = true

        Whether playlists may appear as the best match. Defaults to true.

      Returns Promise<Search | null>

      The search response, or null.

      On any transport or API error.

    • Fetch search suggestions for a partial query.

      Parameters

      • part: string

        The partial query text.

      Returns Promise<Suggestions | null>

      The suggestions, or null.

      On any transport or API error.

    • Fetch purchase offers and payment configuration.

      Returns Promise<Settings | null>

      The settings, or null.

      On any transport or API error.

    • Fetch the playlists grouped under a tag.

      Parameters

      • tagId: string

        The tag id.

      Returns Promise<TagResult | null>

      The tagged playlists, or null.

      On any transport or API error.

    • Fetch one or many tracks by id.

      Parameters

      • trackIds: string | number | (string | number)[]

        A single id or a list of ids.

      • withPositions: boolean = true

        Include album track positions. Defaults to true.

      Returns Promise<Track[]>

      The requested tracks.

      On any transport or API error.

    • Fetch the production credits of a track.

      Parameters

      • trackId: string | number

        The track id.

      Returns Promise<Credits | null>

      The credits, or null.

      On any transport or API error.

    • Fetch the disclaimer of a track.

      Parameters

      • trackId: string | number

        The track id.

      Returns Promise<Disclaimer | null>

      The disclaimer, or null.

      On any transport or API error.

    • Fetch the available download variants for a track.

      Parameters

      • trackId: string | number

        The track id.

      • getDirectLinks: boolean = false

        Resolve direct file links eagerly. Defaults to false.

      Returns Promise<DownloadInfo[]>

      The list of download variants.

      On any transport or API error.

    • Fetch full information about a track.

      Parameters

      • trackId: string | number

        The track id.

      Returns Promise<TrackFullInfo | null>

      The full track info, or null.

      On any transport or API error.

    • Fetch lossless (FLAC) download info for a track via the /get-file-info endpoint.

      Parameters

      • trackId: string | number

        The track id (numeric, or "id:albumId").

      • quality: string = 'lossless'

        Requested quality. Defaults to lossless.

      Returns Promise<LosslessDownloadInfo | null>

      The file info, or null when the endpoint returns none.

      Unlike tracksDownloadInfo (legacy lossy mp3/aac), this resolves the modern signed endpoint that can serve lossless FLAC. The returned stream is AES-CTR-encrypted (transport: encraw); LosslessDownloadInfo.download / LosslessDownloadInfo.downloadBytes decrypt it transparently. When a track has no lossless source the server falls back to a lossy codec — check LosslessDownloadInfo.isLossless / .codec.

      On any transport or API error.

    • Fetch the lyrics of a track.

      Parameters

      • trackId: string | number

        The track id.

      • format: "TEXT" | "LRC" = 'TEXT'

        TEXT (plain) or LRC (time-synced). Defaults to TEXT.

      Returns Promise<TrackLyrics | null>

      The lyrics, or null when none exist.

      Requires authorization.

      When called without authorization.

      When the track has no lyrics.

      On any transport or API error.

    • Fetch tracks similar to a track.

      Parameters

      • trackId: string | number

        The track id.

      Returns Promise<SimilarTracks | null>

      The similar-tracks result, or null.

      On any transport or API error.

    • Fetch the trailer of a track.

      Parameters

      • trackId: string | number

        The track id.

      Returns Promise<TrackTrailer | null>

      The trailer, or null.

      On any transport or API error.

    • Fetch supplementary information about a track (legacy lyrics, videos).

      Parameters

      • trackId: string | number

        The track id.

      Returns Promise<Supplement | null>

      The supplement, or null.

      On any transport or API error.

    • Unpin an album.

      Parameters

      • albumId: string | number

        The album id.

      Returns Promise<boolean>

      Whether the operation succeeded.

      On any transport or API error.

    • Unpin an artist.

      Parameters

      • artistId: string | number

        The artist id.

      Returns Promise<boolean>

      Whether the operation succeeded.

      On any transport or API error.

    • Unpin a playlist.

      Parameters

      • uid: string | number

        The playlist owner uid.

      • kind: string | number

        The playlist kind.

      Returns Promise<boolean>

      Whether the operation succeeded.

      On any transport or API error.

    • Unpin a wave.

      Parameters

      • seeds: string

        The wave seed identifier.

      Returns Promise<boolean>

      Whether the operation succeeded.

      On any transport or API error.

    • Fetch the user's disliked artists.

      Parameters

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<Artist[]>

      The disliked artists.

      The endpoint returns full artist objects (not like wrappers), so the result is Artist[].

      On any transport or API error.

    • Dislike one or many artists.

      Parameters

      • artistIds: string | number | (string | number)[]

        Artist id(s).

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Remove the dislike from one or many artists.

      Parameters

      • artistIds: string | number | (string | number)[]

        Artist id(s).

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Fetch the user's disliked tracks.

      Parameters

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<TracksList | null>

      The disliked-tracks library, or null.

      On any transport or API error.

    • Dislike one or many tracks.

      Parameters

      • trackIds: string | number | (string | number)[]

        Track id(s).

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Remove the dislike from one or many tracks.

      Parameters

      • trackIds: string | number | (string | number)[]

        Track id(s).

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Fetch the user's liked albums.

      Parameters

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<Like[]>

      The liked albums.

      On any transport or API error.

    • Like one or many albums.

      Parameters

      • albumIds: string | number | (string | number)[]

        Album id(s).

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Remove the like from one or many albums.

      Parameters

      • albumIds: string | number | (string | number)[]

        Album id(s).

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Fetch the user's liked artists.

      Parameters

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<Artist[]>

      The liked artists.

      The endpoint returns full artist objects (not like wrappers), so the result is Artist[].

      On any transport or API error.

    • Like one or many artists.

      Parameters

      • artistIds: string | number | (string | number)[]

        Artist id(s).

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Remove the like from one or many artists.

      Parameters

      • artistIds: string | number | (string | number)[]

        Artist id(s).

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Fetch a page of the user's liked clips.

      Parameters

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      • page: number = 0

        Page index (0-based). Defaults to 0.

      • pageSize: number = 20

        Clips per page. Defaults to 20.

      Returns Promise<ClipsWillLike | null>

      The liked clips, or null.

      On any transport or API error.

    • Like a clip.

      Parameters

      • clipId: string | number

        The clip id.

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

      On any transport or API error.

    • Remove the like from a clip.

      Parameters

      • clipId: string | number

        The clip id.

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

      On any transport or API error.

    • Fetch the user's liked playlists.

      Parameters

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<Like[]>

      The liked playlists.

      On any transport or API error.

    • Like one or many playlists.

      Parameters

      • playlistIds: string | number | (string | number)[]

        Playlist id(s) in ownerId:kind form.

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Remove the like from one or many playlists.

      Parameters

      • playlistIds: string | number | (string | number)[]

        Playlist id(s) in ownerId:kind form.

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Fetch the user's liked tracks.

      Parameters

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<TracksList | null>

      The liked-tracks library, or null.

      On any transport or API error.

    • Like one or many tracks.

      Parameters

      • trackIds: string | number | (string | number)[]

        Track id(s).

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Remove the like from one or many tracks.

      Parameters

      • trackIds: string | number | (string | number)[]

        Track id(s).

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

    • Fetch one playlist (by a single kind) or several (by a list of kinds).

      Parameters

      • kind: string | number | (string | number)[]

        A single playlist kind, or a list of kinds.

      • OptionaluserId: string | number

        Owner user id. Defaults to the authenticated account.

      Returns Promise<Playlist | Playlist[] | null>

      A single Playlist, a list of them, or null.

      On any transport or API error.

    • Apply a raw diff to a playlist.

      Parameters

      • kind: string | number

        The playlist kind.

      • diff: string

        The serialized diff (see Difference).

      • revision: number = 1

        The playlist revision. Defaults to 1.

      • OptionaluserId: string | number

        Owner user id. Defaults to the authenticated account.

      Returns Promise<Playlist | null>

      The updated playlist, or null.

      On any transport or API error.

    • Create a new playlist.

      Parameters

      • title: string

        The playlist title.

      • visibility: PlaylistVisibility = 'public'

        Access modifier. Defaults to 'public'.

      • OptionaluserId: string | number

        Owner user id. Defaults to the authenticated account.

      Returns Promise<Playlist | null>

      The created playlist, or null.

      On any transport or API error.

    • Delete a playlist.

      Parameters

      • kind: string | number

        The playlist kind.

      • OptionaluserId: string | number

        Owner user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

      On any transport or API error.

    • Remove a range of tracks from a playlist.

      Parameters

      • kind: string | number

        The playlist kind.

      • from: number

        Start index (inclusive).

      • to: number

        End index (exclusive).

      • revision: number = 1

        The playlist revision. Defaults to 1.

      • OptionaluserId: string | number

        Owner user id. Defaults to the authenticated account.

      Returns Promise<Playlist | null>

      The updated playlist, or null.

      On any transport or API error.

    • Change a playlist's description.

      Parameters

      • kind: string | number

        The playlist kind.

      • description: string

        The new description.

      • OptionaluserId: string | number

        Owner user id. Defaults to the authenticated account.

      Returns Promise<Playlist | null>

      The updated playlist, or null.

      On any transport or API error.

    • Insert a track into a playlist at the given index.

      Parameters

      • kind: string | number

        The playlist kind.

      • trackId: string | number

        The track id to insert.

      • albumId: string | number

        The album the track belongs to.

      • at: number = 0

        The insertion index. Defaults to 0.

      • revision: number = 1

        The playlist revision. Defaults to 1.

      • OptionaluserId: string | number

        Owner user id. Defaults to the authenticated account.

      Returns Promise<Playlist | null>

      The updated playlist, or null.

      On any transport or API error.

    • Fetch the kinds (ids) of all playlists owned by a user.

      Parameters

      • OptionaluserId: string | number

        Owner user id. Defaults to the authenticated account.

      Returns Promise<number[]>

      The list of playlist kinds.

      On any transport or API error.

    • Fetch every playlist owned by a user.

      Parameters

      • OptionaluserId: string | number

        Owner user id. Defaults to the authenticated account.

      Returns Promise<Playlist[]>

      The user's playlists.

      On any transport or API error.

    • Rename a playlist.

      Parameters

      • kind: string | number

        The playlist kind.

      • name: string

        The new title.

      • OptionaluserId: string | number

        Owner user id. Defaults to the authenticated account.

      Returns Promise<Playlist | null>

      The updated playlist, or null.

      On any transport or API error.

    • Fetch track recommendations for a playlist.

      Parameters

      • kind: string | number

        The playlist kind.

      • OptionaluserId: string | number

        Owner user id. Defaults to the authenticated account.

      Returns Promise<PlaylistRecommendations | null>

      The recommendations, or null.

      On any transport or API error.

    • Fetch the trailer of a playlist.

      Parameters

      • kind: string | number

        The playlist kind.

      • OptionaluserId: string | number

        Owner user id. Defaults to the authenticated account.

      Returns Promise<PlaylistTrailer | null>

      The trailer, or null.

      On any transport or API error.

    • Change a playlist's visibility.

      Parameters

      • kind: string | number

        The playlist kind.

      • visibility: PlaylistVisibility

        The new visibility.

      • OptionaluserId: string | number

        Owner user id. Defaults to the authenticated account.

      Returns Promise<Playlist | null>

      The updated playlist, or null.

      On any transport or API error.

    • Fetch the user's pre-saved albums.

      Parameters

      • includeReleased: boolean = true

        Include albums that have since been released. Defaults to true.

      • includeUpcoming: boolean = true

        Include albums not yet released. Defaults to true.

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<Presaves | null>

      The pre-saves, or null.

      On any transport or API error.

    • Pre-save an album.

      Parameters

      • albumId: string | number

        The album id.

      • likeAfterRelease: boolean = true

        Automatically like the album once released. Defaults to true.

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

      On any transport or API error.

    • Remove an album pre-save.

      Parameters

      • albumId: string | number

        The album id.

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<boolean>

      Whether the operation succeeded.

      On any transport or API error.

    • Fetch a user's library settings.

      Parameters

      • OptionaluserId: string | number

        Target user id. Defaults to the authenticated account.

      Returns Promise<UserSettings | null>

      The user settings, or null.

      On any transport or API error.