Instrucciones de origen · Vista previa de solo lectura
name
notion
description
Notion API + ntn CLI: pages, databases, markdown, Workers.
metadata
{"category":"productivity","emoji":"📚","color":"amber","vibe":"Work smarter, not harder.","original_name":"notion"}
🎛️ DEPUTY CHIEF OF STAFF REPORTING PROTOCOL
PRIORITY DIRECTIVE: If this task was assigned to you by the agents-orchestrator (🎛️ Deputy Chief of Staff), treat it as HIGHEST PRIORITY and execute immediately.
Upon Task Completion, you MUST:
Report BACK to the Deputy Chief of Staff (agents-orchestrator) with:
Any blockers encountered and how they were resolved
Files created or modified (full paths)
Quality assessment of your own output
Escalate to the Chief of Staff (rudrax-chief-of-staff) if:
The task requires cross-domain coordination beyond your scope
You encounter a blocker the Deputy cannot resolve
Notion
Talk to Notion two ways. Same integration token works for both — pick by what's available.
◆ ntn CLI — Notion's official CLI. Shorter syntax, one-line file uploads, required for Workers. macOS + Linux only as of May 2026 (Windows support "coming soon"). Default when installed.
◆ — works everywhere including Windows. when isn't installed.
HTTP + curl
Default fallback
ntn
Setup
1. Get an integration token (required for both paths)
Share target pages/databases with the integration in Notion: page menu ... → Connect to → your integration name. Without this, the API returns 404 for that page even though it exists.
Skip ntn login — use the integration token instead. This works headlessly, no browser needed:
export NOTION_API_TOKEN=$NOTION_API_KEY# ntn reads NOTION_API_TOKENexport NOTION_KEYRING=0 # don't try to use the OS keychain
Add those exports to your shell profile (or to ~/.rudrax/agent/.env) so every session inherits them.
3. Choose path at runtime
ifcommand -v ntn >/dev/null 2>&1; then# use ntnelse# fall back to curlfi
Windows users: skip step 2 entirely until native ntn ships — Path B works fine. If you want CLI ergonomics now, install ntn inside WSL2.
API Basics
Notion-Version: 2025-09-03 is required on all HTTP requests. ntn handles this for you. In this version, what users call "databases" are called data sources in the API.
Path A — ntn CLI (preferred, macOS / Linux)
Raw API calls (shorthand for curl)
ntn api v1/users # GET
ntn api v1/pages parent[page_id]=abc123 \ # POST with inline body
properties[title][0][text][content]="Notes"
ntn api v1/pages/abc123 -X PATCH archived:=true# PATCH; := is non-string (bool/num/null)
After deploy: ntn workers webhooks list shows the URL Notion generates. Treat that URL as a secret — anyone with it can POST events unless you add signature verification.
Worker lifecycle commands
ntn workers deploy
ntn workers list
ntn workers exec <capability-key> -d '{"name": "world"}'
ntn workers sync trigger <key> # run a sync now
ntn workers sync pause <key>
ntn workers envset GITHUB_WEBHOOK_SECRET=...
ntn workers runs list # recent invocations
ntn workers runs logs <run-id>
ntn workers webhooks list
When asked to build a Worker, scaffold with ntn workers new, write the code in src/index.ts, set any secrets with ntn workers env set, and deploy. Notion's docs at https://developers.notion.com/workers cover the full API surface.
Notion-Flavored Markdown (used by /markdown endpoints)
Standard CommonMark plus XML-like tags for Notion-specific blocks. Use tabs for indentation.
Blocks beyond CommonMark:
<callout icon="🎯" color="blue_bg">
Ship the MVP by **Friday**.
</callout>
<details color="gray">
<summary>Toggle title</summary>
Children indented one tab
</details>
<columns>
<column>Left side</column>
<column>Right side</column>
</columns>
<table_of_contents color="gray"/>
Color: <span color="blue">text</span> or block-level {color="blue"} on the first line
Math: inline $x^2$, block $$ ... $$
Citations: [^https://example.com]
Colors:gray brown orange yellow green blue purple pink red, plus *_bg variants for backgrounds.
Headings 5/6 collapse to H4. Multiple > lines render as separate quote blocks — use <br> inside a single > for multi-line quotes.
Choosing the Right Path
Task
mac / Linux
Windows
Read/write pages, search, query databases
ntn api ...
curl
Read a page for an agent to summarize
ntn api v1/pages/{id}/markdown
curl /markdown endpoint
Upload a file
ntn files create < file
3-step HTTP flow
One-off API exploration
ntn api ...
curl
Build a sync / webhook / agent tool hosted by Notion
ntn workers ...
WSL2 + ntn workers ...
Notes
Page/database IDs are UUIDs (with or without dashes — both accepted).
Rate limit: ~3 requests/second average. The CLI doesn't bypass this.
The API cannot set database view filters — that's UI-only.
Use "is_inline": true when creating data sources to embed them in a page.
Always pass -s to curl to suppress progress bars (cleaner agent output).
Pipe JSON through jq when reading: ... | jq '.results[0].properties'.
Notion also ships an MCP server now (Notion MCP, ~91% more token-efficient on DB ops than the previous version) — wire it via RudraX' MCP support if you want streaming Notion access from inside a session, but the paths above are enough for most one-shot tasks.