Use NotebookLM like an API

NotebookLM doesn't have a public API. nlm::gateway fixes that. Run it on your own server, connect your Google account once, and query your notebooks via REST or a simple web chat.

Try it now → /chat /api
Terminal
GET /health
{ "status": "running", "sessions": 2 }
POST /api/ask
{ "response": "Ayash studied at UMY..." }

What you get

REST API

Send queries as JSON. Get back clean text and markdown. No browser automation needed on your client.

Web Chat UI

A no-install terminal-style chat interface. Switch notebooks, browse history, and see live session status.

SQLite persistence

Every conversation is saved locally per device. History survives restarts. Your data stays on your server.

Multi-user isolation

Each browser gets its own ID and history. Shared server, separate conversations. No login system required.

Session pooling

Pre-warmed Playwright pages mean sub-second responses. LRU eviction keeps memory bounded.

Docker-ready

One docker compose up and you're done. Mount your auth file, and it just works.

How it works

1

Log in once

Run npm run login. It reads your Google cookies from Chrome (macOS Keychain or Windows DPAPI) and saves them to auth-state.json. That's your only auth step.

2

Point to a notebook

Paste any NotebookLM URL into the web UI or send it to /api/notebook. The gateway loads the page in a headless browser in the background.

3

Query away

Type a question in the chat or POST to /api/ask. The gateway submits it to NotebookLM, waits for the response, strips citation markers, and returns clean JSON.

Built for developers

Simple JSON in, structured JSON out. No tokens, no rate-limit dashboards — just your own Google session running on your own hardware.

curl
curl -X POST http://localhost:3005/api/ask \
  -H "Content-Type: application/json" \
  -d '{"query": "Summarize the methodology"}'

Endpoints

GET /health Status, sessions, cookie expiry
POST /api/ask Send a query, get text + markdown
GET /api/history Per-device conversation history
POST /api/notebook Set or switch active notebook
PATCH /api/notebook Rename a saved notebook
DELETE /api/notebook Remove a saved notebook profile
GET /api Swagger UI docs

Get started

Clone, log in, and run. Or use Docker.

npm
git clone https://github.com/Ayash13/notebook-lm-gateway.git
cd notebook-lm-gateway
npm install
npm run login   # one-time cookie extraction
npm start       # http://localhost:3005
docker
docker run -d \
  --name nlm-gateway \
  -p 3005:3005 \
  -v $(pwd)/auth-state.json:/app/auth-state.json:ro \
  -v nlm-gateway-db:/app/data \
  -e PORT=3005 \
  -e DB_DIR=/app/data \
  --restart unless-stopped \
  ayash13/notebook-lm-gateway:latest

Expose to the internet

ngrok http --domain=your-domain.ngrok-free.app 3005 cloudflared tunnel --url localhost:3005