All runtime configuration for the InnerTube SDK is exposed as mutable properties on theDocumentation 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 singleton object. Internally each property is delegated to the underlying InnerTube instance, so a single assignment on YouTube immediately takes effect for all subsequent API calls. No builder pattern or restart is required.
Configuration properties
Locale
Controls the country and language sent with every API request.
YouTubeLocale is a two-field data class: gl is an ISO 3166-1 alpha-2 country code (e.g. "US") and hl is a BCP 47 language tag (e.g. "en"). The default value uses Locale.getDefault() from the Android runtime.Visitor data
An opaque token that YouTube uses to track anonymous session state. Providing a stable visitor ID improves response quality, reduces bot-detection challenges, and is passed as the
X-Goog-Visitor-Id header on every request. Persist this value across sessions to maintain continuity.YouTube.visitorData():
Authentication cookie
A raw cookie string for authenticated requests. When set, InnerTube sends the cookie and a computed
SAPISIDHASH Authorization header on endpoints that require login (playlist mutation, library access, playback telemetry, etc.). Must be obtained from a logged-in YouTube Music browser session.Data sync ID
The
dataSyncId is an account identifier sent as onBehalfOfUser in request bodies for authenticated browse and player calls. It can be extracted from the response of YouTube.accountInfo() after setting a valid cookie. Required for library edits and personalised content to be scoped to the correct account.Login for browse
When
true, authentication headers (cookie + SAPISIDHASH) are injected into every browse request, including public ones. This is useful when you want YouTube to return personalised responses (e.g. whether an artist is subscribed, whether a playlist is liked) even for pages that do not strictly require login.Proxy
A standard
java.net.Proxy instance. When assigned, the InnerTube HTTP client is immediately rebuilt to route all traffic through the specified proxy. Supports both SOCKS and HTTP proxy types.Optional proxy authentication credential. The string is passed verbatim as the
Proxy-Authorization header value. For Basic auth, set this to "Basic " + Base64.encode("user:password").Assigning a new value to
YouTube.proxy closes the existing OkHttp client and creates a fresh one. Schedule proxy changes before your first API call, not in the middle of a request burst.Network timeouts
TheInnerTube HTTP client is configured with the following default timeout values baked into the OkHttp engine:
| Timeout | Default |
|---|---|
| Connect timeout | 30 seconds |
| Read timeout | 60 seconds |
| Write timeout | 60 seconds |
| Request timeout (Ktor) | 60 seconds |
NetworkConfig utility object.
NetworkConfig
NetworkConfig provides two helpers for advanced network configuration:
Builds a standalone Ktor
HttpClient backed by OkHttp, pre-configured with the library’s standard timeouts, gzip/deflate content encoding, and an optional 128 MB disk cache. Useful when you want to make raw HTTP calls without going through the YouTube singleton, or when you need to embed the client in a custom DI graph.Returns a
TimeoutConfig data class with connect, read, and request timeout values tuned for the given NetworkQuality level (EXCELLENT, GOOD, POOR, or UNKNOWN). Integrate with a connectivity manager to dynamically adjust timeouts based on actual network conditions.Complete configuration example
The following snippet shows a typical production setup applied once at application startup (e.g. inApplication.onCreate()):