/install notion-cli-agent
notion-cli Interact with your Notion workspace via the notion-cli.
A production-grade CLI for the Notion API that supports searching, creating and managing pages, databases, blocks, users, and comments with multiple output formats (JSON, table, CSV).
Install Clone and install the CLI:
git clone https://github.com/FroeMic/notion-cli
cd notion-cli
npm install
npm run build
npm link
Set NOTION_API_KEY environment variable:
- Create an integration at https://www.notion.so/profile/integrations
- Copy the Internal Integration Secret (starts with
ntn_orsecret_) - Share any pages/databases you want to access with the integration
- Recommended: Add to
~/.claude/.envfor Claude Code - Alternative: Add to
~/.bashrcor~/.zshrc:export NOTION_API_KEY="your-api-key"
Optional: Set NOTION_DEBUG=true for verbose request/response logging.
Repository: https://github.com/FroeMic/notion-cli
Commands Search across your workspace:
notion search [query] # Search pages, databases, and data sources
notion search [query] --filter page # Search only pages
notion search [query] --filter database # Search only databases
notion search [query] --sort ascending # Sort by last edited time
Work with pages:
notion pages get \x3Cpage-id> # Get page details
notion pages create --parent \x3Cid> --title \x3Ctext> # Create a new page
notion pages update \x3Cpage-id> --properties \x3Cjson> # Update page properties
notion pages archive \x3Cpage-id> # Archive a page
notion pages restore \x3Cpage-id> # Restore an archived page
notion pages property \x3Cpage-id> \x3Cproperty-id> # Get a specific property value
Work with databases:
notion databases get \x3Cdatabase-id> # Get database schema
notion databases create --parent \x3Cid> --title \x3Ctext> # Create a database
notion databases update \x3Cdatabase-id> --title \x3Ctext> # Update database metadata
notion databases query \x3Cdata-source-id> # Query records in a data source
notion databases query \x3Cid> --filter \x3Cjson> # Query with filters
notion databases query \x3Cid> --sort \x3Cjson> # Query with sorting
Work with blocks (page content):
notion blocks get \x3Cblock-id> # Get a block
notion blocks children \x3Cblock-id> # List child blocks
notion blocks append \x3Cblock-id> --content \x3Cjson> # Append new blocks
notion blocks update \x3Cblock-id> --content \x3Cjson> # Update a block
notion blocks delete \x3Cblock-id> # Delete a block
Work with users:
notion users list # List workspace members
notion users get \x3Cuser-id> # Get user details
notion users me # Get the authenticated bot user
Work with comments:
notion comments list --block \x3Cblock-id> # List comments on a block
notion comments create --page \x3Cpage-id> --content \x3Ctext> # Add a comment to a page
Global options (available on all commands):
--api-key \x3Ckey> # Override NOTION_API_KEY env var
-f, --format \x3Cfmt> # Output format: json (default), table, csv
--limit \x3Cn> # Max results to return
--cursor \x3Ccursor> # Pagination cursor
Key Concepts
| Concept | Purpose | Example |
|---|---|---|
| Pages | Individual Notion pages | A meeting note, a project brief |
| Databases | Structured collections of pages | A task tracker, a CRM table |
| Data Sources | Individual tables within a database | A specific view/table in a database |
| Blocks | Content elements within a page | Paragraphs, headings, lists, code blocks |
| Properties | Typed fields on database pages | Title, status, date, select, relation |
| Users | Workspace members and integrations | Team members, bot integrations |
| Comments | Discussion threads on pages/blocks | Feedback, review notes |
API Reference
- Base URL:
https://api.notion.com/v1 - API Version:
2022-06-28 - Auth:
Authorization: Bearer $NOTION_API_KEY - Rate Limits: Automatic retry with exponential backoff (up to 3 retries)
Common API Operations Search for a page:
curl -X POST https://api.notion.com/v1/search \
-H "Authorization: Bearer $NOTION_API_KEY" \
-H "Notion-Version: 2022-06-28" \
-H "Content-Type: application/json" \
-d '{"query": "Meeting Notes", "filter": {"value": "page", "property": "object"}}'
Query a database with filters:
curl -X POST https://api.notion.com/v1/databases/\x3Cdatabase-id>/query \
-H "Authorization: Bearer $NOTION_API_KEY" \
-H "Notion-Version: 2022-06-28" \
-H "Content-Type: application/json" \
-d '{"filter": {"property": "Status", "status": {"equals": "In Progress"}}}'
Create a page in a database:
curl -X POST https://api.notion.com/v1/pages \
-H "Authorization: Bearer $NOTION_API_KEY" \
-H "Notion-Version: 2022-06-28" \
-H "Content-Type: application/json" \
-d '{"parent": {"database_id": "\x3Cdatabase-id>"}, "properties": {"Name": {"title": [{"text": {"content": "New Task"}}]}}}'
Append content to a page:
curl -X PATCH https://api.notion.com/v1/blocks/\x3Cblock-id>/children \
-H "Authorization: Bearer $NOTION_API_KEY" \
-H "Notion-Version: 2022-06-28" \
-H "Content-Type: application/json" \
-d '{"children": [{"object": "block", "type": "paragraph", "paragraph": {"rich_text": [{"type": "text", "text": {"content": "Hello world"}}]}}]}'
Notes
- The integration must be explicitly shared with each page or database you want to access (via Notion UI: ... menu > Connections > Add your integration).
- Pages can accept IDs as UUIDs or Notion URLs — the CLI will parse both formats.
- All list endpoints support cursor-based pagination via
--limitand--cursor. - Output format can be set to
json(default),table, orcsvwith the-fflag. - Property types include: title, rich_text, number, select, multi_select, status, date, people, files, checkbox, url, email, phone_number, relation, rollup, formula, and timestamp fields.
Files 1 total
- SKILL.md (this file)
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install notion-cli-agent - 安装完成后,直接呼叫该 Skill 的名称或使用
/notion-cli-agent触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Notion CLI – Command Line Interface based access to Notion for your agent 是什么?
Access and manage your Notion workspace via a CLI to search, create, update, and delete pages, databases, blocks, users, and comments with multiple output fo... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 3000 次。
如何安装 Notion CLI – Command Line Interface based access to Notion for your agent?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install notion-cli-agent」即可一键安装,无需额外配置。
Notion CLI – Command Line Interface based access to Notion for your agent 是免费的吗?
是的,Notion CLI – Command Line Interface based access to Notion for your agent 完全免费(开源免费),可自由下载、安装和使用。
Notion CLI – Command Line Interface based access to Notion for your agent 支持哪些平台?
Notion CLI – Command Line Interface based access to Notion for your agent 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Notion CLI – Command Line Interface based access to Notion for your agent?
由 FroeMic(@froemic)开发并维护,当前版本 v1.0.0。