The complete command-line interface for your Notion workspace. Upload, create, search, and manage your entire Notion workspace from the terminal - just like using the web app, but faster and scriptable.
Perfect for AI-powered development workflows - Claude Code, Cursor, Windsurf, and any AI coding assistant.
Stop being limited by nested hierarchies. Most Notion tools force you to create pages inside existing pages. This CLI gives you the same power as the Notion web app - create pages anywhere, organize however you want.
- π Top-level pages - Create pages at your workspace root (like "Projects", "Notes", "Documents")
- π Database integration - Add pages to databases, create new databases, query existing ones
- π Complete workspace access - Search, list, and navigate your entire Notion workspace
- π Rich content creation - Full markdown support with proper formatting preservation
- β‘ Batch operations - Upload entire documentation sites, process multiple files
- π€ Automation ready - Script your Notion workflows, integrate with CI/CD
- π Full security model - OAuth authentication with granular permissions control
In Notion's web app, you can create pages directly in your workspace sidebar - these become top-level pages like:
- π "Meeting Notes" (not buried under another page)
- π "Project Alpha" (standalone project workspace)
- π "Documentation Hub" (main documentation entry point)
- π‘ "Ideas & Research" (your personal knowledge base)
Most CLI tools can only create nested pages (pages inside other pages). This CLI gives you full workspace-level control - the same power you have clicking "New Page" in Notion's sidebar.
Seamlessly integrate with any AI coding assistant:
- Claude Code: Add as a tool for instant documentation uploads
- Cursor: Script Notion updates directly from your IDE
- Windsurf: Automate project documentation workflows
- Any AI assistant: Provide structured knowledge management
Turn your terminal into a project management powerhouse:
- Create tickets in your team's Project Planner database
- Document decisions and code reviews instantly
- Auto-generate deployment and release tasks
- Keep documentation synchronized with code changes
- Integrate Notion workflows with your existing dev tools
# Create a complete documentation site at workspace level
notion-cli upload README.md --title "API Documentation"
notion-cli upload docs/api/*.md --parent "API Documentation"
notion-cli upload docs/guides/*.md --parent "API Documentation"
# Result: Professional docs site accessible from sidebar# Create project workspace at top level
notion-cli upload project-overview.md --title "Project Phoenix"
notion-cli upload requirements.md --parent "Project Phoenix"
notion-cli upload architecture.md --parent "Project Phoenix"
# Result: Complete project hub in workspace sidebar# Build searchable knowledge base
notion-cli upload research/*.md --parent "Research Database"
notion-cli upload notes/*.md --parent "Research Database"
# Result: Centralized knowledge accessible to whole team# From Claude Code - instant documentation
notion-cli upload README.md --title "π Project Alpha Documentation" --icon "π"
notion-cli upload api-spec.md --parent "API Documentation" --icon "π§"
# From Cursor - automated ticket creation
notion-cli create-ticket "Fix authentication bug" --project "Backend Sprint" --assignee "[email protected]"
notion-cli create-ticket "Add dark mode support" --project "Frontend" --priority "High"
# From any AI assistant - structured knowledge
notion-cli upload code-review.md --parent "Engineering Decisions" --icon "π₯"
notion-cli upload architecture-changes.md --parent "Technical Documentation" --icon "ποΈ"
# Result: Seamless AI development workflow integration# Automated documentation deployment
# In your GitHub Actions:
notion-cli upload CHANGELOG.md --title "Release Notes v2.1"
notion-cli upload docs/*.md --parent "Product Documentation"
# Auto-create deployment tickets
notion-cli create-ticket "Deploy v2.1 to production" --project "DevOps" --due-date "2025-08-20"
# Result: Auto-updated docs and tickets on every release# Clone or download this directory
cd notion-cli
# Run the install script
./install.shOr install manually:
pip install notion-client
# Add notion_cli.py to your PATH or create an alias-
Get your OAuth credentials from your Notion integration page:
- Go to https://www.notion.so/my-integrations
- Find your integration and copy the OAuth Client Secret
-
Set environment variable:
export NOTION_CLIENT_SECRET=your_oauth_client_secret_here -
Authenticate:
notion-cli auth
This will:
- Open your browser to Notion's authorization page
- Let you choose which pages/databases to share
- Automatically save secure tokens locally
- Enable full workspace access
# Upload a markdown file
notion-cli upload README.md --parent "Personal Website"
# Upload with custom title and emoji icon
notion-cli upload README.md --title "π Project Documentation" --icon "π"
# List all pages in workspace
notion-cli list --type pages
# Search for content
notion-cli search "project documentation"
# Upload multiple files with emojis
notion-cli upload docs/*.md --parent "Documentation" --icon "π"# Basic upload
notion-cli upload document.md
# Upload to specific parent page
notion-cli upload document.md --parent "Projects"
notion-cli upload document.md --parent "24f8f973-9991-80b2-944b-e5c1a0d419c8"
# Custom title and emoji icon
notion-cli upload README.md --title "My Project Documentation" --icon "π"
# Batch upload with wildcards and emoji
notion-cli upload docs/*.md --parent "Documentation" --icon "π"# List all content
notion-cli list
# List only pages
notion-cli list --type pages
# List only databases
notion-cli list --type databases
# Search workspace
notion-cli search "meeting notes"
notion-cli search "project"# OAuth authentication (recommended)
notion-cli auth
# Show current config
notion-cli config show
β Headers (H1, H2, H3) β Code blocks with syntax highlighting β Bullet points and numbered lists β Inline formatting (bold, italic, code) β Paragraphs with proper spacing
jinja2βhtmlymlβyamldockerfileβdocker- Unknown languages β
plain text
Configuration is stored in ~/.notion-cli/config.json:
{
"access_token": "oauth_access_token",
"workspace_id": "workspace_id",
"workspace_name": "Your Workspace Name"
}# Upload main README
notion-cli upload README.md --parent "Projects" --title "MyApp Documentation"
# Upload all markdown files in docs/
notion-cli upload docs/*.md --parent "MyApp Documentation"# Find all your pages
notion-cli list --type pages
# Search for specific content
notion-cli search "API documentation"
# Find databases
notion-cli list --type databases# Upload multiple files
notion-cli upload *.md --parent "Documentation Hub"
# Upload files from subdirectories
notion-cli upload **/*.md --parent "All Docs"- OAuth 2.0 + PKCE: Uses modern, secure authentication flow with proof key for code exchange
- Environment-based secrets: Client secret stored in environment variable (not in code)
- Local storage only: All tokens stored locally in
~/.notion-cli/config.json - Official Notion API: Uses Notion's standard OAuth endpoints
- You control access: Choose exactly which pages/databases to share during authorization
- No hardcoded secrets: Client ID is public, client secret comes from your environment
Built with:
- Python 3.8+
- notion-client - Official Notion Python SDK
- Standard library (argparse, pathlib, json)
- Fork the repository
- Create a feature branch
- Make your changes
- Test with your Notion workspace
- Submit a pull request
MIT License - feel free to use and modify!
Run notion-cli config set YOUR_TOKEN with your integration token.
Make sure you've shared the parent page with your integration in Notion.
Ensure your integration has the necessary permissions (Read/Insert/Update content).
Some code block languages are automatically mapped to supported ones. Unsupported languages default to "plain text".
- Top-level page creation - Full workspace control
- Markdown upload - Rich formatting preservation
- OAuth authentication - Secure workspace access
- Ticket/task creation - Create issues in project databases from Claude Code
- Database querying - Read and filter database contents
- Template system - Predefined page templates
- Bidirectional sync - Export Notion pages to markdown
- Advanced database operations - SQL-like queries, complex filters
- Bulk operations - Process hundreds of files with progress bars
- Page relationships - Create linked pages and references
- Advanced formatting - Tables, callouts, embeds
- Workflow automation - Script complex Notion operations
- Git integration - Sync repos with Notion workspaces
- CI/CD plugins - GitHub Actions, Jenkins integrations
- Multi-workspace - Manage multiple Notion accounts
- API webhooks - Real-time Notion updates
- Team collaboration - Shared CLI configurations
- Permission management - Fine-grained access control
- Audit logging - Track all CLI operations
- Enterprise SSO - SAML/OAuth enterprise auth
- Backup & restore - Complete workspace backups
Vision: Make Notion as scriptable and automatable as any modern dev tool.