This guide walks you through everything you need to make your first YouTube Music API call with Inner. By the end you will have theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/faraasaaay/inner/llms.txt
Use this file to discover all available pages before exploring further.
innertube module on your classpath, an optional session cookie configured, and a working coroutine that searches for songs and prints their titles.
Add the module
Inner ships as a local Gradle module — the Next, add it as a dependency in your app module’s Sync your Gradle project to resolve the module.
innertube directory inside the repository. Copy or clone the innertube directory into your project root, then declare it in your project’s settings.gradle.kts:settings.gradle.kts
build.gradle.kts:app/build.gradle.kts
Initialize YouTube
YouTube is a Kotlin object — a singleton that requires no constructor call or manual initialisation. Import it and start configuring:YouTubeLocale.gl is the two-letter ISO 3166-1 country code used for region-specific charts and recommendations. YouTubeLocale.hl is the BCP 47 language tag for response language.Set your session cookie (optional)
Anonymous browsing works without any credentials — you can search, browse, and fetch album/artist pages without a cookie. To access authenticated features (library, history, playlist management, account info), provide a YouTube Music session cookie:The cookie is stored inside the
PlaybackAuthState and is automatically attached to requests that require login. Setting cookie to null returns the client to anonymous mode.You can obtain a valid cookie by opening YouTube Music in a browser, signing in, and copying the
Cookie request header from any music.youtube.com network request in your browser’s developer tools.Make your first search
All
YouTube methods are suspend functions that return Result<T>. Call them from a coroutine scope — runBlocking is used here for simplicity, but in production code use viewModelScope, lifecycleScope, or your own CoroutineScope:SearchFilter is a @JvmInline value class with the following pre-built filters:| Filter | Matches |
|---|---|
SearchFilter.FILTER_SONG | Audio tracks |
SearchFilter.FILTER_VIDEO | Music videos |
SearchFilter.FILTER_ALBUM | Albums and EPs |
SearchFilter.FILTER_ARTIST | Artist pages |
SearchFilter.FILTER_FEATURED_PLAYLIST | Official/curated playlists |
SearchFilter.FILTER_COMMUNITY_PLAYLIST | User-created playlists |
Fetch more results
SearchResult contains an optional continuation token. When it is non-null, more results are available. Pass it to YouTube.searchContinuation() to load the next page:continuation tokens in a loop until the value is null, which signals the last page of results.Next steps
Now that you have a working search call, explore the rest of Inner’s capabilities:- Searching — Typed filters, search summaries, and suggestion autocomplete
- Browsing — Home feed, artist pages, album pages, charts, and moods & genres
- Authentication — Session cookies, visitor data, PoToken, and the
PlaybackAuthStatemodel