Gemini Notebook API

The Gemini Notebook API is a REST interface for programmatically creating and managing notebooks and sources in Gemini Notebook. Ingest web pages, YouTube videos, plain text, and Markdown into persistent notebooks.

Python

import requests

API = "https://notebook.googleapis.com/v1"
headers = {
    "Authorization": f"Bearer {ACCESS_TOKEN}",
    "x-goog-user-project": PROJECT_ID,
    "Content-Type": "application/json",
}

# 1. Create a notebook
nb = requests.post(f"{API}/notebooks", headers=headers, json={
    "display_name": "My Research"
}).json()

# 2. Add a source
requests.post(f"{API}/{nb['name']}/sources", headers=headers, json={
    "display_name": "Gemini API Guide",
    "web_content": {"url": "https://ai.google.dev/gemini-api/docs"}
})

JavaScript

const API = "https://notebook.googleapis.com/v1";
const headers = {
  "Authorization": `Bearer ${ACCESS_TOKEN}`,
  "x-goog-user-project": PROJECT_ID,
  "Content-Type": "application/json"
};

// 1. Create a notebook
const nb = await (await fetch(`${API}/notebooks`, {
  method: "POST",
  headers,
  body: JSON.stringify({ display_name: "My Research" })
})).json();

// 2. Add a source
await fetch(`${API}/${nb.name}/sources`, {
  method: "POST",
  headers,
  body: JSON.stringify({
    display_name: "Gemini API Guide",
    web_content: { url: "https://ai.google.dev/gemini-api/docs" }
  })
});

REST

# 1. Create a notebook
NOTEBOOK=$(curl -s -X POST "https://notebook.googleapis.com/v1/notebooks" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "x-goog-user-project: $PROJECT_ID" \
  -H "Content-Type: application/json" \
  -d '{"display_name": "My Research"}')

NOTEBOOK_NAME=$(echo "$NOTEBOOK" | python3 -c "import sys, json; print(json.load(sys.stdin)['name'])")

# 2. Add a source
curl -s -X POST "https://notebook.googleapis.com/v1/${NOTEBOOK_NAME}/sources" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "x-goog-user-project: $PROJECT_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "display_name": "Gemini API Guide",
    "web_content": {"url": "https://ai.google.dev/gemini-api/docs"}
  }'

Feedback

We'd love to hear what you want the Gemini Notebook API and MCP server to do. See our roadmap for upcoming capabilities, and file feature requests or bug reports in our Issue Tracker.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-11-02 UTC.