notebooklm-py stores all authentication and session data underDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/teng-lin/notebooklm-py/llms.txt
Use this file to discover all available pages before exploring further.
~/.notebooklm/ by default, organized into named profiles. You can relocate this directory, select a different profile per-command, or bypass the filesystem entirely for CI/CD using environment variables.
File locations
All data lives under~/.notebooklm/, with each profile getting its own subdirectory:
If you’re upgrading from a pre-profile version, the first run automatically migrates flat files into
profiles/default/. The legacy flat layout continues to work as a fallback.storage_state.json contains the authentication cookies extracted from your browser session, including the required cookies SID, HSID, SSID, APISID, SAPISID, __Secure-1PSID, and __Secure-3PSID.
context.json stores the active notebook and conversation IDs used by the CLI. It is managed automatically by notebooklm use and notebooklm clear.
browser_profile/ is a persistent Chromium user data directory used only during notebooklm login. The persistence makes the browser appear as a regular user installation, which helps avoid bot detection. To reset it, delete the browser_profile/ directory and run notebooklm login again.
Environment variables
You can override every configuration aspect using environment variables. The full set is listed below:| Variable | Default | Description |
|---|---|---|
NOTEBOOKLM_HOME | ~/.notebooklm | Base directory for all configuration files |
NOTEBOOKLM_PROFILE | default | Active profile name |
NOTEBOOKLM_AUTH_JSON | — | Inline authentication JSON; ideal for CI/CD |
NOTEBOOKLM_LOG_LEVEL | WARNING | Logging level: DEBUG, INFO, WARNING, or ERROR |
NOTEBOOKLM_DEBUG_RPC | false | Legacy: enable RPC debug logging (use NOTEBOOKLM_LOG_LEVEL=DEBUG instead) |
NOTEBOOKLM_HOME
UseNOTEBOOKLM_HOME to relocate all configuration files to a custom directory. This is useful for per-project isolation or containerized environments:
NOTEBOOKLM_PROFILE
UseNOTEBOOKLM_PROFILE to select a profile for the current shell session without changing the persisted active profile:
-p work on every command. The -p CLI flag takes precedence over the environment variable.
NOTEBOOKLM_AUTH_JSON
UseNOTEBOOKLM_AUTH_JSON to provide authentication inline without writing any files to disk. This is the recommended approach for CI/CD:
--storageCLI flag (highest priority)NOTEBOOKLM_AUTH_JSONenvironment variable- Profile-aware path:
$NOTEBOOKLM_HOME/profiles/<profile>/storage_state.json ~/.notebooklm/profiles/default/storage_state.json(default)~/.notebooklm/storage_state.json(legacy fallback)
You cannot run
notebooklm login when NOTEBOOKLM_AUTH_JSON is set.CLI global options
Every notebooklm command accepts these global options:| Option | Default | Description |
|---|---|---|
--storage PATH | Profile storage path | Path to a specific storage_state.json |
-p, --profile NAME | Active profile or default | Use a named profile for this command |
-v, --verbose | — | Enable verbose output |
--version | — | Show the installed version |
--help | — | Show help |
Viewing configuration paths
To see exactly which files notebooklm is reading from, run:Session management
Session lifetime
Sessions are tied to Google’s cookie expiration. In practice, sessions last several days to weeks, though Google may invalidate them earlier due to security events or suspicious activity patterns.Automatic CSRF token refresh
The client automatically refreshes CSRF tokens and session IDs when authentication errors are detected. When an RPC call fails with an auth error, the client fetches a fresh CSRF token from the NotebookLM homepage and retries the request once. Concurrent requests share a single refresh task to prevent token thrashing. This means most “session expired” errors resolve transparently without any action on your part.Manual re-authentication
If your underlying session cookies have fully expired (beyond what automatic refresh can handle), re-authenticate:Multiple accounts with profiles
Profiles let you manage multiple Google accounts under a single home directory. Each profile stores its ownstorage_state.json, context.json, and browser_profile/.
You can also use
NOTEBOOKLM_HOME for full directory-level isolation between accounts:
CI/CD configuration
GitHub Actions
The recommended approach for CI/CD is to pass your authentication as a secret viaNOTEBOOKLM_AUTH_JSON. No files are written to disk, and the secret stays in memory only.
notebooklm login locally, copy the contents of ~/.notebooklm/profiles/default/storage_state.json, and add it as a GitHub repository secret named NOTEBOOKLM_AUTH_JSON.
Session expiration in long-running pipelines
CSRF tokens are automatically refreshed during API calls, but the underlying session cookies still expire every one to two weeks. For long-running pipelines, update theNOTEBOOKLM_AUTH_JSON secret regularly and monitor for persistent authentication failures, which indicate that the cookies themselves have expired.
Platform notes
notebooklm-py supports macOS, Linux, Windows, and WSL. The only platform-specific setup requirement involves Playwright, which is needed only fornotebooklm login. All other operations use standard HTTP via httpx.
macOS works out of the box. Chromium is downloaded automatically by Playwright.
Linux requires installing Playwright’s system dependencies before running login:
NOTEBOOKLM_HOME using PowerShell syntax:
notebooklm login without Playwright installed. Copy a valid storage_state.json from a machine with a display, or use NOTEBOOKLM_AUTH_JSON:
Health checks and debugging
Runnotebooklm doctor to check that your installation is healthy and your authentication is valid.
To enable detailed logging, set NOTEBOOKLM_LOG_LEVEL=DEBUG before any command:
NOTEBOOKLM_DEBUG_RPC=1: