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.

Start building

Just want to get started? Go to the Quickstart, copy the setup prompt, and give it to your coding agent.

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"}
  }'

Guides and resources

REST API reference

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.