NotebookLM Enterprise is a powerful tool for generating insights and summaries from your documents. This page describes the APIs that let you perform the following notebook management tasks programmatically:
- Create a notebook
- Retrieve a notebook
- List recently viewed notebooks
- Delete notebooks in batch
- Share a notebook
Additionally, you can manage the data sources for your notebooks by performing the following tasks:
Create a notebook
To create a new notebook, use the notebooks.create
method.
REST
curl
-X
POST
\
-H
"Authorization:Bearer
$(
gcloud
auth
print-access-token )
"
\
-H
"Content-Type: application/json"
\
"https:// ENDPOINT_LOCATION-
discoveryengine.googleapis.com/v1alpha/projects/ PROJECT_NUMBER
/locations/ LOCATION
/notebooks"
\
-d
'{
"title": " NOTEBOOK_TITLE
",
}'
Replace the following:
-
ENDPOINT_LOCATION
: the multi-region for your API request. Assign one of the following values:-
us-
for the US multi-region -
eu-
for the EU multi-region - Leave it empty for the Global or
global
location
-
-
PROJECT_NUMBER
: the number of your Google Cloud project. -
LOCATION
: the geographic location of your data store, such asglobal
. For more information, see Locations . -
NOTEBOOK_TITLE
: a UTF-8 encoded string used as a title for the notebook that you want to create.
If the request is successful, you should receive a JSON similar to the following.
{
"title"
:
" NOTEBOOK_TITLE
"
,
"notebookId"
:
" NOTEBOOK_ID
"
,
"emoji"
:
""
,
"metadata"
:
{
"userRole"
:
"PROJECT_ROLE_OWNER"
,
"isShared"
:
false
,
"isShareable"
:
true
},
"name"
:
" NOTEBOOK_NAME
"
}
Note the following:
-
NOTEBOOK_ID
: a unique ID to identify the created notebook. You need the notebook ID for other notebook management tasks, such as sharing or retrieving. -
NOTEBOOK_NAME
: the complete resources name of the notebook. This field has the following pattern:projects/ PROJECT_NUMBER /locations/ LOCATION /notebooks/ NOTEBOOK_ID
Access the created notebook and get its ID in a browser
To access the created notebook and get its ID using a browser, do the following.
-
Go to the NotebookLM Enterprise homepage that's available at the following URL:
https://notebooklm.cloud.google/ LOCATION /?project= PROJECT_NUMBER
-
Select the created notebook.
The URL of the selected notebook has the following pattern:
https://notebooklm.cloud.google/ LOCATION /notebook/ NOTEBOOK_ID ?project= PROJECT_NUMBER
-
Note the URL and the notebook ID, which are useful for other notebook management tasks, such as sharing.
Retrieve a notebook
To retrieve a specific notebook using its notebook ID, use the notebooks.get
method.
REST
curl
-X
GET
\
-H
"Authorization:Bearer
$(
gcloud
auth
print-access-token )
"
\
-H
"Content-Type: application/json"
\
"https:// ENDPOINT_LOCATION-
discoveryengine.googleapis.com/v1alpha/projects/ PROJECT_NUMBER
/locations/ LOCATION
/notebooks/ NOTEBOOK_ID
"
Replace the following:
-
ENDPOINT_LOCATION
: the multi-region for your API request. Assign one of the following values:-
us-
for the US multi-region -
eu-
for the EU multi-region - Leave it empty for the Global or
global
location
-
-
PROJECT_NUMBER
: the number of your Google Cloud project. -
LOCATION
: the geographic location of your data store, such asglobal
. For more information, see Locations . -
NOTEBOOK_ID
: the notebook's unique identifier that you received when you created the notebook.
If the request is successful, you should get a JSON response similar to the following.
{
"title"
:
" NOTEBOOK_TITLE
"
,
"notebookId"
:
" NOTEBOOK_ID
"
,
"emoji"
:
""
,
"metadata"
:
{
"userRole"
:
"PROJECT_ROLE_OWNER"
,
"isShared"
:
false
,
"isShareable"
:
true
,
"lastViewed"
:
" LAST_VIEWED_TIME
"
,
"createTime"
:
" LAST_CREATED_TIME
"
},
"name"
:
" NOTEBOOK_NAME
"
}
List recently viewed notebooks
To get a list of all notebooks in a project that were recently viewed, use the notebooks.listRecentlyViewed
method. By default, the response lists the last 500 notebooks. You can choose
to paginate the responses with the pageSize
query parameter.
REST
curl
-X
GET
\
-H
"Authorization:Bearer
$(
gcloud
auth
print-access-token )
"
\
-H
"Content-Type: application/json"
\
"https:// ENDPOINT_LOCATION-
discoveryengine.googleapis.com/v1alpha/projects/ PROJECT_NUMBER
/locations/ LOCATION
/notebooks:listRecentlyViewed"
Replace the following:
-
ENDPOINT_LOCATION
: the multi-region for your API request. Assign one of the following values:-
us-
for the US multi-region -
eu-
for the EU multi-region - Leave it empty for the Global or
global
location
-
-
PROJECT_NUMBER
: the number of your Google Cloud project. -
LOCATION
: the geographic location of your data store, such asglobal
. For more information, see Locations .
If the request is successful, you should get a JSON response similar to the following. The response contains all the last 500 notebooks that a user accessed recently.
{
"notebooks"
:
[
{
"title"
:
" NOTEBOOK_TITLE_1
"
,
"notebookId"
:
" NOTEBOOK_ID_1
"
,
"emoji"
:
""
,
"metadata"
:
{
"userRole"
:
"PROJECT_ROLE_OWNER"
,
"isShared"
:
false
,
"isShareable"
:
true
,
"lastViewed"
:
" LAST_VIEWED_TIME
"
,
"createTime"
:
" LAST_CREATED_TIME
"
},
"name"
:
" NOTEBOOK_NAME_1
"
},
{
"title"
:
" NOTEBOOK_TITLE_2
"
,
"notebookId"
:
" NOTEBOOK_ID_2
"
,
"emoji"
:
""
,
"metadata"
:
{
"userRole"
:
"PROJECT_ROLE_OWNER"
,
"isShared"
:
false
,
"isShareable"
:
true
,
"lastViewed"
:
" LAST_VIEWED_TIME
"
,
"createTime"
:
" LAST_CREATED_TIME
"
},
"name"
:
" NOTEBOOK_NAME_2
"
}
]
}
Delete notebooks in batch
To delete notebooks in batch, use the notebooks.batchDelete
method.
REST
curl
-X
POST
\
-H
"Authorization:Bearer
$(
gcloud
auth
print-access-token )
"
\
-H
"Content-Type: application/json"
\
"https:// ENDPOINT_LOCATION-
discoveryengine.googleapis.com/v1alpha/projects/ PROJECT_NUMBER
/locations/ LOCATION
/notebooks:batchDelete"
-d
'{
"names": [
" NOTEBOOK_NAME_1
",
" NOTEBOOK_NAME_2
"
]
}'
Replace the following:
-
ENDPOINT_LOCATION
: the multi-region for your API request. Assign one of the following values:-
us-
for the US multi-region -
eu-
for the EU multi-region - Leave it empty for the Global or
global
location
-
-
PROJECT_NUMBER
: the number of your Google Cloud project. -
LOCATION
: the geographic location of your data store, such asglobal
. For more information, see Locations . -
NOTEBOOK_NAME
: the complete resources name of the notebook to be deleted. This field has the pattern:projects/ PROJECT_NUMBER /locations/ LOCATION /notebooks/ NOTEBOOK_ID
.If the request is successful, you should receive an empty JSON object.
Share a notebook
To share a new notebook, use the notebooks.share
method.
REST
-
In your Google Cloud project, assign the
Cloud NotebookLM User
Identity and Access Management (IAM) role to the users with whom you want to share the notebook. -
Call the following method.
curl -X POST \ -H "Authorization:Bearer $( gcloud auth print-access-token ) " \ -H "Content-Type: application/json" \ "https:// ENDPOINT_LOCATION- -discoveryengine.googleapis.com/v1alpha/projects/ PROJECT_NUMBER /locations/ LOCATION /notebooks/ NOTEBOOK_ID :share" \ -d '{ "accountAndRoles": [ { "email":" USER_EMAIL_1 ", "role":" USER_ROLE_1 ", }, { "email":" USER_EMAIL_2 ", "role":" USER_ROLE_2 ", }, ] }'
Replace the following:
-
ENDPOINT_LOCATION
: the multi-region for your API request. Assign one of the following values:-
us-
for the US multi-region -
eu-
for the EU multi-region - Leave it empty for the Global or
global
location
-
-
PROJECT_NUMBER
: the number of your Google Cloud project. -
LOCATION
: the geographic location of your data store, such asglobal
. For more information, see Locations . -
NOTEBOOK_ID
: a unique ID to identify the notebook that you want to share. You need the notebook ID for other notebook management tasks, such as sharing or retrieving. -
USER_EMAIL
: the email address of the user with whom you want to share the notebook. -
USER_ROLE
: a role that you want to assign to the user. It can be one of the following:-
PROJECT_ROLE_OWNER
: The user owns the project. -
PROJECT_ROLE_WRITER
: The user has writer permissions on the project. -
PROJECT_ROLE_READER
: The user has reader permissions on the project. -
PROJECT_ROLE_NOT_SHARED
:The user has no access to the project.
-
If the request is successful, you receive an empty JSON object.
-
Verify users using a browser
To verify whether you've shared the notebook with the correct users and assigned them correct roles, do the following:
-
Open the notebook in your browser. A notebook has the following URL pattern:
https://notebooklm.cloud.google/ LOCATION /notebook/ NOTEBOOK_ID ?project= PROJECT_ID
-
Click Share.
-
Verify the users listed as People with accessand their assigned roles.
Add data sources to a notebook
To add sources to a notebook, call the notebooks.sources.batchCreate
method. It supports various content types
including Google Docs, Google Slides, raw text, web content, and YouTube
videos.
REST
curl
-X
POST
\
-H
"Authorization:Bearer
$(
gcloud
auth
print-access-token )
"
\
-H
"Content-Type: application/json"
\
"https:// ENDPOINT_LOCATION-
discoveryengine.googleapis.com/v1alpha/projects/ PROJECT_NUMBER
/locations/ LOCATION
/notebooks/ NOTEBOOK_ID
/sources:batchCreate"
\
-d
'{
"userContents": [
{
USER_CONTENT
}
]
}'
Replace the following:
-
ENDPOINT_LOCATION
: the multi-region for your API request. Assign one of the following values:-
us-
for the US multi-region -
eu-
for the EU multi-region - Leave it empty for the Global or
global
location
-
-
PROJECT_NUMBER
: the number of your Google Cloud project. -
LOCATION
: the geographic location of your data store, such asglobal
. For more information, see Locations . -
NOTEBOOK_ID
: The unique identifier of the notebook. -
USER_CONTENT
: The data source content. ```
You can add only one of the following data sources as your content:
-
For Google Drive content consisting of Google Docs or Google Slides, add:
"googleDriveContent": { "documentId": " DOCUMENT_ID_GOOGLE ", "mimeType": " MIME_TYPE ", "sourceName": " DISPLAY_NAME_GOOGLE " }
Replace the following:
-
DOCUMENT_ID_GOOGLE
: the ID of the Google Drive document. -
MIME_TYPE
: the mime type of the selected document. Useapplication/vnd.google-apps.document
for Google Docs orapplication/vnd.google-apps.presentation
for Google Slides. -
DISPLAY_NAME_GOOGLE
: the display name of the data source.
-
-
For raw text input, add:
"textContent": { "sourceName": " DISPLAY_NAME_TEXT ", "content": " TEXT_CONTENT " }
Replace the following:
-
DISPLAY_NAME_TEXT
: the display name of the data source. -
TEXT_CONTENT
: the raw text content that you want to upload as a data source.
-
-
For web content, add:
"webContent": { "url": " URL_WEBCONTENT ", "sourceName": " DISPLAY_NAME_WEB " }
Replace the following:
-
URL_WEBCONTENT
: the URL of the content that you want to upload as a data source. -
DISPLAY_NAME_WEB
: the display name of the data source.
-
-
For video content, add:
"videoContent": { "url": " URL_YOUTUBE " }
Replace
URL_YOUTUBE
with the URL of the YouTube video that you want to upload as a data source. -
For content in Google Agentspace, add:
"agentspaceContent": { "documentName": " DOCUMENT_NAME ", "engineName": " ENGINE_NAME ", "ideaforgeIdeaName": " IDEA_GEN_APP_NAME " }
Replace the following:
-
DOCUMENT_NAME
: the resource name of an Google Agentspace document that you want to upload as a data source. -
ENGINE_NAME
: the resource name of the Google Agentspace app that contains the document. -
IDEA_GEN_APP_NAME
: the resource name of the Idea Generation agent that you want to upload as a data source.
-
If the request is successful, you should get an instance of the source
object as a response, similar to the following JSON. Note the SOURCE_RESOURCE_NAME
, which is required to perform
other tasks, such as deleting the data source.
{
"sources"
:
[
{
"sourceId"
:
{
"id"
:
" SOURCE_ID
"
}
,
"title"
:
" DISPLAY_NAME
"
,
"metadata"
:
{
...
}
,
"settings"
:
{
"status"
:
"SOURCE_STATUS_COMPLETE"
}
,
"name"
:
" SOURCE_RESOURCE_NAME
"
}
]
}
Delete data sources from a notebook
To delete data sources in bulk from a notebook, use the notebooks.sources.batchDelete
method.
REST
curl
-X
POST
\
-H
"Authorization:Bearer
$(
gcloud
auth
print-access-token )
"
\
-H
"Content-Type: application/json"
\
"https:// ENDPOINT_LOCATION-
discoveryengine.googleapis.com/v1alpha/projects/ PROJECT_NUMBER
/locations/ LOCATION
/notebooks/"
NOTEBOOK_ID
"/sources:batchDelete"
-d
'{
"names": [
" SOURCE_RESOURCE_NAME_1
",
" SOURCE_RESOURCE_NAME_2
"
]
}'
Replace the following:
-
ENDPOINT_LOCATION
: The multi-region of the endpoint, eitherus
oreu
. -
PROJECT_NUMBER
: the number of your Google Cloud project. -
LOCATION
: the geographic location of your data store, such asglobal
. For more information, see Locations . -
NOTEBOOK_ID
: The unique identifier of the notebook. -
SOURCE_RESOURCE_NAME
: the complete resources name of the data source to be deleted. This field has the pattern:projects/ PROJECT_NUMBER /locations/ LOCATION /notebooks/ NOTEBOOK_ID /source/ SOURCE_ID
.
If the request is successful, you should receive an empty JSON object.