Skip to main content
Browse docs
By Audience
Getting Started
Configuration
Use Cases
IDE Integration
Third-Party Integrations
Engineering Cache
Console
API Reference
Gateway
Workflow Guides
Templates
Providers and SDKs
Industry Guides
Advanced Guides
Browse by Role
Deployment Guides
In-Depth Guides
Tutorials
FAQ

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 your PATH (for custom integration routing)
  • NOTION_API_KEY exported for Notion API access
  • OPENAI_API_KEY or 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

  1. Create a Notion integration at notion.so/my-integrations with read access to target pages.

  2. Export your keys:

export NOTION_API_KEY="ntn_your-integration-token"
export OPENAI_API_KEY="sk-your-api-key"
  1. Save the policy config to policy-config.yaml.

  2. Start the gateway:

kt gateway run --listen 0.0.0.0:41002 --policy-config policy-config.yaml
  1. Route your custom Notion AI pipeline through http://localhost:41002/v1 instead 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.

PolicyPurposeRecommended setting
pii-detectorRedact personal data from Notion content before LLM processingaction: redact, entities: EMAIL, PHONE, SSN
content-filterBlock restricted content from being processedaction: block, configure categories
audit-loggerLog all AI processing of Notion contentimmutable: true, retention_days: 365
dlp-filterDetect and block proprietary patterns in Notion contentConfigure regex patterns for internal identifiers
cost-attributionTrack spend on Notion AI workflows per teamTag requests with team metadata

Troubleshooting

SymptomCauseFix
Notion API returns 401Integration token invalid or page not sharedVerify integration token and share target pages with the integration
Cannot route native Notion AINotion AI uses internal LLM infrastructureUse Pattern 1 (audit) or Pattern 2 (custom workflows) instead
Gateway returns 403Policy chain blocked the requestReview 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-28 or 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