Documentation 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.
NotebookLMClient is the top-level class you interact with in every Python automation script. It wraps all NotebookLM RPC calls behind typed sub-APIs — notebooks, sources, artifacts, chat, research, notes, settings, and sharing — and manages HTTP connection lifecycle automatically when used as an async context manager. You create it by loading browser-saved authentication state from disk, from an environment variable, or by constructing AuthTokens manually.
Quick start
Class: NotebookLMClient
from_storage() — recommended constructor
The recommended way to instantiate the client. Reads authentication tokens from a Playwright storage-state file, an environment variable, or a named profile and returns a client that is ready to be used inside async with.
Absolute path to a
storage_state.json file. When provided, takes precedence over all other resolution methods.HTTP request timeout in seconds applied to every RPC call made through this client.
Named profile to load auth from (e.g.
"work", "personal"). Corresponds to ~/.notebooklm/profiles/<name>/storage_state.json. Ignored when path is provided.Authentication precedence
When you callfrom_storage() without arguments the client resolves credentials in this order (highest wins):
- Explicit
pathargument NOTEBOOKLM_AUTH_JSONenvironment variable (inline JSON — useful for CI/CD)- Explicit
profileargument NOTEBOOKLM_PROFILEenvironment variable →~/.notebooklm/profiles/<name>/storage_state.json- Active profile read from
~/.notebooklm/active_profile ~/.notebooklm/profiles/default/storage_state.json~/.notebooklm/storage_state.json(legacy fallback)
- Default profile
- Named profile
- Explicit path
- CI/CD (env var)
__init__() — manual constructor
Use this when you already have an AuthTokens instance (e.g. tokens fetched from a secrets manager).
Authentication tokens obtained from browser login. See AuthTokens below.
HTTP request timeout in seconds.
Path to the storage state file. Required for artifact downloads that need cookie authentication.
refresh_auth()
Manually refreshes the CSRF token and session ID by fetching the NotebookLM homepage. The client calls this automatically when it detects authentication errors, so you rarely need to call it yourself. Use it before long-running operations to avoid mid-run token expiry.
AuthTokens with fresh csrf_token and session_id.
Raises: ValueError if the session has fully expired (cookies invalid). In that case, re-run notebooklm login.
Sub-API properties
All sub-APIs are initialized when you construct the client. Access them as properties — no separate instantiation needed.client.notebooks
Create, list, rename, delete notebooks, and fetch AI descriptions.
client.sources
Add URLs, YouTube videos, files, text, and Drive documents as sources.
client.artifacts
Generate audio, video, reports, quizzes, flashcards, and more.
client.chat
Ask questions, continue conversations, and configure the chat persona.
client.research
Run web or Drive research agents and import discovered sources.
client.notes
Create, read, update, and delete text notes and mind maps.
client.settings
Read and set the global output language and check account limits.
client.sharing
Manage public links and per-user sharing permissions.
Properties
The current authentication tokens. You can inspect
auth.csrf_token or auth.session_id to debug auth issues.True when the underlying HTTP client session is open. Always True inside an async with block.Async context manager pattern
The client manages anhttpx.AsyncClient internally. You must open and close it — the recommended way is async with:
Error handling
The library raisesRPCError for API-level failures and domain-specific subclasses for more targeted errors.
AuthTokens
You can also constructAuthTokens directly and pass them to NotebookLMClient() when you manage credentials outside the default storage file.