Community寫作與編輯github.com

intellectronica/notion-api

此技能提供透過 REST API 與 Notion 互動的完整指南。當使用者要求讀取、建立、更新或刪除頁面、資料庫、區塊、評論或其他 Notion 內容時,應使用此技能。技能涵蓋驗證、所有可用端點、分頁、錯誤處理及最佳實務。

notion-api 是什麼?

此技能為開發者及 AI 代理使用者提供與 Notion API 互動的全面指南,支援透過 REST 呼叫執行所有常見操作,包括頁面、資料庫、區塊及評論的讀取、建立、更新與刪除。此技能詳細說明驗證流程(使用 Integration Token)、所有官方端點(如/ pages、/ databases、/ blocks 等)、請求格式(JSON)及常見回應結構。它還涵蓋分頁處理(使用 start_cursor 與 page_size)、錯誤代碼解讀(如 400、401、404、429)及最佳實務(如速率限制、請求批次處理)。此技能適用於 Claude Code、Cursor 或 Codex 等 AI 代理平台,確保代理能根據使用者需求正確選擇並執行對應的 API 端點。透過遵循此技能,代理可避免常見陷阱,如驗證失敗、錯誤處理不當或過度請求,從而提升開發效率與 API 整合的穩定性。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/intellectronica/agent-skills/tree/main/skills/notion-api

Installed? Explore more 寫作與編輯 skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

notion-api 是做什麼的?

此技能提供透過 REST API 與 Notion 互動的完整指南。當使用者要求讀取、建立、更新或刪除頁面、資料庫、區塊、評論或其他 Notion 內容時,應使用此技能。技能涵蓋驗證、所有可用端點、分頁、錯誤處理及最佳實務。

驗證

所有 API 請求都需要使用 Integration Token 進行驗證。在你的 Notion 整合設定頁面中取得 Token,並在每個請求的 Authorization 標頭中以 Bearer Token 形式傳送:

Authorization: Bearer secret_abc123...

端點

頁面

  • 讀取頁面: GET /v1/pages/{page_id}
  • 建立頁面: POST /v1/pages
  • 更新頁面屬性: PATCH /v1/pages/{page_id}
  • 刪除(封存)頁面: PATCH /v1/pages/{page_id} 搭配 "archived": true

資料庫

  • 讀取資料庫: GET /v1/databases/{database_id}
  • 查詢資料庫: POST /v1/databases/{database_id}/query
  • 建立資料庫: POST /v1/databases
  • 更新資料庫: PATCH /v1/databases/{database_id}

區塊

  • 讀取區塊: GET /v1/blocks/{block_id}
  • 讀取區塊子項: GET /v1/blocks/{block_id}/children
  • 附加區塊子項: PATCH /v1/blocks/{block_id}/children
  • 更新區塊: PATCH /v1/blocks/{block_id}
  • 刪除區塊: DELETE /v1/blocks/{block_id}

評論

  • 讀取評論: GET /v1/comments
  • 建立評論: POST /v1/comments

使用者

  • 讀取使用者: GET /v1/users/{user_id}
  • 列出所有使用者: GET /v1/users

搜尋

  • 搜尋: POST /v1/search

分頁

使用 cursor-based 分頁。回應中的 next_cursor 欄位可用於取得下一頁:

{
  "results": [...],
  "next_cursor": "abc123",
  "has_more": true
}

錯誤處理

狀態碼描述
400請求格式錯誤
401未經授權(Token 無效)
403禁止(無此權限)
404找不到資源
409衝突(例如重複建立)
429請求過多(速率限制)
500內部伺服器錯誤

最佳實務

  • 在請求間加入延遲以避免觸發速率限制(每分鐘最多 3 個請求)。
  • 對所有請求使用適當的錯誤處理(重新嘗試 429 錯誤)。
  • 使用 start_cursor 迭代通過大型結果集。
  • 在更新時僅傳送需要變更的屬性。
  • 使用唯一的 Idempotency-Key 標頭確保冪等性。
  • 使用 Notion API 官方文件 (https://developers.notion.com/reference) 查閱端點與屬性。

注意事項

  • 所有請求必須使用 Content-Type: application/json 標頭。
  • Notion API 版本使用 Notion-Version 標頭指定(目前最新版本為 2022-06-28)。
  • 回應格式為 JSON,包含 object、id、created_time、last_edited_time 等欄位。
  • 頁面是資料庫中的項目;資料庫是頁面集合。

Individual skills in this repo

This repo contains 7 individual skills — each has its own dedicated page.

intellectronica/beautiful-mermaid

Render Mermaid diagrams as SVG and PNG using the Beautiful Mermaid library. Use when the user asks to render a Mermaid diagram.

intellectronica/context7

Retrieve up-to-date documentation for software libraries, frameworks, and components via the Context7 API. This skill should be used when looking up documentation for any programming library or framework, finding code examples for specific APIs or features, verifying correct usage of library functions, or obtaining current information about library APIs that may have changed since training.

intellectronica/markdown-converter

Convert documents and files to Markdown using markitdown. Use when converting PDF, Word (.docx), PowerPoint (.pptx), Excel (.xlsx, .xls), HTML, CSV, JSON, XML, images (with EXIF/OCR), audio (with transcription), ZIP archives, YouTube URLs, or EPubs to Markdown format for LLM processing or text analysis.

intellectronica/nano-banana-pro

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

intellectronica/todoist-api

This skill provides instructions for interacting with Todoist using the td CLI tool. It covers CRUD operations for tasks/projects/sections/labels/comments, and requires confirmation before destructive actions. Use this skill when the user wants to read, create, update, or delete Todoist data.

intellectronica/ultrathink

Display colorful ANSI art of the word "ultrathink". Use when the user says "ultrathink" or invokes /ultrathink.

intellectronica/youtube-transcript

Extract transcripts from YouTube videos. Use when the user asks for a transcript, subtitles, or captions of a YouTube video and provides a YouTube URL (youtube.com/watch?v=, youtu.be/, or similar). Supports output with or without timestamps.

相關技能