← 返回
未分类 Key 中文

Notion Openapi Skill

Operate Notion Public API through UXC with a curated OpenAPI schema for search, block traversal, page reads, content writes, and data source/database inspect...
通过UXC操作Notion公共API,使用精选的OpenAPI schema实现搜索、块遍历、页面读取、内容写入以及数据源/数据库检查...
jolestar jolestar 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 321
下载
💾 1
安装
1
版本
#latest

概述

Notion Public API Skill

Use this skill to run Notion Public API operations through uxc + OpenAPI.

Reuse the uxc skill for shared execution, OAuth, and error-handling guidance.

Prerequisites

  • uxc is installed and available in PATH.
  • Network access to https://api.notion.com/v1.
  • Access to the curated OpenAPI schema URL:
  • https://raw.githubusercontent.com/holon-run/uxc/main/skills/notion-openapi-skill/references/notion-public.openapi.json
  • A Notion integration token or OAuth credential with content read access.
  • For writes, the integration also needs the corresponding Notion insert/update content capabilities.

Scope

This skill covers a read-first Notion REST surface focused on traversal plus common content writes:

  • token identity validation
  • title search for pages, data sources, and databases
  • page lookup
  • block lookup
  • recursive traversal via block-children pagination
  • page property retrieval
  • page creation
  • page updates, including trash/restore via in_trash
  • block append
  • block updates
  • block deletion
  • data source retrieval and query
  • legacy database retrieval and query

This skill does not cover:

  • full Notion REST coverage
  • comments, file uploads, webhooks, page move, or schema mutation
  • automatic recursive traversal loops inside one single command

Endpoint And Version

  • base URL: https://api.notion.com/v1
  • required version header for this skill: Notion-Version: 2026-03-11

The schema is intentionally curated around traversal and schema discovery. It is not a full dump of the Notion API.

Authentication

Notion Public API requires:

  • Authorization: Bearer
  • Notion-Version: 2026-03-11

Recommended: dedicated REST credential

If you already have an internal integration token:

uxc auth credential set notion-openapi \
  --auth-type api_key \
  --header "Authorization=Bearer {{secret}}" \
  --header "Notion-Version=2026-03-11" \
  --secret-env NOTION_API_TOKEN

uxc auth binding add \
  --id notion-openapi \
  --host api.notion.com \
  --path-prefix /v1 \
  --scheme https \
  --credential notion-openapi \
  --priority 100

How to get the internal integration token:

  1. Open the Notion integrations dashboard and create an internal integration for your workspace.
  2. In the integration configuration page, copy the API secret shown by Notion.
  3. In Notion UI, open each target page, data source, or database and add this integration via Share or Connections.
  4. Use that API secret as NOTION_API_TOKEN or pass it directly to uxc auth credential set.

Without connecting the integration to the target content, REST calls may authenticate successfully but still fail with access errors or return incomplete search results.

If you want OAuth-managed tokens for the REST host:

uxc auth oauth start notion-openapi \
  --endpoint https://api.notion.com/v1 \
  --redirect-uri http://127.0.0.1:8788/callback \
  --client-id <client_id> \
  --scope read

uxc auth oauth complete notion-openapi \
  --session-id <session_id> \
  --authorization-response 'http://127.0.0.1:8788/callback?code=...'

uxc auth credential set notion-openapi \
  --auth-type oauth \
  --header "Authorization=Bearer {{secret}}" \
  --header "Notion-Version=2026-03-11"

uxc auth binding add \
  --id notion-openapi \
  --host api.notion.com \
  --path-prefix /v1 \
  --scheme https \
  --credential notion-openapi \
  --priority 100

Advanced: reuse the same OAuth credential as notion-mcp

This is technically possible in uxc if the existing credential already has a valid Notion OAuth access token.

Important:

  • once an OAuth credential uses custom headers, include Authorization=Bearer {{secret}} explicitly
  • adding Notion-Version=2026-03-11 on the shared credential means the same header will also be sent to mcp.notion.com/mcp
  • that extra header is expected to be harmless, but this is an interoperability assumption rather than an explicit Notion guarantee

Shared-credential setup:

uxc auth credential set notion-mcp \
  --auth-type oauth \
  --header "Authorization=Bearer {{secret}}" \
  --header "Notion-Version=2026-03-11"

uxc auth binding add \
  --id notion-openapi-shared \
  --host api.notion.com \
  --path-prefix /v1 \
  --scheme https \
  --credential notion-mcp \
  --priority 100

Validate the effective mapping when auth looks wrong:

uxc auth binding match https://api.notion.com/v1

Core Workflow

  1. Use the fixed link command by default:
    • command -v notion-openapi-cli
    • If missing, create it:

uxc link notion-openapi-cli https://api.notion.com/v1 --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/notion-openapi-skill/references/notion-public.openapi.json

  • notion-openapi-cli -h
  1. Inspect operation schema first:
    • notion-openapi-cli post:/search -h
    • notion-openapi-cli get:/blocks/{block_id}/children -h
    • notion-openapi-cli post:/pages -h
    • notion-openapi-cli patch:/blocks/{block_id}/children -h
    • notion-openapi-cli post:/data_sources/{data_source_id}/query -h
  1. Prefer read validation before broader traversal:
    • notion-openapi-cli get:/users/me
    • notion-openapi-cli post:/search '{"query":"Roadmap","filter":{"property":"object","value":"page"},"page_size":10}'
    • notion-openapi-cli get:/blocks/{block_id}/children block_id= page_size=100
  1. Traverse recursively outside the API call boundary:
    • use get:/blocks/{block_id}/children page by page
    • for every returned child block with has_children=true, call get:/blocks/{block_id}/children again on that child ID
  1. Use data source or legacy database reads to discover schema before property-sensitive queries:
    • notion-openapi-cli get:/data_sources/{data_source_id} data_source_id=
    • notion-openapi-cli post:/data_sources/{data_source_id}/query data_source_id= '{"page_size":25}'
    • notion-openapi-cli get:/databases/{database_id} database_id=
  1. Execute writes only after explicit user confirmation:
    • create page: notion-openapi-cli post:/pages '{...}'
    • append blocks: notion-openapi-cli patch:/blocks/{block_id}/children '{...}'
    • update page or block: notion-openapi-cli patch:/pages/{page_id} '{...}'
    • delete block: notion-openapi-cli delete:/blocks/{block_id} block_id=

Operation Groups

Session / Discovery

  • get:/users/me
  • post:/search

Page And Block Traversal

  • get:/pages/{page_id}
  • get:/pages/{page_id}/properties/{property_id}
  • get:/blocks/{block_id}
  • get:/blocks/{block_id}/children

Page And Block Writes

  • post:/pages
  • patch:/pages/{page_id}
  • patch:/blocks/{block_id}/children
  • patch:/blocks/{block_id}
  • delete:/blocks/{block_id}

Data Source Reads

  • get:/data_sources/{data_source_id}
  • post:/data_sources/{data_source_id}/query

Legacy Database Reads

  • get:/databases/{database_id}
  • post:/databases/{database_id}/query

Guardrails

  • Keep automation on the JSON output envelope; do not use --text.
  • Parse stable fields first: ok, kind, protocol, data, error.
  • This skill fixes Notion-Version at the credential/header layer instead of requiring it as an operation argument. Keep the credential header on 2026-03-11 unless you intentionally migrate the whole skill surface.
  • This skill is read-first, but it now includes common content writes. Always confirm intent before post:/pages, patch:/pages/{page_id}, patch:/blocks/{block_id}/children, patch:/blocks/{block_id}, or delete:/blocks/{block_id}.
  • On Notion API version 2026-03-11, archived has been replaced by in_trash for request and response semantics. Prefer in_trash in update payloads.
  • patch:/blocks/{block_id}/children supports up to 100 new children in one request and up to two levels of nested blocks in a single payload.
  • patch:/blocks/{block_id} updates block content, but it does not update child lists. Use patch:/blocks/{block_id}/children to append nested content.
  • Prefer data_sources endpoints over legacy databases endpoints for new workflows. Keep legacy database reads only for compatibility with older shared links and IDs.
  • get:/blocks/{block_id}/children returns only one nesting level at a time. Recursive traversal must be performed by repeated calls.
  • Notion may return fewer results than page_size; always check has_more and next_cursor.
  • notion-openapi-cli ... is equivalent to uxc https://api.notion.com/v1 --schema-url ....

References

  • Usage patterns: references/usage-patterns.md
  • Curated OpenAPI schema: references/notion-public.openapi.json
  • Notion API reference: https://developers.notion.com/reference
  • Retrieve a database: https://developers.notion.com/reference/retrieve-a-database
  • Retrieve a block: https://developers.notion.com/reference/retrieve-a-block
  • Versioning: https://developers.notion.com/reference/versioning

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 11:15 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 196 📥 67,897
ai-agent

Discord OpenAPI Skill

jolestar
通过UXC操作Discord HTTP API,使用Discord OpenAPI模式。建议使用Bot令牌以获取完整API访问权限(包括消息和服务器管理)。支持OAuth2...
★ 0 📥 1,040
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 681 📥 329,018