KosmoKrator

productivity

Notion CLI for Shell Scripts

Use the Notion CLI for shell scripts with headless JSON commands, schema discovery, credentials, and permission controls.

20 functions 11 read 9 write API key auth

Notion CLI for Shell Scripts

Call integration functions from shell scripts with stable JSON input and output.

Use shell scripts for small local automations that need one or more integration calls. 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 Shell Scripts
kosmokrator integrations:configure notion --set api_key="$NOTION_API_KEY" --enable --read allow --write ask --json
kosmo integrations:call notion.notion_search '{"query":"example_query","filter_type":"example_filter_type","sort_direction":"example_sort_direction","page_size":1,"start_cursor":"example_start_cursor"}' --json

Discovery Before Execution

Agents and scripts can inspect Notion docs and schemas before choosing a function.

kosmo integrations:docs notion --json
kosmo integrations:docs notion.notion_search --json
kosmo integrations:schema notion.notion_search --json
kosmo integrations:search "Notion" --json
kosmo integrations:list --json

Useful Notion CLI Functions

FunctionTypeParametersDescription
notion.notion_search Read query, filter_type, sort_direction, page_size, start_cursor Search pages and databases in your Notion workspace. Returns matching results with their IDs, types, and titles. Optionally filter by type (page or database) and control sort direction.
notion.notion_create_page Write parent_type, parent_id, properties, children Create a new page in Notion. The page can be created as a child of a database (to create a row) or as a child of another page (to create a sub-page). Provide properties as a JSON object matching the database schema when using a database parent. Provide children (block content) as a JSON array of block objects.
notion.notion_get_page Read page_id Retrieve a Notion page by its ID. Returns the page object with properties, including title, icon, cover, parent info, and timestamps.
notion.notion_update_page Write page_id, properties, archived Update properties on a Notion page. Provide properties as a JSON object matching the database/page schema. Can also archive/unarchive the page.
notion.notion_archive_page Write page_id Archive a Notion page by setting its archived flag to true. The page can be restored by using notion_update_page with archived=false.
notion.notion_create_database Write parent_id, title, properties Create a new database as a child of a page. Provide the parent page ID, a title, and a properties schema. Properties define the columns of the database. Example properties: {"Name": {"title": {}}, "Status": {"select": {"options": [{"name": "Todo"}, {"name": "Done"}]}}}.
notion.notion_get_database Read database_id Retrieve a Notion database by its ID. Returns the full database schema including all property definitions (columns), title, and parent info.
notion.notion_update_database Write database_id, title, properties Update a Notion database's title and/or property schema. Provide a new title and/or modified properties as a JSON object.
notion.notion_query_database Read database_id, filter, sorts, page_size, start_cursor Query a Notion database to retrieve rows (pages). Supports filtering and sorting. Filter and sorts can be provided as JSON strings or arrays. Example filter: {"property": "Status", "select": {"equals": "Done"}} Example sorts: [{"property": "Name", "direction": "ascending"}]
notion.notion_list_databases Read query, page_size, start_cursor List all databases accessible to the integration. Uses the search endpoint filtered to database objects. Optionally provide a query to filter by name.
notion.notion_get_block_children Read block_id, page_size, start_cursor Get the child blocks of a Notion block or page. Returns a list of block objects. Use this to read the content of a page or to navigate nested block structures. Supports pagination.
notion.notion_append_block_children Write block_id, children Append blocks to a Notion page or block. Provide children as a JSON array of block objects. Example: [{"object":"block","type":"paragraph","paragraph":{"rich_text":[{"type":"text","text":{"content":"Hello world"}}]}}]
notion.notion_get_block Read block_id Retrieve a single Notion block by its ID. Returns the full block object including type-specific content, has_children flag, and parent info.
notion.notion_update_block Write block_id, type, content, archived Update the content of a Notion block. Provide the block ID and the type-specific content to update. For example, to update a paragraph block, provide: {"type": "paragraph", "paragraph": {"rich_text": [{"text": {"content": "New text"}}]}} Only the fields you include will be updated.
notion.notion_delete_block Write block_id Delete a Notion block by its ID. This permanently removes the block (moves it to trash if it is a top-level page block).
notion.notion_get_current_user Read none Get information about the current integration bot user. Returns the bot's name, avatar, and workspace info.
notion.notion_list_users Read page_size, start_cursor List all users in the Notion workspace. Returns user IDs, names, types, and avatar URLs. Supports pagination.
notion.notion_get_user Read user_id Retrieve a Notion user by their ID. Returns the user's name, type, avatar URL, and email (if available).
notion.notion_create_comment Write parent_id, discussion_id, body_text, body_children Create a comment on a Notion page. You can either start a new discussion (provide parent_id) or reply to an existing discussion (provide discussion_id). Provide body_text for simple text, or body_children for rich content blocks.
notion.notion_get_comments Read block_id, page_size, start_cursor Retrieve comments on a Notion page or block. Returns all comment objects with their content, authors, and timestamps. Supports pagination.

Automation Notes

Related Notion CLI Pages