Skip to main content

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.

client.sharing gives you full control over how a notebook is shared — both publicly via a link and privately with individual users by email. You can read the current sharing state, toggle public access, restrict what anonymous viewers can see, and grant or revoke editor or viewer permissions for specific Google accounts. All sharing operations return a ShareStatus object reflecting the notebook’s complete sharing configuration after the change.

Methods

get_status(notebook_id)

Reads the current sharing configuration for a notebook.
async def get_status(notebook_id: str) -> ShareStatus
notebook_id
str
required
The notebook ID.
return
ShareStatus
Full sharing configuration including public status, view level, shared users, and share URL.
status = await client.sharing.get_status(nb_id)
print(f"Public: {status.is_public}")
print(f"Share URL: {status.share_url}")
print(f"Shared with: {[u.email for u in status.shared_users]}")

set_public(notebook_id, public)

Enables or disables public link sharing for the notebook.
async def set_public(notebook_id: str, public: bool) -> ShareStatus
notebook_id
str
required
The notebook ID.
public
bool
required
True to make the notebook accessible to anyone with the link; False to restrict to explicitly shared users only.
return
ShareStatus
Updated ShareStatus. When public=True, status.share_url contains the public URL.
# Enable public access
status = await client.sharing.set_public(nb_id, True)
print(f"Share URL: {status.share_url}")

# Disable public access
status = await client.sharing.set_public(nb_id, False)

set_view_level(notebook_id, level)

Controls what anonymous (link-based) viewers can access when the notebook is public.
async def set_view_level(notebook_id: str, level: ShareViewLevel) -> None
notebook_id
str
required
The notebook ID.
level
ShareViewLevel
required
ShareViewLevel.FULL_NOTEBOOK — viewers can access chat, sources, and notes.
ShareViewLevel.CHAT_ONLY — viewers can only use the chat interface.
from notebooklm import ShareViewLevel

# Restrict to chat only
await client.sharing.set_view_level(nb_id, ShareViewLevel.CHAT_ONLY)

# Allow full access
await client.sharing.set_view_level(nb_id, ShareViewLevel.FULL_NOTEBOOK)

add_user(notebook_id, email, permission, notify, welcome_message)

Shares the notebook with a specific Google account by email.
async def add_user(
    notebook_id: str,
    email: str,
    permission: SharePermission,
    notify: bool = True,
    welcome_message: str = "",
) -> ShareStatus
notebook_id
str
required
The notebook ID.
email
str
required
Google account email address of the user to add.
permission
SharePermission
required
SharePermission.EDITOR — can edit notebook content.
SharePermission.VIEWER — read-only access.
notify
bool
default:"true"
When True, Google sends an email notification to the invited user.
welcome_message
str
default:"\"\""
Optional message to include in the notification email.
return
ShareStatus
Updated ShareStatus including the newly added user.
from notebooklm import SharePermission

status = await client.sharing.add_user(
    nb_id,
    "colleague@example.com",
    SharePermission.VIEWER,
    notify=True,
    welcome_message="Check out my research notebook!",
)

update_user(notebook_id, email, permission)

Changes the permission level for a user already sharing the notebook.
async def update_user(
    notebook_id: str,
    email: str,
    permission: SharePermission,
) -> ShareStatus
notebook_id
str
required
The notebook ID.
email
str
required
Email of the user whose permission should change.
permission
SharePermission
required
New permission level (EDITOR or VIEWER).
return
ShareStatus
Updated ShareStatus.
status = await client.sharing.update_user(
    nb_id,
    "colleague@example.com",
    SharePermission.EDITOR,
)

remove_user(notebook_id, email)

Revokes all access for a user.
async def remove_user(notebook_id: str, email: str) -> ShareStatus
notebook_id
str
required
The notebook ID.
email
str
required
Email of the user to remove.
return
ShareStatus
Updated ShareStatus without the removed user.
status = await client.sharing.remove_user(nb_id, "colleague@example.com")

ShareStatus dataclass

notebook_id
str
The notebook this status describes.
is_public
bool
True when anyone with the link can access the notebook.
access
ShareAccess
ShareAccess.RESTRICTED — only explicitly shared users.
ShareAccess.ANYONE_WITH_LINK — public link active.
view_level
ShareViewLevel
FULL_NOTEBOOK or CHAT_ONLY.
shared_users
list[SharedUser]
List of users with explicit access. Does not include the notebook owner.
share_url
str | None
Public share URL when is_public=True, otherwise None.

SharedUser dataclass

email
str
User’s Google account email.
permission
SharePermission
Current permission level: OWNER, EDITOR, or VIEWER.
display_name
str | None
User’s display name, or None if not available.
avatar_url
str | None
URL to the user’s profile avatar, or None.

Sharing enums

SharePermission

ValueDescription
SharePermission.OWNERFull control. Cannot be assigned — read-only, indicates the notebook owner.
SharePermission.EDITORCan edit notebook content, add sources, generate artifacts.
SharePermission.VIEWERRead-only access.

ShareViewLevel

ValueDescription
ShareViewLevel.FULL_NOTEBOOKViewers access chat, sources, and notes.
ShareViewLevel.CHAT_ONLYViewers only see the chat interface.

ShareAccess

ValueDescription
ShareAccess.RESTRICTEDOnly explicitly invited users can access the notebook.
ShareAccess.ANYONE_WITH_LINKAnyone with the share URL can access the notebook.

Complete sharing workflow example

import asyncio
from notebooklm import NotebookLMClient, SharePermission, ShareViewLevel

async def main():
    async with await NotebookLMClient.from_storage() as client:
        nb_id = "your_notebook_id"

        # Check current sharing state
        status = await client.sharing.get_status(nb_id)
        print(f"Public: {status.is_public}")
        print(f"Users: {[u.email for u in status.shared_users]}")

        # Enable public sharing with chat-only view
        status = await client.sharing.set_public(nb_id, True)
        print(f"Share URL: {status.share_url}")

        await client.sharing.set_view_level(nb_id, ShareViewLevel.CHAT_ONLY)

        # Add a collaborator as an editor
        status = await client.sharing.add_user(
            nb_id,
            "colleague@example.com",
            SharePermission.EDITOR,
            notify=True,
            welcome_message="I've shared my research with you!",
        )

        # Downgrade to viewer
        status = await client.sharing.update_user(
            nb_id,
            "colleague@example.com",
            SharePermission.VIEWER,
        )

        # Revoke access
        status = await client.sharing.remove_user(nb_id, "colleague@example.com")

        # Disable public sharing
        status = await client.sharing.set_public(nb_id, False)
        print(f"Sharing disabled. is_public={status.is_public}")

asyncio.run(main())

Build docs developers (and LLMs) love