nblm-rs
Unofficial command-line interface for NotebookLM Enterprise API written in Rust.
[!WARNING] This is an unofficial tool and is not affiliated with or endorsed by Google. Use at your own risk.
Motivation
Why use this CLI instead of direct API calls or web UI?
- Credential caching: Leverages gcloud authentication cache - no need to specify API keys or tokens repeatedly
- Type safety: Rust's type system catches errors at compile time, preventing runtime failures
- Batch operations: Add multiple sources to a notebook in a single command
- Better error handling: Clear, actionable error messages with helpful guidance
- Automatic retries: Built-in retry logic with exponential backoff for transient failures
- JSON output: Machine-readable format for automation and scripting workflows
- Cross-platform: Single binary works on Linux, macOS, and Windows
- Developer-friendly: Command-line interface integrates seamlessly with shell scripts and CI/CD pipelines
Features (Verified as of 2025-10-19)
[!NOTE] The NotebookLM API is currently in alpha. Some features may not work as documented due to API limitations. See Known API Issues for details.
Notebooks
| Feature | Command | Status | Notes |
|---|---|---|---|
| Create notebook | notebooks create |
Working | |
| List recent notebooks | notebooks recent |
Working | Pagination not implemented by API |
| Delete notebook(s) | notebooks delete |
Working | Sequential deletion (API limitation) |
Sources
| Feature | Command | Status | Notes |
|---|---|---|---|
| Add web URL | sources add --web-url |
Working | |
| Add text content | sources add --text |
Working | |
| Add video (YouTube) | sources add --video-url |
Working | Uses youtubeUrl field |
| Add Google Drive | sources add --drive-* |
Not Working | API returns HTTP 500 |
| Delete source(s) | sources delete |
Working |
Audio Overview
| Feature | Command | Status | Notes |
|---|---|---|---|
| Create audio overview | audio create |
Working | Config fields not supported |
| Delete audio overview | audio delete |
Working |
Sharing
| Feature | Command | Status | Notes |
|---|---|---|---|
| Share notebook | share add |
Untested | Requires additional users |
Installation
Prerequisites
- Rust 1.90.0 or later
- Google Cloud project with NotebookLM API enabled
- Authentication credentials (gcloud, service account, or access token)
Build from source
The binary will be available at target/release/nblm.
Authentication
Method 1: gcloud CLI
Method 2: Service Account
# Create service account key
# Use with environment variable
# Or specify key file directly
[!IMPORTANT] Service account requires
roles/editorpermission.
Method 3: Environment Variable Token
Configuration
Project Number
Get your Google Cloud project number:
# Using gcloud CLI
The project number is a unique numerical identifier (e.g., 123456789012).
Locations
The NotebookLM API supports the following multi-region locations:
global- Recommended by Google for best performance and full feature setus- United States (for compliance/regulatory requirements)eu- European Union (for compliance/regulatory requirements)
[!NOTE]
NBLM_LOCATIONandNBLM_ENDPOINT_LOCATIONmust be set to the same value. Google recommends usingglobalunless you have specific compliance or regulatory requirements. See the official documentation for details.
Environment Variables
You can use environment variables to avoid repeating common options:
# Your project number
# Recommended: global
# Must match NBLM_LOCATION
# Now you can run commands without these flags
Usage Examples
Notebooks
# Create a new notebook
# List recently viewed notebooks
# List with pagination (note: API doesn't implement pagination yet)
# Delete a notebook
# Delete multiple notebooks (executed sequentially due to API limitation)
Sources
# Add web URL
# Add text content
# Add YouTube video
# Add multiple sources at once
# Delete sources
[!WARNING] Google Drive source addition currently returns HTTP 500 Internal Server Error. This is an API-side issue as of 2025-10-19.
Audio Overview
# Create audio overview
# Delete audio overview
[!NOTE] Despite API documentation mentioning
languageCode,sourceIds, andepisodeFocusfields, the API only accepts empty request body as of 2025-10-19. Language and other settings must be configured through the NotebookLM UI.
Sharing
# Share notebook with a user (untested)
# Share with multiple users
Available roles: owner, writer, reader, not-shared
JSON Output
All commands support --json flag for machine-readable output. The flag can be placed anywhere in the command:
# All of these work
# Parse with jq
|
Known API Issues
[!WARNING] The following issues have been discovered through testing and are documented in the code:
Google Drive Sources (HTTP 500)
As of 2025-10-19, adding Google Drive sources returns HTTP 500 Internal Server Error. This occurs even with proper authentication (gcloud auth login --enable-gdrive-access) and correct IAM permissions. The CLI includes warnings when attempting to use this feature.
Audio Overview Configuration Fields
The API documentation mentions languageCode, sourceIds, and episodeFocus fields, but the actual API rejects all of these fields with "Unknown name" errors. Only empty request body {} is accepted. These fields are commented out in the code for future use when the API implements them.
Notebook Batch Deletion
Despite the API endpoint being named batchDelete and accepting an array of notebook names, it only works with a single notebook at a time. The CLI works around this by calling the API sequentially for each notebook.
Pagination Not Implemented
The notebooks recent command accepts --page-size and --page-token parameters, but the NotebookLM API never returns nextPageToken in responses, indicating pagination is not currently implemented.
All of these have been corrected in the implementation.
Development
See CONTRIBUTING.md for development setup, testing guidelines, and contribution workflow.
[!IMPORTANT] All pull requests must pass
cargo make allbefore being merged.
License
MIT
Acknowledgments
This project uses the NotebookLM Enterprise API. See the official documentation for more information.