← 返回
开发者工具 Key

Notion Manager

Notion CLI for creating and managing pages, databases, and blocks.
用于创建和管理页面、数据库与块的 Notion CLI。
willykinfoussia
开发者工具 clawhub v0.0.1 1 版本 98595 Key: 需要
★ 8
Stars
📥 5,945
下载
💾 580
安装
1
版本
#latest

概述

notion

Use notion-cli to create/read/update pages, data sources (databases), and blocks.

Setup

  • Install notion-cli: npm install -g @iansinnott/notion-cli
  • Create an integration at https://notion.so/my-integrations
  • Copy the API key (starts with ntn_ or secret_)
  • Store it:
  • mkdir -p ~/.config/notion
  • echo "ntn_your_key_here" > ~/.config/notion/api_key
  • Share target pages/databases with your integration (click "..." → "Connect to" → your integration name)

Usage

All commands require the NOTION_TOKEN environment variable to be set:

export NOTION_TOKEN=$(cat ~/.config/notion/api_key)

Common Operations

  • Search for pages and data sources:

notion-cli search --query "page title"

  • Get page:

notion-cli page retrieve

  • Get page content (blocks):

notion-cli page retrieve -r

  • Create page in a database:

```bash

curl -X POST https://api.notion.com/v1/pages \

-H "Authorization: Bearer $NOTION_TOKEN" \

-H "Content-Type: application/json" \

-H "Notion-Version: 2025-09-03" \

--data '{

"parent": { "database_id": "YOUR_DATABASE_ID" },

"properties": {

"Name": {

"title": [

{

"text": {

"content": "Nouvelle idée"

}

}

]

}

}

}'

```

  • Query a database:

notion-cli db query -a '{"property":"Status","status":{"equals":"Active"}}'

  • Update page properties:

```bash

curl -X PATCH https://api.notion.com/v1/pages/PAGE_ID \

-H "Authorization: Bearer $NOTION_TOKEN" \

-H "Content-Type: application/json" \

-H "Notion-Version: 2025-09-03" \

--data '{

"properties": {

"Name": {

"title": [

{

"text": {

"content": "Nouveau titre"

}

}

]

},

"Status": {

"status": {

"name": "In progress"

}

},

"Priority": {

"select": {

"name": "High"

}

},

"Due date": {

"date": {

"start": "2026-02-10"

}

},

"Description": {

"rich_text": [

{

"text": {

"content": "Description mise à jour"

}

}

]

}

}

}'

```

  • Get database info:

notion-cli db retrieve

Property Types

Common property formats for database items:

  • Title: {"title": [{"text": {"content": "..."}}]}
  • Rich text: {"rich_text": [{"text": {"content": "..."}}]}
  • Status: {"status": {"name": "Option"}}
  • Select: {"select": {"name": "Option"}}
  • Multi-select: {"multi_select": [{"name": "A"}, {"name": "B"}]}
  • Date: {"date": {"start": "2024-01-15", "end": "2024-01-16"}}
  • Checkbox: {"checkbox": true}
  • Number: {"number": 42}
  • URL: {"url": "https://..."}
  • Email: {"email": "a@b.com"}

Examples

  • Search for pages:

notion-cli search --query "AIStories"

  • Query database with filter:

```bash

notion-cli db query 2faf172c094981d3bbcbe0f115457cda \

-a '{

"property": "Status",

"status": { "equals": "Backlog" }

}'

```

  • Retrieve page content:

notion-cli page retrieve 2fdf172c-0949-80dd-b83b-c1df0410d91b -r

  • Update page status:

```bash

curl -X PATCH https://api.notion.com/v1/pages/2fdf172c-0949-80dd-b83b-c1df0410d91b \

-H "Authorization: Bearer $NOTION_TOKEN" \

-H "Content-Type: application/json" \

-H "Notion-Version: 2025-09-03" \

--data '{

"properties": {

"Status": {

"status": {

"name": "In progress"

}

}

}

}'

```

Key Features

  • Interactive mode: For complex queries, run notion-cli db query without arguments to enter interactive mode
  • Multiple output formats: table (default), csv, json, yaml
  • Raw JSON: Use --raw flag for complete API responses
  • Filter syntax: Use -a flag for complex filters with AND/OR conditions

Notes

  • Page/database IDs are UUIDs (with or without dashes)
  • The CLI handles authentication automatically via NOTION_TOKEN
  • Rate limits are managed by the CLI
  • Use notion-cli help for complete command reference

References

  • GitHub Notion-CLI: https://github.com/litencatt/notion-cli
  • Notion API Documentation: https://developers.notion.com

版本历史

共 1 个版本

  • v0.0.1 当前
    2026-03-28 10:17 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Agent Browser

matrixy
专为AI智能体优化的无头浏览器自动化CLI,支持无障碍树快照和基于引用的元素选择。
★ 425 📥 118,018
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 666 📥 323,783
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 65 📥 179,834