Automate your Notion workspace from the command line. Query and update databases, create and archive pages, append rich content blocks, and search across your entire workspace — all via the official Notion API with a single integration token.
export NOTION_API_KEY="secret_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
export NOTION_DATABASE_ID="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # optional default DB
Get your integration token: Notion → Settings → Connections → Develop or manage integrations → New integration. Then share your database/pages with that integration.
# ── DATABASES ─────────────────────────────────────────── # Query a database (uses NOTION_DATABASE_ID by default) python3 scripts/notion_workspace.py db-query python3 scripts/notion_workspace.py db-query --db-id "abc123..." # Query with filter python3 scripts/notion_workspace.py db-query --filter-prop "Status" --filter-value "In Progress" # Create a new entry (page) in a database python3 scripts/notion_workspace.py db-create --title "My Task" --props '{"Status": "To Do", "Priority": "High"}' # Update a database entry python3 scripts/notion_workspace.py db-update --page-id "def456..." --props '{"Status": "Done"}' # ── PAGES ─────────────────────────────────────────────── # Create a standalone page (under a parent page) python3 scripts/notion_workspace.py page-create --parent-id "ghi789..." --title "Meeting Notes" --content "Today we discussed..." # Read a page (metadata + content preview) python3 scripts/notion_workspace.py page-read --page-id "def456..." # Update page title/properties python3 scripts/notion_workspace.py page-update --page-id "def456..." --title "Updated Title" # Archive (soft-delete) a page python3 scripts/notion_workspace.py page-archive --page-id "def456..." # ── BLOCKS ────────────────────────────────────────────── # Get children blocks of a page or block python3 scripts/notion_workspace.py blocks-get --block-id "def456..." # Append a paragraph block python3 scripts/notion_workspace.py blocks-append --block-id "def456..." --text "New paragraph content here" # Append a heading python3 scripts/notion_workspace.py blocks-append --block-id "def456..." --text "Section Title" --type heading_2 # Append a to-do item python3 scripts/notion_workspace.py blocks-append --block-id "def456..." --text "Complete this task" --type to_do # Append a bulleted list item python3 scripts/notion_workspace.py blocks-append --block-id "def456..." --text "Bullet point" --type bulleted_list_item # Append a code block python3 scripts/notion_workspace.py blocks-append --block-id "def456..." --text "print('hello')" --type code --language python # ── SEARCH ────────────────────────────────────────────── # Search entire workspace python3 scripts/notion_workspace.py search --query "project roadmap" # Search only pages python3 scripts/notion_workspace.py search --query "meeting notes" --filter page # Search only databases python3 scripts/notion_workspace.py search --query "tasks" --filter database小葱技能站7w4.net发现了升级插件。
requests (pip install requests)NOTION_API_KEY environment variableNOTION_DATABASE_ID environment variable (optional, for default DB commands)这个 Skill 质量不错,功能覆盖全面,文档清晰易懂。它能帮助用户通过命令行操作 Notion 的数据库、页面和内容块,搜索工作区也很方便。优点是操作直观、示例详细;不足之处在于大数据库查询可能不全、支持的属性类型有限、偶尔遇到网络问题缺少友好提示。日常简单使用足够,但复杂场景可能需要其他工具配合。