How to Use the Notion Developer Platform with AI Agents: CLI, Webhooks, and SDK
Notion's new developer platform lets AI agents read, write, and trigger workflows in Notion via CLI, webhooks, and an agents SDK. Here's how to connect it.
What Notion’s Developer Platform Actually Gives You
Notion has quietly evolved from a note-taking app into a programmable workspace. The Notion developer platform — which includes a REST API, an official SDK, webhook support, a CLI, and MCP server tooling — now gives AI agents genuine read-write access to the data and workflows that live inside Notion.
That matters because most teams already store significant context in Notion: project briefs, databases, wikis, task lists, meeting notes. If your AI agent can interact with all of that — not just read it, but create, update, and respond to changes — you open up a different class of automation entirely.
This guide covers how each layer of the Notion developer platform works, how AI agents connect to it, and where to start if you want to build something useful today.
The Core Components: API, SDK, CLI, and Webhooks
Before getting into specifics, it helps to understand what each piece of the platform does and how they relate.
- REST API — The foundation. Every integration ultimately talks to Notion through HTTP endpoints for pages, databases, blocks, users, and comments.
- JavaScript/TypeScript SDK (
@notionhq/client) — An official client library that wraps the REST API with typed methods and handles pagination automatically. - Notion CLI — A command-line tool for scaffolding and managing integrations during development.
- Webhooks — Event-driven notifications that fire when content in Notion changes, letting external systems react in real time.
- MCP Server — Notion’s Model Context Protocol server, which exposes Notion capabilities to AI systems like Claude as callable tools.
How Remy works. You talk. Remy ships.
Each layer serves a different use case. The SDK is best for application logic. Webhooks are for event-driven pipelines. The CLI speeds up development. The MCP server is specifically for direct AI agent access.
Setting Up a Notion Integration
Create an Integration in the Developer Portal
All access to Notion’s API starts with creating an integration at developers.notion.com. You define the integration name, associate it with a workspace, and choose capability scopes:
- Read content — access pages and databases
- Update content — modify existing pages and properties
- Insert content — create new pages and blocks
- Read user information — access workspace member details
Each integration gets an internal integration token (for internal workspace use) or can use OAuth 2.0 for user-facing applications that connect to third-party workspaces.
Share Pages with Your Integration
After creating the integration, you need to explicitly share pages or databases with it. Notion uses a capability model where integrations don’t have blanket access — users must grant access per resource. In Notion, open any page, go to the ”…” menu, find “Connections,” and add your integration.
This intentional scoping means AI agents can only see what they’ve been explicitly granted access to, which is a useful security boundary.
Store Your Token Securely
Your integration token goes in environment variables, never in source code.
NOTION_TOKEN=secret_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Using the Notion SDK for AI Agent Workflows
Installing the Client
npm install @notionhq/client
The SDK is designed for Node.js and TypeScript environments, though you can use it in any JavaScript runtime. It handles rate limiting automatically and provides full type coverage on the response objects.
Querying a Notion Database
Databases are where the most useful structured data lives. To query one:
import { Client } from "@notionhq/client";
const notion = new Client({ auth: process.env.NOTION_TOKEN });
const response = await notion.databases.query({
database_id: "YOUR_DATABASE_ID",
filter: {
property: "Status",
select: {
equals: "In Progress",
},
},
sorts: [
{
property: "Last edited time",
direction: "descending",
},
],
});
const pages = response.results;
This is immediately useful for AI agents that need to reason over task lists, project trackers, or CRM data stored in Notion databases.
Creating Pages Programmatically
An AI agent that can write back to Notion becomes much more useful. Here’s how to create a new page inside a database:
const newPage = await notion.pages.create({
parent: { database_id: "YOUR_DATABASE_ID" },
properties: {
Name: {
title: [{ text: { content: "AI-Generated Summary: Q2 Review" } }],
},
Status: {
select: { name: "Draft" },
},
"Created By": {
rich_text: [{ text: { content: "AI Agent" } }],
},
},
});
Appending Blocks to Existing Pages
For content generation — meeting summaries, report drafts, research notes — your agent can append blocks to existing pages:
await notion.blocks.children.append({
block_id: pageId,
children: [
{
object: "block",
type: "heading_2",
heading_2: {
rich_text: [{ type: "text", text: { content: "Summary" } }],
},
},
{
object: "block",
type: "paragraph",
paragraph: {
rich_text: [
{ type: "text", text: { content: agentGeneratedSummary } },
],
},
},
],
});
This pattern — AI generates content, agent writes it back to Notion — is how you turn Notion from a static repository into a living document system.
Using the Notion CLI
Other agents start typing. Remy starts asking.
Scoping, trade-offs, edge cases — the real work. Before a line of code.
What the CLI Does
The Notion CLI (@notionhq/cli) is a developer productivity tool for building and managing integrations. It’s not a user-facing tool — it’s for engineers who are actively building against the Notion API.
Install it globally:
npm install -g @notionhq/cli
Authenticate:
notion login
Common CLI Commands
The CLI covers several development tasks:
# Initialize a new integration project
notion init
# List databases accessible to your integration
notion databases list
# Inspect a specific database schema
notion databases retrieve <database-id>
# Check integration capabilities
notion integrations list
For AI agent development, the databases retrieve command is particularly useful — it shows you the exact property schema of a database so you can build typed queries and mutations without guessing at field names or types.
Setting Up Notion Webhooks
Why Webhooks Matter for AI Agents
Polling the Notion API on a schedule is fine for batch jobs, but it’s inefficient for real-time automation. Webhooks let Notion push events to your agent the moment something changes — a task gets completed, a page gets created, a property gets updated.
This is the difference between an AI agent that checks Notion every 15 minutes and an agent that knows about changes within seconds.
Configuring a Webhook
Webhooks are configured through the Notion developer portal under your integration settings. You provide:
- Endpoint URL — the public HTTPS endpoint that will receive POST requests
- Event subscriptions — which events trigger the webhook (page created, page updated, database item created, etc.)
Notion sends a POST request to your endpoint with a JSON payload describing the event.
Verifying Webhook Authenticity
Notion signs webhook payloads with an HMAC signature in the X-Notion-Signature header. Always verify this before processing:
import crypto from "crypto";
function verifyWebhookSignature(payload, signature, secret) {
const expectedSig = crypto
.createHmac("sha256", secret)
.update(payload)
.digest("hex");
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(`sha256=${expectedSig}`)
);
}
A Practical Webhook Workflow
Here’s a common pattern for an AI agent triggered by Notion webhook events:
- A project manager updates a task status in Notion to “Needs Review”
- Notion fires a webhook to your endpoint
- Your agent receives the event, reads the task details via API
- The agent generates a structured review checklist using an LLM
- The agent appends the checklist to the task page in Notion
- The agent sends a Slack notification to the assigned reviewer
That entire loop can complete in a few seconds. No manual work, no scheduled batch job.
Connecting AI Agents via Notion’s MCP Server
What MCP Means for Notion
Notion published an official Model Context Protocol (MCP) server that exposes Notion capabilities as tools AI systems can call natively. Instead of manually wiring API calls, you give an AI system — like Claude — access to the Notion MCP server, and it can interact with Notion as part of its reasoning process.
MCP is becoming the standard protocol for AI-to-tool communication, and Notion adopting it means agents built on any MCP-compatible framework can work with Notion out of the box.
Setting Up the Notion MCP Server
Other agents ship a demo. Remy ships an app.
Real backend. Real database. Real auth. Real plumbing. Remy has it all.
The server is available as an npm package:
npm install @notionhq/notion-mcp-server
Configure it in your Claude Desktop or MCP client config:
{
"mcpServers": {
"notion": {
"command": "npx",
"args": ["-y", "@notionhq/notion-mcp-server"],
"env": {
"NOTION_API_TOKEN": "your-integration-token"
}
}
}
}
Once connected, the AI model can call tools like search_notion, get_page, create_database_item, and append_block_children as part of its reasoning — without you writing any glue code.
What This Enables
With MCP-connected Notion access, an AI agent can:
- Search across your workspace to find relevant context before answering questions
- Update task properties based on natural language instructions
- Draft and publish structured content to the right pages automatically
- Query databases and return filtered, sorted results as context for further reasoning
This is notably different from a simple chatbot that talks about Notion — it’s an agent that actually reads and writes your real workspace data.
How MindStudio Fits Into This
If you want to build Notion-connected AI agents without managing infrastructure yourself, MindStudio is worth looking at. It has native Notion integration built in — you can connect your Notion workspace and query databases, create pages, or append content as steps in a visual workflow.
Where this gets interesting is combining Notion with other logic. Say you want an agent that:
- Monitors a Notion database for new client intake forms
- Runs each submission through an AI model to extract key requirements
- Creates a project brief page in Notion with a structured summary
- Sends a Slack notification to the assigned account manager
In MindStudio, that’s a single workflow you can build in under an hour without writing API code. The webhook trigger, the LLM reasoning step, the Notion write-back, and the Slack notification are all handled through the visual builder.
MindStudio also supports custom JavaScript for cases where you need more control — so if the standard Notion integration doesn’t cover a specific API endpoint, you can write a function block that calls it directly.
You can start building for free at mindstudio.ai.
Common Patterns and Practical Use Cases
Automated Documentation
AI agents can watch for changes in project databases and automatically generate or update documentation pages. When a sprint closes, the agent pulls completed tasks, summarizes the work, and writes a retrospective page — structured, consistent, and ready for stakeholder review.
AI-Enhanced CRM in Notion
Teams that use Notion as a lightweight CRM can have an AI agent enrich contact records automatically. When a new contact is added, the agent searches for public information, drafts a relationship summary, and updates the database properties — no manual research needed.
Content Workflow Automation
Editorial teams using Notion for content planning can trigger AI drafts from database entries. A content brief gets created in Notion, a webhook fires, an agent generates a first draft with headers and key points, and the draft lands in a Notion page linked to the brief.
Meeting Note Processing
Everyone else built a construction worker.
We built the contractor.
One file at a time.
UI, API, database, deploy.
An agent receives raw meeting transcripts, extracts action items, and creates tasks in a Notion database — assigned to the right people, tagged with due dates, linked to the relevant project page.
Frequently Asked Questions
What is the Notion developer platform?
The Notion developer platform is a set of tools for building integrations and automations that connect to Notion workspaces. It includes the Notion REST API, an official JavaScript/TypeScript SDK (@notionhq/client), webhook support for real-time events, a CLI for development workflows, and an MCP server for direct AI agent integration. Together, these allow developers and AI systems to read and write Notion content programmatically.
How do AI agents authenticate with Notion?
AI agents authenticate using an integration token generated in the Notion developer portal. For internal tools that operate within a single workspace, internal integration tokens work well. For tools that need to access multiple user workspaces, Notion supports OAuth 2.0 — the agent requests authorization and receives a user-scoped access token. The token is passed as a Bearer token in API request headers.
What can an AI agent do with the Notion API?
With the right permissions, an AI agent can query and filter database records, read page content and block structure, create new pages in databases, update page properties, append blocks (text, headings, tables, code) to existing pages, search across the workspace, and retrieve user information. Agents cannot, however, access content that hasn’t been explicitly shared with the integration.
What events can Notion webhooks trigger on?
Notion webhooks can fire on events including page creation, page property updates, page content changes, database item creation and updates, and comment additions. The exact event types available depend on your integration’s capability scopes and the specific webhook configuration. Each event payload includes metadata about what changed and which page or database was affected — which the agent can then use to fetch the full updated content via API.
Is Notion’s MCP server production-ready?
The official Notion MCP server is actively maintained and is suitable for developer use and internal tooling. Like any MCP integration, the reliability of your setup depends on your MCP host configuration and the stability of your integration token. For production agent workflows, treat the MCP connection like any external API dependency — build in error handling, verify webhook signatures, and test edge cases like rate limits and token expiration.
Do I need to write code to use Notion with AI agents?
Not necessarily. No-code platforms like MindStudio have native Notion integration and let you build agent workflows visually. For more custom or complex integrations — particularly around webhook handling, authentication flows, or MCP server configuration — you’ll need some technical setup. The SDK itself is relatively straightforward for developers familiar with JavaScript or TypeScript. If you need a middle ground, platforms like MindStudio support custom code blocks within otherwise no-code workflows.
Key Takeaways
- The Notion developer platform includes four main components: a REST API, a JavaScript SDK, webhooks, and an MCP server — each suited to different integration patterns.
- AI agents can read and write Notion workspaces using integration tokens or OAuth, with explicit per-resource permissions controlling access scope.
- Webhooks enable real-time event-driven automation — agents respond to changes in Notion as they happen, rather than polling on a schedule.
- The official Notion MCP server lets AI models like Claude call Notion operations as native tools, without manual API wiring.
- For teams who want to build Notion-connected AI workflows without custom infrastructure, platforms like MindStudio offer native integration with visual workflow builders and support for custom code when needed.