Agent-friendly CLI for the Notion API. Structured JSON output, async, full MCP parity.
Project description
notionctl
Agent-friendly CLI for the Notion API. Outputs compact JSON to stdout, structured errors to stderr. Designed for coding agents (Claude Code, Cursor, Aider) but works for humans too.
Install
uv tool install notionctl
# or
pip install notionctl
Authentication
Option 1: OAuth (recommended)
notion auth login # opens browser, stores token locally
notion auth status # check current auth
notion auth logout # revoke and delete token
When prompted, select all pages for full workspace access.
Option 2: API token
Get a token from https://www.notion.so/my-integrations:
export NOTION_API_KEY="secret_..."
Or pass it per command with --token.
Commands
notion auth login Authenticate via OAuth browser flow
notion auth logout Revoke token and delete credentials
notion auth status Show current authentication method
notion search <query> Search pages and databases by title
notion page get <id> Get page metadata (properties, parent, URL)
notion page create Create a page with markdown content
notion page update <id> Update title, properties, icon, archive status
notion page move <id> Move a page to a different parent
notion page duplicate <id> Duplicate a page
notion db get <id> Get database schema
notion db query <id> Query database rows with filter and sort
notion db create Create a database
notion db update <id> Update database title or schema
notion block get <id> Get page content blocks (use --markdown for text)
notion block append <id> Append block objects (JSON) to a page
notion comment add <id> Add a comment to a page
notion comment list <id> List comments on a page
notion user list List workspace users
notion user get <id> Get a specific user
notion user me Get the current bot user
notion team list List teamspaces
All IDs accept Notion URLs or raw UUIDs.
Examples
Search for pages:
notion search "meeting notes"
notion search "roadmap" --type page
Read page content as markdown:
notion block get <page-id> --markdown
Create a page with markdown content:
notion page create --parent <parent-id> --title "New Page" --content $'# Hello\nWorld'
notion page create -p <parent-id> -t "Notes" -c @notes.md
notion page create -p <parent-id> -t "Notes" -c - # read from stdin
Query a database with a filter:
notion db query <db-id> --filter '{"property": "Status", "select": {"equals": "Done"}}'
Update a database row property:
notion page update <page-id> --properties '{"Status": {"select": {"name": "Done"}}}'
Output format
Every command outputs compact JSON to stdout. Errors go to stderr as:
{"error_type": "not_found", "message": "...", "suggestion": "..."}
Exit codes: 0=ok, 1=error, 2=bad args, 3=not found, 4=permission denied, 5=rate limited.
Options available on all commands
--token TEXTNotion API token (defaults toNOTION_API_KEYenv var)--timeout FLOATTimeout per API request in seconds (paginated commands make multiple requests)--helpShow help for any command
Development
git clone https://github.com/jjovalle99/notion-cli.git
cd notion-cli
uv sync
uv run pytest
uv run ruff check src/ tests/
uv run ty check src/
See CONTRIBUTING.md for details on adding features.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file notionctl-0.1.0.tar.gz.
File metadata
- Download URL: notionctl-0.1.0.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b2fc641bd8a1b3b4117880d8d94262b9b031215cefdcdf85af4bda22cd3bb7d
|
|
| MD5 |
f0dc0bc40eed7a9a75172a4f78d901c3
|
|
| BLAKE2b-256 |
7911dc20c63260c73628ba9ca6c51036dc309fb9de227579f184ff03a92f3579
|
File details
Details for the file notionctl-0.1.0-py3-none-any.whl.
File metadata
- Download URL: notionctl-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3376a0e6776c831472d2ba5239d8b50415e76de310d77019b45f176417800f43
|
|
| MD5 |
a655ed0e13884fc3d9612e095940416b
|
|
| BLAKE2b-256 |
48d27011eb3396fde06b29d3001fb947556f51470d482929483ef8a709ce966d
|