productivity
Notion CLI for Headless Automation
Use the Notion CLI for headless automation with headless JSON commands, schema discovery, credentials, and permission controls.
7 functions 6 read 1 write Bearer token auth
Notion CLI for Headless Automation
Use KosmoKrator as a non-interactive integration runtime for local automations and wrappers.
Use headless automation when another tool needs a stable local command surface. The Notion CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Notion CLI for Headless Automation
kosmokrator integrations:configure notion2 --set access_token="$NOTION2_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmo integrations:call notion2.notion2_list_pages '{"query":"example_query","filter":"example_filter","sort":"example_sort","start_cursor":"example_start_cursor","page_size":1}' --json Discovery Before Execution
Agents and scripts can inspect Notion docs and schemas before choosing a function.
kosmo integrations:docs notion2 --json
kosmo integrations:docs notion2.notion2_list_pages --json
kosmo integrations:schema notion2.notion2_list_pages --json
kosmo integrations:search "Notion" --json
kosmo integrations:list --json Useful Notion CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
notion2.notion2_list_pages | Read | query, filter, sort, start_cursor, page_size | Search and list pages in your Notion workspace. |
notion2.notion2_get_page | Read | page_id | Get detailed information about a Notion page. |
notion2.notion2_create_page | Write | parent, properties, children, icon, cover | Create a new page in Notion. |
notion2.notion2_list_databases | Read | query, sort, start_cursor, page_size | List databases in your Notion workspace. |
notion2.notion2_query_database | Read | database_id, filter, sorts, start_cursor, page_size | Query a Notion database with optional filters. |
notion2.notion2_list_users | Read | start_cursor, page_size | List all users in your Notion workspace. |
notion2.notion2_get_current_user | Read | none | Get the currently authenticated Notion user/bot. |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.