技能圖譜SKILLSGROVE
技能圖譜/效率工具/jholhewres/devclaw-skills/notion

notion

安裝

$npx skills add https://github.com/jholhewres/devclaw-skills --skill notion
$git clone --depth 1 https://github.com/jholhewres/devclaw-skills.git /tmp/devclaw-skills && mkdir -p ~/.claude/skills && cp -r /tmp/devclaw-skills/skills/notion ~/.claude/skills/notion
請幫我安裝這個 Agent Skill:https://github.com/jholhewres/devclaw-skills/tree/0177c36eb6dcdfe3f891fd332ef538a3d84cc693/skills/notion ,先閱讀它的 SKILL.md 和指令碼,確認安全後再安裝到我的技能目錄。

簡介

原文描述 · MITNotion API — create, read, search pages, databases, and blocks
以下 SKILL.md 內容轉載自 jholhewres/devclaw-skills(提交 0177c36),依據 MIT 許可證轉載正文(文字未改動;僅省略檔案頭後設資料、將圖片顯示為連結,超長內容會截斷);版權歸 2026 DevClaw 所有。許可證:LICENSE。僅展示說明檔案,附帶指令碼請在原倉庫檢視。

Notion

Manage Notion pages, databases, and blocks via the REST API.

Setup

  1. Check existing credentials:

    vault_get notion_api_key
    
  2. If not configured:

    The key is auto-injected as $NOTION_API_KEY.

    • Important: Share target pages/databases with your integration (click "..." → "Connect to" → integration name)

API Basics

All requests need these headers:

curl -s "https://api.notion.com/v1/..." \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json"

Search pages and databases

curl -s -X POST "https://api.notion.com/v1/search" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{"query": "SEARCH_TERM"}' | jq '.results[] | {id, object: .object, title: (.properties.title.title[0].plain_text // .title[0].plain_text // "untitled")}'

Read a page

# Page properties
curl -s "https://api.notion.com/v1/pages/PAGE_ID" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2025-09-03" | jq '.properties'

# Page content (blocks)
curl -s "https://api.notion.com/v1/blocks/PAGE_ID/children" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2025-09-03" | jq '.results[] | {type, text: (.paragraph.rich_text[0].plain_text // .heading_1.rich_text[0].plain_text // .to_do.rich_text[0].plain_text // null)}'

Create a page

# In a database
curl -s -X POST "https://api.notion.com/v1/pages" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{
    "parent": {"database_id": "DATABASE_ID"},
    "properties": {
      "Name": {"title": [{"text": {"content": "Task title"}}]},
      "Status": {"select": {"name": "Todo"}}
    }
  }' | jq '{id, url}'

# Under another page
curl -s -X POST "https://api.notion.com/v1/pages" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{
    "parent": {"page_id": "PARENT_PAGE_ID"},
    "properties": {
      "title": [{"text": {"content": "New Page Title"}}]
    },
    "children": [
      {"object": "block", "type": "paragraph", "paragraph": {"rich_text": [{"text": {"content": "Page content here."}}]}}
    ]
  }' | jq '{id, url}'

Query a database

curl -s -X POST "https://api.notion.com/v1/databases/DATABASE_ID/query" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": {"property": "Status", "select": {"equals": "In Progress"}},
    "sorts": [{"property": "Created", "direction": "descending"}]
  }' | jq '.results[] | {id, title: .properties.Name.title[0].plain_text, status: .properties.Status.select.name}'

Add content to a page

curl -s -X PATCH "https://api.notion.com/v1/blocks/PAGE_ID/children" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{
    "children": [
      {"object": "block", "type": "to_do", "to_do": {"rich_text": [{"text": {"content": "New task item"}}], "checked": false}}
    ]
  }'

Tips

  • The Notion-Version header is required — use 2025-09-03 (latest).
  • Database IDs and page IDs can be found in the URL: notion.so/workspace/PAGE_ID.
  • Always search first to find the right page/database before creating new ones.
  • The integration only sees pages that have been explicitly shared with it.
  • For complex queries, use filters and sorts to narrow results.

Triggers

notion, add to notion, notion page, notion database, notion task, create page, search notion, adicionar no notion, buscar no notion, criar página

檢視許可證全文(MIT)
MIT License

Copyright (c) 2026 DevClaw

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.