@rusintez/notion
v1.0.0
Published
Simple CLI wrapper for Notion API - supports multiple workspaces
Readme
@rusintez/notion
Simple CLI wrapper for Notion API. Supports multiple workspaces. Markdown I/O by default.
Install
npm install -g @rusintez/notionOr run directly with npx:
npx @rusintez/notion --helpSetup
Create a Notion integration at https://www.notion.so/my-integrations and grab the token:
notion config add work ntn_xxx
notion config add personal ntn_yyy
notion config default workOr use env var for one-off commands:
NOTION_TOKEN=ntn_xxx notion meImportant: Share pages/databases with your integration in Notion (page menu → Connections → Add your integration).
Usage
Config Management
notion config list # List all workspaces
notion config add <name> <tok> # Add/update workspace
notion config remove <name> # Remove workspace
notion config default <name> # Set default workspaceSearch
notion search "meeting notes" # Search all pages & databases
notion search "project" -t page # Pages only
notion search "tracker" -t database # Databases only
notion search "budget" -n 10 # Limit resultsDatabases
notion databases # List accessible databases (alias: dbs)
notion database <id> # Query a database (alias: db)
notion db <id> -n 100 # Limit results
notion db <id> -s "Status" # Sort by property
notion db <id> -s "Created" --asc # Sort ascendingPages
notion pages # Recently edited pages
notion pages -n 50 # More results
notion page <id> # Page with full content (markdown)
notion page <id> --no-content # Properties only, skip blocksCreate & Update
# Create page in a database
notion create-page -d <database-id> --title "New task"
notion create-page -d <database-id> --title "Bug" -p '{"Status":{"select":{"name":"Open"}}}'
# Update page
notion update-page <page-id> --title "Updated title"
notion update-page <page-id> -p '{"Status":{"select":{"name":"Done"}}}'
notion update-page <page-id> --archive
# Append content to a page
notion append <page-id> "Some paragraph text"
notion append <page-id> "- Bullet one\n- Bullet two\n- [ ] Todo item"Output Formats
notion pages # Markdown table (default) - readable
notion pages -f json # JSON - best for parsing/scripting
notion pages -f minimal # Minimal - one item per line, tab-separatedMulti-workspace
notion -w work pages # Use 'work' workspace
notion -w personal search "notes" # Use 'personal' workspaceOutput
- Markdown (default): Tables for lists, formatted objects for details
- JSON (
-f json): Machine-readable, ideal for scripting - Minimal (
-f minimal): Tab-separated, one item per line - Errors go to stderr with exit code 1
Sync (Local Data Cache)
Sync Notion data to local JSON files for offline access, searching, and integration with other tools.
notion sync # Incremental sync all workspaces
notion sync --full # Full sync (re-fetch all, detect deletions)
notion sync -w work # Sync specific workspace only
notion sync -c pages,databases # Sync specific collections onlyData is stored at ~/.local/share/notion/{workspace}/{collection}/{id}.json
Synced Collections
databases- Databases with schema and propertiespages- All pages with properties and extracted titleusers- Workspace members
Sync Management
notion sync-status # Show sync status for all workspaces
notion sync-status myworkspace # Status for specific workspace
notion sync-reset myworkspace # Reset state (next sync = full)Config Location
~/.config/notion-cli/config.json
License
MIT
