| name | notion-cli |
| description | Access Notion via the 4ier/notion-cli Go binary. Use when user wants to search Notion, query databases, read pages, export data, |
| allowed-tools | Read, Bash, Glob, Grep |
Notion CLI
Fast, agent-friendly access to Notion via the 4ier/notion-cli Go binary. Single static binary, sub-second startup, auto-JSON when piped.
Self-Evolving Skill: Fix this file immediately if instructions drift. Do not defer.
When to Use
Use this skill when the user wants to interact with Notion from the command line — searching pages, querying databases, reading content, exporting data, managing blocks, or adding comments. This wraps the Go binary notion (installed via brew install 4ier/tap/notion-cli).
Do NOT use this skill for programmatic Python automation with the Notion SDK — use productivity-tools:notion-sdk instead. This skill is for CLI-first, pipe-friendly operations.
Preflight
Before any operation, verify the CLI is authenticated:
notion auth status
If not authenticated, retrieve the token from Doppler and authenticate:
doppler secrets get NOTION_API_TOKEN --project claude-config --config prd --plain | notion auth login --with-token
Fallback: prompt the user for their integration token.
Output Formats
The CLI auto-detects context:
- TTY (interactive terminal): colored tables
- Piped (to
jq, file, etc.): clean JSON
Force a format with --format:
| Flag | Output |
|---|
--format json | JSON |
--format table | ASCII table |
--format md | Markdown |
--format text | Plain text |
For agent consumption, always pipe or use --format json to get structured output.
Core Commands
Search
notion search "meeting notes"
notion search --type page "roadmap"
notion search --type database
notion search --all
notion search --limit 20 "query"
Pages
notion page view <page-id|url>
notion page props <page-id|url>
notion page create --parent <id> --title "X"
notion page set <id> --prop 'Status=Done'
notion page edit <id>
notion page move <id> --to <parent-id>
notion page delete <id>
notion page restore <id>
notion page open <id>
notion page list
Databases
notion db list
notion db view <db-id|url>
notion db query <db-id|url>
notion db query <id> --filter 'Status=Done'
notion db query <id> --filter 'Date>=2026-01-01' --sort 'Date:desc'
notion db query <id> --filter-json '{"or":[...]}'
notion db query <id> --all
notion db export <id> --format csv -o data.csv
notion db export <id> --format json
notion db export <id> --format md
notion db add <id> --prop 'Name=Task' --prop 'Status=Todo'
notion db add-bulk <id> --file rows.json
Filter operators: = != > >= < <= ~= (contains)
Multiple --filter flags are AND-combined. For OR logic, use --filter-json.
Blocks
notion block list <page-id|url>
notion block list <id> --depth 3
notion block get <block-id>
notion block append <page-id> --md "# Hello"
notion block insert <after-block-id> --md "X"
notion block delete <block-id>
notion block move <block-id> --to <parent-id>
Comments
notion comment list <page-id>
notion comment add <page-id> --body "text"
notion comment reply <comment-id> --body "X"
Users
notion user me
notion user list
notion user get <user-id>
Files
notion file upload <file-path>
notion file list
Raw API (escape hatch)
notion api GET /v1/users/me
notion api POST /v1/search --body '{"query":"test"}'
echo '{"query":"test"}' | notion api POST /v1/search
ID Resolution
The CLI accepts both Notion URLs and raw IDs interchangeably:
notion page view https://www.notion.so/My-Page-abc123def456
notion page view abc123def456
Common Patterns
Export entire database to JSON
notion db export <db-id> --format json -o database.json
Search and pipe to jq
notion search "project" --format json | jq '.results[] | {title: .properties.title.title[0].plain_text, url: .url}'
List all databases with their IDs
notion search --type database --all --format json | jq '.results[] | {id: .id, title: .title[0].plain_text}'
Recursive page content dump
notion block list <page-id> --depth 10 --format md
Credential Storage
| Store | Location | Purpose |
|---|
| Doppler | claude-config/prd:NOTION_API_TOKEN | SSoT for token |
| CLI | ~/.config/notion/credentials.json | Local auth cache |
Token format: ntn_* (Notion internal integration token).
Troubleshooting
| Issue | Fix |
|---|
unauthorized | Token expired/revoked — regenerate at notion.so/profile/integrations |
object not found | Page not connected to integration — add via page menu > Connections |
rate_limited | CLI auto-retries; for bulk ops use --limit to reduce batch size |
validation_error | Check property names match schema: notion db view <id> |
Post-Execution Reflection
After this skill completes, check before closing:
- Did the command succeed? If not, fix the instruction or error table that caused the failure.
- Did parameters or output change? If the CLI interface drifted, update usage examples and command tables.
- Was a workaround needed? If you had to improvise (different flags, extra steps), update this SKILL.md so the next invocation doesn't need the same workaround.
Only update if the issue is real and reproducible — not speculative.