KosmoKrator

productivity

Notion CLI for AI Agents

Use the Notion CLI from KosmoKrator to call Notion tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

20 functions 11 read 9 write API key auth

Notion CLI Setup

Notion can be configured headlessly with `kosmokrator integrations:configure notion`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure notion --set api_key="$NOTION_API_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor notion --json
kosmokrator integrations:status --json

Credentials

Authentication type: API key api_key. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
api_key NOTION_API_KEY Secret secret yes API Key

Call Notion Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

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

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations: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

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities 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

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Notion.

notion.notion_create_page

Write write

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.

Parameters
parent_type, parent_id, properties, children

Generic CLI call

kosmo integrations:call notion.notion_create_page '{"parent_type":"example_parent_type","parent_id":"example_parent_id","properties":"example_properties","children":"example_children"}' --json

Provider shortcut

kosmo integrations:notion notion_create_page '{"parent_type":"example_parent_type","parent_id":"example_parent_id","properties":"example_properties","children":"example_children"}' --json

notion.notion_get_page

Read read

Retrieve a Notion page by its ID. Returns the page object with properties, including title, icon, cover, parent info, and timestamps.

Parameters
page_id

Generic CLI call

kosmo integrations:call notion.notion_get_page '{"page_id":"example_page_id"}' --json

Provider shortcut

kosmo integrations:notion notion_get_page '{"page_id":"example_page_id"}' --json

notion.notion_update_page

Write write

Update properties on a Notion page. Provide properties as a JSON object matching the database/page schema. Can also archive/unarchive the page.

Parameters
page_id, properties, archived

Generic CLI call

kosmo integrations:call notion.notion_update_page '{"page_id":"example_page_id","properties":"example_properties","archived":true}' --json

Provider shortcut

kosmo integrations:notion notion_update_page '{"page_id":"example_page_id","properties":"example_properties","archived":true}' --json

notion.notion_archive_page

Write write

Archive a Notion page by setting its archived flag to true. The page can be restored by using notion_update_page with archived=false.

Parameters
page_id

Generic CLI call

kosmo integrations:call notion.notion_archive_page '{"page_id":"example_page_id"}' --json

Provider shortcut

kosmo integrations:notion notion_archive_page '{"page_id":"example_page_id"}' --json

notion.notion_create_database

Write write

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"}]}}}.

Parameters
parent_id, title, properties

Generic CLI call

kosmo integrations:call notion.notion_create_database '{"parent_id":"example_parent_id","title":"example_title","properties":"example_properties"}' --json

Provider shortcut

kosmo integrations:notion notion_create_database '{"parent_id":"example_parent_id","title":"example_title","properties":"example_properties"}' --json

notion.notion_get_database

Read read

Retrieve a Notion database by its ID. Returns the full database schema including all property definitions (columns), title, and parent info.

Parameters
database_id

Generic CLI call

kosmo integrations:call notion.notion_get_database '{"database_id":"example_database_id"}' --json

Provider shortcut

kosmo integrations:notion notion_get_database '{"database_id":"example_database_id"}' --json

notion.notion_update_database

Write write

Update a Notion database's title and/or property schema. Provide a new title and/or modified properties as a JSON object.

Parameters
database_id, title, properties

Generic CLI call

kosmo integrations:call notion.notion_update_database '{"database_id":"example_database_id","title":"example_title","properties":"example_properties"}' --json

Provider shortcut

kosmo integrations:notion notion_update_database '{"database_id":"example_database_id","title":"example_title","properties":"example_properties"}' --json

notion.notion_query_database

Read read

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"}]

Parameters
database_id, filter, sorts, page_size, start_cursor

Generic CLI call

kosmo integrations:call notion.notion_query_database '{"database_id":"example_database_id","filter":"example_filter","sorts":"example_sorts","page_size":1,"start_cursor":"example_start_cursor"}' --json

Provider shortcut

kosmo integrations:notion notion_query_database '{"database_id":"example_database_id","filter":"example_filter","sorts":"example_sorts","page_size":1,"start_cursor":"example_start_cursor"}' --json

notion.notion_list_databases

Read read

List all databases accessible to the integration. Uses the search endpoint filtered to database objects. Optionally provide a query to filter by name.

Parameters
query, page_size, start_cursor

Generic CLI call

kosmo integrations:call notion.notion_list_databases '{"query":"example_query","page_size":1,"start_cursor":"example_start_cursor"}' --json

Provider shortcut

kosmo integrations:notion notion_list_databases '{"query":"example_query","page_size":1,"start_cursor":"example_start_cursor"}' --json

notion.notion_get_block_children

Read read

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.

Parameters
block_id, page_size, start_cursor

Generic CLI call

kosmo integrations:call notion.notion_get_block_children '{"block_id":"example_block_id","page_size":1,"start_cursor":"example_start_cursor"}' --json

Provider shortcut

kosmo integrations:notion notion_get_block_children '{"block_id":"example_block_id","page_size":1,"start_cursor":"example_start_cursor"}' --json

notion.notion_append_block_children

Write write

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"}}]}}]

Parameters
block_id, children

Generic CLI call

kosmo integrations:call notion.notion_append_block_children '{"block_id":"example_block_id","children":"example_children"}' --json

Provider shortcut

kosmo integrations:notion notion_append_block_children '{"block_id":"example_block_id","children":"example_children"}' --json

notion.notion_get_block

Read read

Retrieve a single Notion block by its ID. Returns the full block object including type-specific content, has_children flag, and parent info.

Parameters
block_id

Generic CLI call

kosmo integrations:call notion.notion_get_block '{"block_id":"example_block_id"}' --json

Provider shortcut

kosmo integrations:notion notion_get_block '{"block_id":"example_block_id"}' --json

notion.notion_update_block

Write write

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.

Parameters
block_id, type, content, archived

Generic CLI call

kosmo integrations:call notion.notion_update_block '{"block_id":"example_block_id","type":"example_type","content":"example_content","archived":true}' --json

Provider shortcut

kosmo integrations:notion notion_update_block '{"block_id":"example_block_id","type":"example_type","content":"example_content","archived":true}' --json

notion.notion_delete_block

Write write

Delete a Notion block by its ID. This permanently removes the block (moves it to trash if it is a top-level page block).

Parameters
block_id

Generic CLI call

kosmo integrations:call notion.notion_delete_block '{"block_id":"example_block_id"}' --json

Provider shortcut

kosmo integrations:notion notion_delete_block '{"block_id":"example_block_id"}' --json

notion.notion_get_current_user

Read read

Get information about the current integration bot user. Returns the bot's name, avatar, and workspace info.

Parameters
none

Generic CLI call

kosmo integrations:call notion.notion_get_current_user '{}' --json

Provider shortcut

kosmo integrations:notion notion_get_current_user '{}' --json

notion.notion_list_users

Read read

List all users in the Notion workspace. Returns user IDs, names, types, and avatar URLs. Supports pagination.

Parameters
page_size, start_cursor

Generic CLI call

kosmo integrations:call notion.notion_list_users '{"page_size":1,"start_cursor":"example_start_cursor"}' --json

Provider shortcut

kosmo integrations:notion notion_list_users '{"page_size":1,"start_cursor":"example_start_cursor"}' --json

notion.notion_get_user

Read read

Retrieve a Notion user by their ID. Returns the user's name, type, avatar URL, and email (if available).

Parameters
user_id

Generic CLI call

kosmo integrations:call notion.notion_get_user '{"user_id":"example_user_id"}' --json

Provider shortcut

kosmo integrations:notion notion_get_user '{"user_id":"example_user_id"}' --json

notion.notion_create_comment

Write write

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.

Parameters
parent_id, discussion_id, body_text, body_children

Generic CLI call

kosmo integrations:call notion.notion_create_comment '{"parent_id":"example_parent_id","discussion_id":"example_discussion_id","body_text":"example_body_text","body_children":"example_body_children"}' --json

Provider shortcut

kosmo integrations:notion notion_create_comment '{"parent_id":"example_parent_id","discussion_id":"example_discussion_id","body_text":"example_body_text","body_children":"example_body_children"}' --json

notion.notion_get_comments

Read read

Retrieve comments on a Notion page or block. Returns all comment objects with their content, authors, and timestamps. Supports pagination.

Parameters
block_id, page_size, start_cursor

Generic CLI call

kosmo integrations:call notion.notion_get_comments '{"block_id":"example_block_id","page_size":1,"start_cursor":"example_start_cursor"}' --json

Provider shortcut

kosmo integrations:notion notion_get_comments '{"block_id":"example_block_id","page_size":1,"start_cursor":"example_start_cursor"}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

notion.notion_create_page

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.

Operation
Write write
Schema command
kosmo integrations:schema notion.notion_create_page --json
ParameterTypeRequiredDescription
parent_type string yes Parent type: "database" or "page".
parent_id string yes ID of the parent database or page.
properties string no Page properties as a JSON object. For database parents, keys should match database property names.
children string no Page content as a JSON array of block objects.

notion.notion_get_page

Retrieve a Notion page by its ID. Returns the page object with properties, including title, icon, cover, parent info, and timestamps.

Operation
Read read
Schema command
kosmo integrations:schema notion.notion_get_page --json
ParameterTypeRequiredDescription
page_id string yes The ID of the page to retrieve.

notion.notion_update_page

Update properties on a Notion page. Provide properties as a JSON object matching the database/page schema. Can also archive/unarchive the page.

Operation
Write write
Schema command
kosmo integrations:schema notion.notion_update_page --json
ParameterTypeRequiredDescription
page_id string yes The ID of the page to update.
properties string no Properties to update as a JSON object.
archived boolean no Whether to archive the page.

notion.notion_archive_page

Archive a Notion page by setting its archived flag to true. The page can be restored by using notion_update_page with archived=false.

Operation
Write write
Schema command
kosmo integrations:schema notion.notion_archive_page --json
ParameterTypeRequiredDescription
page_id string yes The ID of the page to archive.

notion.notion_create_database

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"}]}}}.

Operation
Write write
Schema command
kosmo integrations:schema notion.notion_create_database --json
ParameterTypeRequiredDescription
parent_id string yes ID of the parent page where the database will be created.
title string yes Title of the database.
properties string yes Database property schema as a JSON object. Each key is a property name with its type config.

notion.notion_get_database

Retrieve a Notion database by its ID. Returns the full database schema including all property definitions (columns), title, and parent info.

Operation
Read read
Schema command
kosmo integrations:schema notion.notion_get_database --json
ParameterTypeRequiredDescription
database_id string yes The ID of the database to retrieve.

notion.notion_update_database

Update a Notion database's title and/or property schema. Provide a new title and/or modified properties as a JSON object.

Operation
Write write
Schema command
kosmo integrations:schema notion.notion_update_database --json
ParameterTypeRequiredDescription
database_id string yes The ID of the database to update.
title string no New title for the database.
properties string no Updated property schema as a JSON object. Only included properties will be updated.

notion.notion_query_database

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"}]

Operation
Read read
Schema command
kosmo integrations:schema notion.notion_query_database --json
ParameterTypeRequiredDescription
database_id string yes The ID of the database to query.
filter string no Filter condition as a JSON string or object.
sorts string no Sort rules as a JSON array string or array.
page_size integer no Number of results per page (max 100, default 100).
start_cursor string no Pagination cursor from a previous response.

notion.notion_list_databases

List all databases accessible to the integration. Uses the search endpoint filtered to database objects. Optionally provide a query to filter by name.

Operation
Read read
Schema command
kosmo integrations:schema notion.notion_list_databases --json
ParameterTypeRequiredDescription
query string no Search query to filter database names.
page_size integer no Number of results per page (max 100, default 10).
start_cursor string no Pagination cursor from a previous response.

notion.notion_get_block_children

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.

Operation
Read read
Schema command
kosmo integrations:schema notion.notion_get_block_children --json
ParameterTypeRequiredDescription
block_id string yes ID of the block or page to get children for.
page_size integer no Number of results per page (max 100, default 100).
start_cursor string no Pagination cursor from a previous response.

notion.notion_append_block_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"}}]}}]

Operation
Write write
Schema command
kosmo integrations:schema notion.notion_append_block_children --json
ParameterTypeRequiredDescription
block_id string yes ID of the parent block or page to append children to.
children string yes Array of block objects to append, as a JSON string or array.

notion.notion_get_block

Retrieve a single Notion block by its ID. Returns the full block object including type-specific content, has_children flag, and parent info.

Operation
Read read
Schema command
kosmo integrations:schema notion.notion_get_block --json
ParameterTypeRequiredDescription
block_id string yes The ID of the block to retrieve.

notion.notion_update_block

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.

Operation
Write write
Schema command
kosmo integrations:schema notion.notion_update_block --json
ParameterTypeRequiredDescription
block_id string yes The ID of the block to update.
type string no Block type to update (e.g., "paragraph", "heading_1", "to_do").
content string no Type-specific block content as a JSON object. For example: {"rich_text": [{"text": {"content": "Updated text"}}]}
archived boolean no Whether to archive the block.

notion.notion_delete_block

Delete a Notion block by its ID. This permanently removes the block (moves it to trash if it is a top-level page block).

Operation
Write write
Schema command
kosmo integrations:schema notion.notion_delete_block --json
ParameterTypeRequiredDescription
block_id string yes The ID of the block to delete.

notion.notion_get_current_user

Get information about the current integration bot user. Returns the bot's name, avatar, and workspace info.

Operation
Read read
Schema command
kosmo integrations:schema notion.notion_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

notion.notion_list_users

List all users in the Notion workspace. Returns user IDs, names, types, and avatar URLs. Supports pagination.

Operation
Read read
Schema command
kosmo integrations:schema notion.notion_list_users --json
ParameterTypeRequiredDescription
page_size integer no Number of results per page (max 100, default 100).
start_cursor string no Pagination cursor from a previous response.

notion.notion_get_user

Retrieve a Notion user by their ID. Returns the user's name, type, avatar URL, and email (if available).

Operation
Read read
Schema command
kosmo integrations:schema notion.notion_get_user --json
ParameterTypeRequiredDescription
user_id string yes The ID of the user to retrieve.

notion.notion_create_comment

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.

Operation
Write write
Schema command
kosmo integrations:schema notion.notion_create_comment --json
ParameterTypeRequiredDescription
parent_id string no Page ID to create a comment on. Required if discussion_id is not provided.
discussion_id string no Discussion ID to reply to. Required if parent_id is not provided.
body_text string no Simple text content for the comment.
body_children string no Rich text block content as a JSON array of block objects.

notion.notion_get_comments

Retrieve comments on a Notion page or block. Returns all comment objects with their content, authors, and timestamps. Supports pagination.

Operation
Read read
Schema command
kosmo integrations:schema notion.notion_get_comments --json
ParameterTypeRequiredDescription
block_id string yes The ID of the block or page to get comments for.
page_size integer no Number of results per page (max 100, default 100).
start_cursor string no Pagination cursor from a previous response.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.