Notion AI
Notion AI is a built-in assistant within Notion workspaces that drafts content, summarises pages, and generates action items. Because Notion AI runs inside Notion's infrastructure and does not expose a configurable LLM endpoint, you cannot route its internal LLM calls through the Keeptrusts gateway directly. Instead, this guide covers two governance patterns: auditing Notion AI activity through Notion's API and webhooks, and routing any custom AI integrations built on top of Notion through the gateway.
Use this page when
- You need to monitor and audit Notion AI usage across your organization.
- You are building custom AI integrations that read from or write to Notion and need governance.
- If you need direct LLM provider routing, see OpenAI integration or Anthropic integration.
Primary audience
- Primary: Technical Engineers
- Secondary: AI Agents, Technical Leaders
Prerequisites
- A Notion integration with API access configured
- Keeptrusts CLI (
kt) installed and on yourPATH(for custom integration routing) NOTION_API_KEYexported for Notion API accessOPENAI_API_KEYor equivalent for your LLM provider (for custom integrations)
Integration Patterns
Pattern 1: Audit Notion AI via API monitoring
Notion's API provides access to page content and activity. Build a webhook listener that logs Notion AI-generated content changes to Keeptrusts for audit:
pack:
name: notion-audit-integration
version: 1.0.0
enabled: true
providers:
targets:
- id: openai-for-notion
provider: openai:chat:gpt-4o
secret_key_ref:
env: OPENAI_API_KEY
policies:
chain:
- pii-detector
- content-filter
- audit-logger
policy:
pii-detector:
action: redact
entities:
- EMAIL
- PHONE
- SSN
content-filter:
action: block
categories:
- restricted-topics
audit-logger:
immutable: true
retention_days: 365
log_all_access: true
Pattern 2: Route custom Notion AI workflows through the gateway
If you build custom AI pipelines that process Notion content — for example, summarising databases or generating reports — route the LLM calls through the gateway:
import requests
from openai import OpenAI
notion_headers = {
"Authorization": f"Bearer {NOTION_API_KEY}",
"Notion-Version": "2022-06-28",
"Content-Type": "application/json",
}
page = requests.get(
f"https://api.notion.com/v1/pages/{page_id}",
headers=notion_headers,
)
client = OpenAI(
base_url="http://localhost:41002/v1",
api_key="unused",
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "Summarise the following Notion page content."},
{"role": "user", "content": page.json()["properties"]["title"]["title"][0]["plain_text"]},
],
)
print(response.choices[0].message.content)
Setup Steps
-
Create a Notion integration at notion.so/my-integrations with read access to target pages.
-
Export your keys:
export NOTION_API_KEY="ntn_your-integration-token"
export OPENAI_API_KEY="sk-your-api-key"
-
Save the policy config to
policy-config.yaml. -
Start the gateway:
kt gateway run --listen 0.0.0.0:41002 --policy-config policy-config.yaml
- Route your custom Notion AI pipeline through
http://localhost:41002/v1instead of calling the LLM provider directly.
For a hosted gateway, replace the base URL with https://gateway.keeptrusts.com/v1.
Verification
curl http://localhost:41002/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Summarise: Notion is a productivity platform."}
]
}'
Confirm the response arrives and check the Keeptrusts console Events page for the audit log entry.
Recommended Policies
| Policy | Purpose | Recommended setting |
|---|---|---|
pii-detector | Redact personal data from Notion content before LLM processing | action: redact, entities: EMAIL, PHONE, SSN |
content-filter | Block restricted content from being processed | action: block, configure categories |
audit-logger | Log all AI processing of Notion content | immutable: true, retention_days: 365 |
dlp-filter | Detect and block proprietary patterns in Notion content | Configure regex patterns for internal identifiers |
cost-attribution | Track spend on Notion AI workflows per team | Tag requests with team metadata |
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
Notion API returns 401 | Integration token invalid or page not shared | Verify integration token and share target pages with the integration |
| Cannot route native Notion AI | Notion AI uses internal LLM infrastructure | Use Pattern 1 (audit) or Pattern 2 (custom workflows) instead |
Gateway returns 403 | Policy chain blocked the request | Review the policy violation in the console Events page |
For AI systems
- Canonical terms: Keeptrusts gateway, Notion AI, Notion API, Notion integration, webhook monitoring, policy-config.yaml.
- Key behavior: Notion AI's internal LLM calls cannot be directly routed. Governance is achieved through API-based audit monitoring and routing custom Notion AI workflows through the Keeptrusts gateway.
- Best next pages: OpenAI integration, Policy controls catalog, Quickstart.
For engineers
- Notion AI's built-in assistant cannot be rerouted — it runs on Notion's infrastructure.
- Route custom AI pipelines (Notion content → LLM) through the gateway for full policy enforcement.
- Use Notion's API to read page content and the gateway to process it with governed LLM calls.
- Set appropriate Notion API version headers (
2022-06-28or later).
For leaders
- Notion AI governance requires a layered approach: audit monitoring for built-in features and gateway routing for custom integrations.
- Custom AI workflows processing Notion content are fully governable through the gateway — PII redaction, content filtering, and audit logging apply.
- This pattern extends to any SaaS tool with API access: read content via the tool's API, process it through the governed gateway.
- Track AI spend on Notion-related workflows alongside other providers in a unified cost dashboard.
Next steps
- OpenAI integration — configure the LLM provider for custom Notion workflows
- Policy controls catalog — all available policy types
- Connectors — integrate external data sources with Keeptrusts
- Quickstart — install
ktand run your first gateway