Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

A client for one local server.

Cloning is cheap: the underlying connection pool is shared.

Implementations§

Source§

impl Client

Source

pub fn new(base: impl Into<String>) -> Result<Self>

A client for a server on the given address, with no token.

Source

pub fn local() -> Result<Self>

A client for the usual loopback address and port.

Source

pub fn builder() -> ClientBuilder

Start a builder.

Source§

impl Client

Source

pub async fn get_server_info(&self) -> Result<ServerInfo>

Server identity, version, and a pointer to the docs

GET /

Source

pub async fn get_health(&self) -> Result<GetHealthData>

Server health check

GET /health

Source

pub async fn get_utcp_manual(&self) -> Result<UtcpManual>

UTCP tool manual for this server

The manual a Universal Tool Calling Protocol client reads before calling anything. UTCP has no protocol server: the client reads this once and then calls the routes below natively, so the manual is a description of this same API rather than a second way into it.

Generated from this specification, with the call addresses rebased on the address the request arrived at. The same document is published statically at /utcp.json on the documentation site. Behind the token guard like every route but /health.

GET /utcp

Source

pub async fn setup_auth(&self, body: &SetupAuthRequest) -> Result<SetupAuthData>

First-time Google authentication (opens visible browser)

POST /setup-auth

Source

pub async fn de_auth(&self) -> Result<DeAuthData>

Logout, clear all credentials

POST /de-auth

Source

pub async fn re_auth(&self, body: &ReAuthRequest) -> Result<ReAuthData>

Re-authenticate or switch account

POST /re-auth

Source

pub async fn ask_question(&self, body: &AskRequest) -> Result<AskQuestionData>

Ask a question with citation-backed response

POST /ask

Source

pub async fn list_notebooks(&self) -> Result<ListNotebooksData>

List all notebooks in the local library

GET /notebooks

Source

pub async fn add_notebook( &self, body: &AddNotebookRequest, ) -> Result<AddNotebookData>

Manually add a notebook to the library

POST /notebooks

Source

pub async fn list_notebooks_from_nblm( &self, ) -> Result<ListNotebooksFromNblmData>

Scrape all notebooks from NotebookLM UI

GET /notebooks/scrape

Source

pub async fn import_scraped_notebooks( &self, ) -> Result<ImportScrapedNotebooksData>

Bulk import scraped notebooks into local library

POST /notebooks/import-from-scrape

Source

pub async fn auto_discover_notebook( &self, body: &AutoDiscoverNotebookRequest, ) -> Result<AutoDiscoverNotebookData>

Generate notebook metadata autonomously via NotebookLM queries

POST /notebooks/auto-discover

Source

pub async fn search_notebooks( &self, query: &SearchNotebooksQuery, ) -> Result<SearchNotebooksData>

Search the local library by keyword

GET /notebooks/search

Source

pub async fn get_library_stats(&self) -> Result<GetLibraryStatsData>

Library statistics

GET /notebooks/stats

Source

pub async fn delete_notebooks_from_nblm( &self, body: &DeleteNotebooksFromNblmRequest, ) -> Result<DeleteNotebooksFromNblmData>

Delete multiple notebooks at once

DELETE /notebooks/bulk-delete

Source

pub async fn get_notebook(&self, id: &str) -> Result<GetNotebookData>

Get notebook details

GET /notebooks/{id}

Source

pub async fn update_notebook(&self, id: &str) -> Result<UpdateNotebookData>

Update notebook metadata

PUT /notebooks/{id}

Source

pub async fn remove_notebook(&self, id: &str) -> Result<RemoveNotebookData>

Delete a notebook from the library

DELETE /notebooks/{id}

Source

pub async fn select_notebook(&self, id: &str) -> Result<SelectNotebookData>

Set notebook as the default active notebook

PUT /notebooks/{id}/activate

Source

pub async fn create_notebook( &self, body: &CreateNotebookRequest, ) -> Result<CreateNotebookData>

Create a new notebook in NotebookLM

POST /notebooks/create

Source

pub async fn list_sessions(&self) -> Result<ListSessionsData>

List active sessions

GET /sessions

Source

pub async fn close_session(&self, id: &str) -> Result<CloseSessionData>

Close a session

DELETE /sessions/{id}

Source

pub async fn reset_session(&self, id: &str) -> Result<ResetSessionData>

Reset a session’s history

POST /sessions/{id}/reset

Source

pub async fn add_source(&self, body: &AddSourceRequest) -> Result<AddSourceData>

Add a source (file, url, text, youtube, drive) to the active notebook

POST /content/sources

Source

pub async fn delete_source( &self, query: &DeleteSourceQuery, ) -> Result<DeleteSourceData>

Delete source by name (query parameter)

DELETE /content/sources

Source

pub async fn delete_source_by_id( &self, id: &str, ) -> Result<DeleteSourceByIdData>

Delete source by id

DELETE /content/sources/{id}

Source

pub async fn delete_content( &self, content_id: &str, query: &DeleteContentQuery, ) -> Result<DeleteContentData>

Delete a generated Studio artifact

RPC-backed (no browser). Irreversible. Note-backed mind maps are not covered — they live in the notes system, not the Studio library.

DELETE /content/{contentId}

Source

pub async fn list_sources(&self, id: &str) -> Result<ListSourcesData>

List a notebook’s sources with their ids and titles

RPC-backed (no browser). Returns { notebookId, count, sources: [{ id, title }] }. This is where the source ids for /notebooks/{id}/sources/{sourceId} come from.

GET /notebooks/{id}/sources

Source

pub async fn read_source( &self, id: &str, source_id: &str, query: &ReadSourceQuery, ) -> Result<ReadSourceData>

Read a source’s indexed text, one page at a time

RPC-backed (no browser). Returns the exact content NotebookLM reasons over. Sources are long — the first PDF measured ran to 157,716 characters — so the response is paginated by default and carries totalChars, pageChars, offset, hasMore, nextCursor and a plain-language continue instruction. Pages are cut at the nearest line break (tag close, in HTML), and concatenating every page reproduces the document exactly. Pass paginate=false for the whole document in one response. The html rendition preserves structure but inlines images as base64 and is bigger.

GET /notebooks/{id}/sources/{sourceId}

Source

pub async fn rename_source( &self, id: &str, source_id: &str, body: &RenameSourceRequest, ) -> Result<RenameSourceData>

Rename one source in place

RPC-backed (no browser). An empty title is a 400.

PATCH /notebooks/{id}/sources/{sourceId}

Source

pub async fn get_source_guide( &self, id: &str, source_id: &str, ) -> Result<GetSourceGuideData>

NotebookLM’s own summary and key topics for one source

RPC-backed (no browser). A source NotebookLM has not summarised yet returns an empty summary and no topics.

GET /notebooks/{id}/sources/{sourceId}/guide

Source

pub async fn search_passages( &self, id: &str, body: &SearchPassagesRequest, ) -> Result<SearchPassagesData>

Ranked passages from the notebook’s index, without generating an answer

RPC-backed (no browser). Retrieval rather than question answering: nothing is generated and no generation quota is spent. Rank is global across sources and lower is better. start / end are character offsets into the source’s full text, and are null when the server did not give them.

POST /notebooks/{id}/search

Source

pub async fn get_notebook_summary( &self, id: &str, ) -> Result<GetNotebookSummaryData>

A notebook’s own summary of its sources, and the questions it suggests

RPC-backed (no browser). Cheaper than asking a question to find out what a notebook holds.

GET /notebooks/{id}/summary

Source

pub async fn check_source_freshness( &self, id: &str, query: &CheckSourceFreshnessQuery, ) -> Result<CheckSourceFreshnessData>

Have the notebook’s URL / Drive sources drifted?

RPC-backed (no browser). Checks every source unless source_id narrows it. stale: null means the server did not answer for that source — not that it is current.

GET /notebooks/{id}/freshness

Source

pub async fn get_chat_history( &self, id: &str, query: &GetChatHistoryQuery, ) -> Result<GetChatHistoryData>

Read back the recorded questions and answers, newest first

RPC-backed (no browser). NotebookLM exposes only the most recent conversation per notebook; older ones cannot be listed.

GET /notebooks/{id}/chat

Source

pub async fn delete_chat_history( &self, id: &str, query: &DeleteChatHistoryQuery, ) -> Result<DeleteChatHistoryData>

Clear the chat history

The web UI’s “Delete history”. NotebookLM has no per-turn delete, so the whole conversation goes. Nothing to delete is reported as deleted: false, not as a failure.

DELETE /notebooks/{id}/chat

Source

pub async fn get_share_status(&self, id: &str) -> Result<GetShareStatusData>

Read a notebook’s sharing status

GET /notebooks/{id}/share

Source

pub async fn share_notebook( &self, id: &str, body: &ShareNotebookRequest, ) -> Result<ShareNotebookData>

Toggle the public link

PUT /notebooks/{id}/share

Source

pub async fn retry_content( &self, artifact_id: &str, body: &RetryContentRequest, ) -> Result<RetryContentData>

Retry a failed generation, keeping the same artifact id

RPC-backed. The artifact is not deleted and not replaced: the same id goes back to generating, so a reference the caller already holds stays valid. Deleting and regenerating instead mints a new id.

A refusal (rate limit, quota, or an artifact the backend will not retry) comes back as an error. An accepted retry can still fail again on Google’s side — poll GET /content for the outcome.

POST /content/{artifactId}/retry

Source

pub async fn export_artifact( &self, artifact_id: &str, body: &ExportArtifactRequest, ) -> Result<ExportArtifactData>

Export a finished artifact to Google Docs or Sheets

RPC-backed. documentUrl is null when the reply carried no Drive link — the export may still have succeeded; check Drive.

POST /content/{artifactId}/export

Source

pub async fn revise_slide( &self, artifact_id: &str, body: &ReviseSlideRequest, ) -> Result<ReviseSlideData>

Revise one slide of an existing deck from a prompt

RPC-backed. slide_index is zero-based. Returns as soon as the revision is accepted; poll GET /content for the finished deck.

POST /content/{artifactId}/revise-slide

Source

pub async fn list_labels(&self, id: &str) -> Result<ListLabelsData>

List a notebook’s source labels

GET /notebooks/{id}/labels

Source

pub async fn manage_labels( &self, id: &str, body: &ManageLabelsRequest, ) -> Result<ManageLabelsData>

Create or delete source labels

POST /notebooks/{id}/labels

Source

pub async fn generate_study_aid( &self, body: &GenerateStudyAidRequest, ) -> Result<GenerateStudyAidData>

Generate a study aid (flashcards or quiz)

POST /content/study-aid

Source

pub async fn generate_mind_map( &self, body: &GenerateMindMapRequest, ) -> Result<GenerateMindMapData>

Generate and save a mind map

POST /content/mind-map

Source

pub async fn research_sources( &self, body: &ResearchSourcesRequest, ) -> Result<ResearchSourcesData>

Discover web sources for a notebook (Fast Research), optionally importing them

POST /content/research

Source

pub async fn generate_content( &self, body: &GenerateRequest, ) -> Result<GenerateContentData>

Generate Studio content (audio, video, infographic, report, presentation, data table)

POST /content/generate

Source

pub async fn download_content( &self, query: &DownloadContentQuery, ) -> Result<DownloadContentData>

Download a generated artifact (WAV, MP4, PNG)

GET /content/download

Source

pub async fn list_content(&self) -> Result<ListContentData>

List sources and generated content for the active notebook

GET /content

Source

pub async fn create_note(&self) -> Result<CreateNoteData>

Create a note in the active notebook

POST /content/notes

Source

pub async fn save_chat_to_note(&self) -> Result<SaveChatToNoteData>

Save the current chat discussion as a note

POST /content/chat-to-note

Source

pub async fn convert_note_to_source( &self, note_title: &str, ) -> Result<ConvertNoteToSourceData>

Convert a note into a NotebookLM source

POST /content/notes/{noteTitle}/to-source

Source

pub async fn batch_to_vault( &self, body: &BatchToVaultRequest, ) -> Result<BatchToVaultData>

Run a batch of questions and write each answer to a vault directory

Long-running: one NotebookLM answer per question, written as a markdown file conforming to the nblm-answer-v1 schema. Size the client timeout accordingly (and the reverse-proxy read timeout, if any).

POST /batch-to-vault

Source

pub async fn list_notes(&self, body: &ListNotesRequest) -> Result<ListNotesData>

List the notebook’s notes

POST /content/notes/list

Source

pub async fn get_note(&self, body: &GetNoteRequest) -> Result<GetNoteData>

Read one note’s content, by title or id

POST /content/notes/get

Source

pub async fn cleanup_data( &self, body: &CleanupDataRequest, ) -> Result<CleanupDataData>

Wipe all local data (requires confirmation)

POST /cleanup-data

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Client

§

impl !UnwindSafe for Client

§

impl Forget for Client

§

impl Freeze for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl UnsafeUnpin for Client

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more