The library API provides access to the authenticated user’s personal music library, playback history, likes, subscriptions, and uploaded tracks. Every method requiresDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/faraasaaay/innertube-v1/llms.txt
Use this file to discover all available pages before exploring further.
YouTube.cookie to be set with a valid session. All suspend functions return Result<T>.
Library browsing
YouTube.library
Fetches the user’s library using a browse ID and optional tab index.
The browse ID of the library section, such as
"FEmusic_liked_playlists", "FEmusic_library_landing", or a custom library browse ID.Zero-based tab index for browse responses with multiple tabs. Defaults to
0.YouTube.libraryContinuation
Fetches additional library items from a continuation token.
Token from
LibraryPage.continuation.YouTube.libraryRecentActivity
Fetches the “Recent activity” grid from the library landing page using LibraryFilter.FILTER_RECENT_ACTIVITY. For artist items the function additionally calls YouTube.artist() to enrich playEndpoint.
LibraryPage with items and a null continuation (the activity grid is not paginated).LibraryFilter
An inline value class that wraps encoded continuation tokens accepted by the library browse endpoint.
| Constant | Sort/filter applied |
|---|---|
FILTER_RECENT_ACTIVITY | Most recently interacted-with items |
FILTER_RECENTLY_PLAYED | Recently played tracks |
FILTER_PLAYLISTS_ALPHABETICAL | Liked playlists sorted A–Z |
FILTER_PLAYLISTS_RECENTLY_SAVED | Liked playlists sorted by save date |
History
YouTube.musicHistory
Fetches the user’s full playback history, grouped into date sections.
HistoryPage with sections: List<HistoryPage.HistorySection>?. Each section has a date label and a list of SongItems. Each SongItem.historyRemoveToken can be passed to removeHistoryItems().YouTube.removeHistoryItems
Removes one or more items from the playback history using their feedback tokens.
List of tokens from
SongItem.historyRemoveToken. Delegates to YouTube.feedback().true when the feedback endpoint accepted all tokens.Like / Unlike
YouTube.likeVideo
Likes or un-likes a video.
The video ID to like or unlike.
true to like, false to remove the like.YouTube.likePlaylist
Likes or un-likes (saves/unsaves) a playlist.
The playlist ID to save or unsave.
true to save, false to unsave.Subscribe / Unsubscribe
YouTube.subscribeChannel
Subscribes to or unsubscribes from an artist or podcast channel.
The channel ID. Obtained from
ArtistItem.channelId or PodcastItem.channelId.true to subscribe, false to unsubscribe.Override the default subscribe params (
"EgIIAhgA"). Leave null in most cases.Song library management
YouTube.addSongToLibrary
Adds a song to the user’s liked-songs library. Internally calls next() to fetch fresh feedback tokens and then submits them via feedback().
The video ID of the song to add.
true if the feedback endpoint accepted the add-token.YouTube.removeSongFromLibrary
Removes a song from the user’s liked-songs library. Fetches fresh tokens from next() before submitting.
The video ID of the song to remove.
true if the feedback endpoint accepted the remove-token.YouTube.toggleSongLibrary
Convenience wrapper that calls addSongToLibrary() or removeSongFromLibrary() based on the addToLibrary flag.
The video ID to toggle.
true to add, false to remove.Upload
YouTube.uploadSong
Uploads a local audio file to the user’s YouTube Music library in a two-step process: initialise the upload, then stream the file bytes to the returned upload URL.
The filename including extension (e.g.
"track.flac"). Must use one of the supported extensions listed in SUPPORTED_UPLOAD_TYPES.The raw file bytes. Must not exceed
MAX_UPLOAD_SIZE (300 MB).Optional progress callback invoked with a value from
0.0 (started) to 1.0 (complete). The first 5% of progress represents upload initialisation; the remaining 95% tracks actual byte transfer.true when the server responds with upload status "final".| Constant | Value | Description |
|---|---|---|
YouTube.SUPPORTED_UPLOAD_TYPES | ["mp3", "m4a", "wma", "flac", "ogg"] | Accepted file extensions. |
YouTube.MAX_UPLOAD_SIZE | 314572800L | Maximum file size in bytes (300 MB). |
YouTube.deleteUploadedSong
Deletes a previously uploaded song from the user’s private library.
The upload entity ID of the song. Available as
SongItem.uploadEntityId on items returned by library browse responses for privately-owned uploads.true when the deletion request was accepted.