TheDocumentation 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 Python library exposes all of NotebookLM’s features through a single async client. Every operation goes through NotebookLMClient, which manages HTTP sessions, authentication tokens, and automatic CSRF refresh under the hood. Because the client owns an async HTTP session, you must always open it as an async context manager—or call __aenter__/__aexit__ explicitly.
Client initialization
The recommended way to create a client isNotebookLMClient.from_storage(). This class method reads your saved browser session from disk (written by notebooklm login) and returns a ready-to-use client.
You must
await the call to from_storage() and then use it as an async with context manager. Omitting either step leaves the HTTP session open or raises a runtime error.Authentication profiles
from_storage() accepts optional path and profile arguments so you can target a specific storage file or a named profile created with notebooklm profile create.
Environment variable support
The client respects the following environment variables, which is useful for CI/CD pipelines and container deployments.| Variable | Description |
|---|---|
NOTEBOOKLM_HOME | Base directory for config files (default: ~/.notebooklm) |
NOTEBOOKLM_PROFILE | Active profile name (default: default) |
NOTEBOOKLM_AUTH_JSON | Inline auth JSON string—no file needed (for CI/CD) |
NOTEBOOKLM_AUTH_JSON is set, from_storage() reads auth directly from the environment variable and never touches the filesystem, making it safe to use in ephemeral CI runners.
Available sub-APIs
NotebookLMClient exposes eight sub-APIs as attributes. Each group is documented in its own reference page.
notebooks
Create, list, rename, delete notebooks, and retrieve AI-generated summaries and metadata.
sources
Add URLs, YouTube videos, files, Google Drive docs, and pasted text; get fulltext and guides.
artifacts
Generate audio, video, quizzes, flashcards, reports, infographics, data tables, and mind maps; download and export results.
chat
Ask questions across sources, continue conversations, configure personas, and retrieve history.
research
Start web or Drive research agents (fast or deep mode) and import discovered sources.
notes
Create, read, update, and delete text notes and mind-map notes within a notebook.
settings
Read and set the global output language, and query account limits and subscription tier.
sharing
Enable public links, control view levels, and manage per-user viewer/editor permissions.
Complete working example
The example below shows the most common flow: creating a notebook, adding a source, chatting, and generating an audio overview. Run it end-to-end after authenticating withnotebooklm login.
Error handling
The library raises specific exception types so you can handle different failure modes precisely. Import them from the top-levelnotebooklm package.
| Exception | When it fires |
|---|---|
AuthError | Session cookies expired (HTTP 401/403) |
RateLimitError | Google rate-limit throttle |
RPCError | General API failure (base class for the above) |
Manual auth refresh
The client automatically refreshes CSRF tokens when it detects an auth error. For long-running scripts, you can proactively refresh before a batch of operations to avoid mid-run failures.Rate limiting best practices
Google throttles aggressive API usage. When running batch operations, add short delays between calls to stay within limits.--retry N in the CLI (or the equivalent wait_for_completion with polling) for automatic exponential backoff when generating content.