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
impl Client
Sourcepub async fn get_server_info(&self) -> Result<ServerInfo>
pub async fn get_server_info(&self) -> Result<ServerInfo>
Server identity, version, and a pointer to the docs
GET /
Sourcepub async fn get_health(&self) -> Result<GetHealthData>
pub async fn get_health(&self) -> Result<GetHealthData>
Server health check
GET /health
Sourcepub async fn get_utcp_manual(&self) -> Result<UtcpManual>
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
Sourcepub async fn setup_auth(&self, body: &SetupAuthRequest) -> Result<SetupAuthData>
pub async fn setup_auth(&self, body: &SetupAuthRequest) -> Result<SetupAuthData>
First-time Google authentication (opens visible browser)
POST /setup-auth
Sourcepub async fn de_auth(&self) -> Result<DeAuthData>
pub async fn de_auth(&self) -> Result<DeAuthData>
Logout, clear all credentials
POST /de-auth
Sourcepub async fn re_auth(&self, body: &ReAuthRequest) -> Result<ReAuthData>
pub async fn re_auth(&self, body: &ReAuthRequest) -> Result<ReAuthData>
Re-authenticate or switch account
POST /re-auth
Sourcepub async fn ask_question(&self, body: &AskRequest) -> Result<AskQuestionData>
pub async fn ask_question(&self, body: &AskRequest) -> Result<AskQuestionData>
Ask a question with citation-backed response
POST /ask
Sourcepub async fn list_notebooks(&self) -> Result<ListNotebooksData>
pub async fn list_notebooks(&self) -> Result<ListNotebooksData>
List all notebooks in the local library
GET /notebooks
Sourcepub async fn add_notebook(
&self,
body: &AddNotebookRequest,
) -> Result<AddNotebookData>
pub async fn add_notebook( &self, body: &AddNotebookRequest, ) -> Result<AddNotebookData>
Manually add a notebook to the library
POST /notebooks
Sourcepub async fn list_notebooks_from_nblm(
&self,
) -> Result<ListNotebooksFromNblmData>
pub async fn list_notebooks_from_nblm( &self, ) -> Result<ListNotebooksFromNblmData>
Scrape all notebooks from NotebookLM UI
GET /notebooks/scrape
Sourcepub async fn import_scraped_notebooks(
&self,
) -> Result<ImportScrapedNotebooksData>
pub async fn import_scraped_notebooks( &self, ) -> Result<ImportScrapedNotebooksData>
Bulk import scraped notebooks into local library
POST /notebooks/import-from-scrape
Sourcepub async fn auto_discover_notebook(
&self,
body: &AutoDiscoverNotebookRequest,
) -> Result<AutoDiscoverNotebookData>
pub async fn auto_discover_notebook( &self, body: &AutoDiscoverNotebookRequest, ) -> Result<AutoDiscoverNotebookData>
Generate notebook metadata autonomously via NotebookLM queries
POST /notebooks/auto-discover
Sourcepub async fn search_notebooks(
&self,
query: &SearchNotebooksQuery,
) -> Result<SearchNotebooksData>
pub async fn search_notebooks( &self, query: &SearchNotebooksQuery, ) -> Result<SearchNotebooksData>
Search the local library by keyword
GET /notebooks/search
Sourcepub async fn get_library_stats(&self) -> Result<GetLibraryStatsData>
pub async fn get_library_stats(&self) -> Result<GetLibraryStatsData>
Library statistics
GET /notebooks/stats
Sourcepub async fn delete_notebooks_from_nblm(
&self,
body: &DeleteNotebooksFromNblmRequest,
) -> Result<DeleteNotebooksFromNblmData>
pub async fn delete_notebooks_from_nblm( &self, body: &DeleteNotebooksFromNblmRequest, ) -> Result<DeleteNotebooksFromNblmData>
Delete multiple notebooks at once
DELETE /notebooks/bulk-delete
Sourcepub async fn get_notebook(&self, id: &str) -> Result<GetNotebookData>
pub async fn get_notebook(&self, id: &str) -> Result<GetNotebookData>
Get notebook details
GET /notebooks/{id}
Sourcepub async fn update_notebook(&self, id: &str) -> Result<UpdateNotebookData>
pub async fn update_notebook(&self, id: &str) -> Result<UpdateNotebookData>
Update notebook metadata
PUT /notebooks/{id}
Sourcepub async fn remove_notebook(&self, id: &str) -> Result<RemoveNotebookData>
pub async fn remove_notebook(&self, id: &str) -> Result<RemoveNotebookData>
Delete a notebook from the library
DELETE /notebooks/{id}
Sourcepub async fn select_notebook(&self, id: &str) -> Result<SelectNotebookData>
pub async fn select_notebook(&self, id: &str) -> Result<SelectNotebookData>
Set notebook as the default active notebook
PUT /notebooks/{id}/activate
Sourcepub async fn create_notebook(
&self,
body: &CreateNotebookRequest,
) -> Result<CreateNotebookData>
pub async fn create_notebook( &self, body: &CreateNotebookRequest, ) -> Result<CreateNotebookData>
Create a new notebook in NotebookLM
POST /notebooks/create
Sourcepub async fn list_sessions(&self) -> Result<ListSessionsData>
pub async fn list_sessions(&self) -> Result<ListSessionsData>
List active sessions
GET /sessions
Sourcepub async fn close_session(&self, id: &str) -> Result<CloseSessionData>
pub async fn close_session(&self, id: &str) -> Result<CloseSessionData>
Close a session
DELETE /sessions/{id}
Sourcepub async fn reset_session(&self, id: &str) -> Result<ResetSessionData>
pub async fn reset_session(&self, id: &str) -> Result<ResetSessionData>
Reset a session’s history
POST /sessions/{id}/reset
Sourcepub async fn add_source(&self, body: &AddSourceRequest) -> Result<AddSourceData>
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
Sourcepub async fn delete_source(
&self,
query: &DeleteSourceQuery,
) -> Result<DeleteSourceData>
pub async fn delete_source( &self, query: &DeleteSourceQuery, ) -> Result<DeleteSourceData>
Delete source by name (query parameter)
DELETE /content/sources
Sourcepub async fn delete_source_by_id(
&self,
id: &str,
) -> Result<DeleteSourceByIdData>
pub async fn delete_source_by_id( &self, id: &str, ) -> Result<DeleteSourceByIdData>
Delete source by id
DELETE /content/sources/{id}
Sourcepub async fn delete_content(
&self,
content_id: &str,
query: &DeleteContentQuery,
) -> Result<DeleteContentData>
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}
Sourcepub async fn list_sources(&self, id: &str) -> Result<ListSourcesData>
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
Sourcepub async fn read_source(
&self,
id: &str,
source_id: &str,
query: &ReadSourceQuery,
) -> Result<ReadSourceData>
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}
Sourcepub async fn rename_source(
&self,
id: &str,
source_id: &str,
body: &RenameSourceRequest,
) -> Result<RenameSourceData>
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}
Sourcepub async fn get_source_guide(
&self,
id: &str,
source_id: &str,
) -> Result<GetSourceGuideData>
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
Sourcepub async fn search_passages(
&self,
id: &str,
body: &SearchPassagesRequest,
) -> Result<SearchPassagesData>
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
Sourcepub async fn get_notebook_summary(
&self,
id: &str,
) -> Result<GetNotebookSummaryData>
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
Sourcepub async fn check_source_freshness(
&self,
id: &str,
query: &CheckSourceFreshnessQuery,
) -> Result<CheckSourceFreshnessData>
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
Sourcepub async fn get_chat_history(
&self,
id: &str,
query: &GetChatHistoryQuery,
) -> Result<GetChatHistoryData>
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
Sourcepub async fn delete_chat_history(
&self,
id: &str,
query: &DeleteChatHistoryQuery,
) -> Result<DeleteChatHistoryData>
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
Read a notebook’s sharing status
GET /notebooks/{id}/share
Toggle the public link
PUT /notebooks/{id}/share
Sourcepub async fn retry_content(
&self,
artifact_id: &str,
body: &RetryContentRequest,
) -> Result<RetryContentData>
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
Sourcepub async fn export_artifact(
&self,
artifact_id: &str,
body: &ExportArtifactRequest,
) -> Result<ExportArtifactData>
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
Sourcepub async fn revise_slide(
&self,
artifact_id: &str,
body: &ReviseSlideRequest,
) -> Result<ReviseSlideData>
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
Sourcepub async fn list_labels(&self, id: &str) -> Result<ListLabelsData>
pub async fn list_labels(&self, id: &str) -> Result<ListLabelsData>
List a notebook’s source labels
GET /notebooks/{id}/labels
Sourcepub async fn manage_labels(
&self,
id: &str,
body: &ManageLabelsRequest,
) -> Result<ManageLabelsData>
pub async fn manage_labels( &self, id: &str, body: &ManageLabelsRequest, ) -> Result<ManageLabelsData>
Create or delete source labels
POST /notebooks/{id}/labels
Sourcepub async fn generate_study_aid(
&self,
body: &GenerateStudyAidRequest,
) -> Result<GenerateStudyAidData>
pub async fn generate_study_aid( &self, body: &GenerateStudyAidRequest, ) -> Result<GenerateStudyAidData>
Generate a study aid (flashcards or quiz)
POST /content/study-aid
Sourcepub async fn generate_mind_map(
&self,
body: &GenerateMindMapRequest,
) -> Result<GenerateMindMapData>
pub async fn generate_mind_map( &self, body: &GenerateMindMapRequest, ) -> Result<GenerateMindMapData>
Generate and save a mind map
POST /content/mind-map
Sourcepub async fn research_sources(
&self,
body: &ResearchSourcesRequest,
) -> Result<ResearchSourcesData>
pub async fn research_sources( &self, body: &ResearchSourcesRequest, ) -> Result<ResearchSourcesData>
Discover web sources for a notebook (Fast Research), optionally importing them
POST /content/research
Sourcepub async fn generate_content(
&self,
body: &GenerateRequest,
) -> Result<GenerateContentData>
pub async fn generate_content( &self, body: &GenerateRequest, ) -> Result<GenerateContentData>
Generate Studio content (audio, video, infographic, report, presentation, data table)
POST /content/generate
Sourcepub async fn download_content(
&self,
query: &DownloadContentQuery,
) -> Result<DownloadContentData>
pub async fn download_content( &self, query: &DownloadContentQuery, ) -> Result<DownloadContentData>
Download a generated artifact (WAV, MP4, PNG)
GET /content/download
Sourcepub async fn list_content(&self) -> Result<ListContentData>
pub async fn list_content(&self) -> Result<ListContentData>
List sources and generated content for the active notebook
GET /content
Sourcepub async fn create_note(&self) -> Result<CreateNoteData>
pub async fn create_note(&self) -> Result<CreateNoteData>
Create a note in the active notebook
POST /content/notes
Sourcepub async fn save_chat_to_note(&self) -> Result<SaveChatToNoteData>
pub async fn save_chat_to_note(&self) -> Result<SaveChatToNoteData>
Save the current chat discussion as a note
POST /content/chat-to-note
Sourcepub async fn convert_note_to_source(
&self,
note_title: &str,
) -> Result<ConvertNoteToSourceData>
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
Sourcepub async fn batch_to_vault(
&self,
body: &BatchToVaultRequest,
) -> Result<BatchToVaultData>
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
Sourcepub async fn list_notes(&self, body: &ListNotesRequest) -> Result<ListNotesData>
pub async fn list_notes(&self, body: &ListNotesRequest) -> Result<ListNotesData>
List the notebook’s notes
POST /content/notes/list
Sourcepub async fn get_note(&self, body: &GetNoteRequest) -> Result<GetNoteData>
pub async fn get_note(&self, body: &GetNoteRequest) -> Result<GetNoteData>
Read one note’s content, by title or id
POST /content/notes/get
Sourcepub async fn cleanup_data(
&self,
body: &CleanupDataRequest,
) -> Result<CleanupDataData>
pub async fn cleanup_data( &self, body: &CleanupDataRequest, ) -> Result<CleanupDataData>
Wipe all local data (requires confirmation)
POST /cleanup-data