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.

7 functions 6 read 1 write Bearer token auth

Notion CLI Setup

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

# 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 notion2 --set access_token="$NOTION2_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor notion2 --json
kosmokrator integrations:status --json

Credentials

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

KeyEnv varTypeRequiredLabel
access_token NOTION2_ACCESS_TOKEN Secret secret yes Internal Integration Token

Call Notion Headlessly

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

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

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

kosmo integrations:notion2 notion2_list_pages '{
  "query": "example_query",
  "filter": "example_filter",
  "sort": "example_sort",
  "start_cursor": "example_start_cursor",
  "page_size": 1
}' --json

Agent Discovery Commands

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

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.

notion2.notion2_list_pages

Read read

Search and list pages in your Notion workspace.

Parameters
query, filter, sort, start_cursor, page_size

Generic CLI call

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

Provider shortcut

kosmo integrations:notion2 notion2_list_pages '{"query":"example_query","filter":"example_filter","sort":"example_sort","start_cursor":"example_start_cursor","page_size":1}' --json

notion2.notion2_get_page

Read read

Get detailed information about a Notion page.

Parameters
page_id

Generic CLI call

kosmo integrations:call notion2.notion2_get_page '{"page_id":"example_page_id"}' --json

Provider shortcut

kosmo integrations:notion2 notion2_get_page '{"page_id":"example_page_id"}' --json

notion2.notion2_create_page

Write write

Create a new page in Notion.

Parameters
parent, properties, children, icon, cover

Generic CLI call

kosmo integrations:call notion2.notion2_create_page '{"parent":"example_parent","properties":"example_properties","children":"example_children","icon":"example_icon","cover":"example_cover"}' --json

Provider shortcut

kosmo integrations:notion2 notion2_create_page '{"parent":"example_parent","properties":"example_properties","children":"example_children","icon":"example_icon","cover":"example_cover"}' --json

notion2.notion2_list_databases

Read read

List databases in your Notion workspace.

Parameters
query, sort, start_cursor, page_size

Generic CLI call

kosmo integrations:call notion2.notion2_list_databases '{"query":"example_query","sort":"example_sort","start_cursor":"example_start_cursor","page_size":1}' --json

Provider shortcut

kosmo integrations:notion2 notion2_list_databases '{"query":"example_query","sort":"example_sort","start_cursor":"example_start_cursor","page_size":1}' --json

notion2.notion2_query_database

Read read

Query a Notion database with optional filters.

Parameters
database_id, filter, sorts, start_cursor, page_size

Generic CLI call

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

Provider shortcut

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

notion2.notion2_list_users

Read read

List all users in your Notion workspace.

Parameters
start_cursor, page_size

Generic CLI call

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

Provider shortcut

kosmo integrations:notion2 notion2_list_users '{"start_cursor":"example_start_cursor","page_size":1}' --json

notion2.notion2_get_current_user

Read read

Get the currently authenticated Notion user/bot.

Parameters
none

Generic CLI call

kosmo integrations:call notion2.notion2_get_current_user '{}' --json

Provider shortcut

kosmo integrations:notion2 notion2_get_current_user '{}' --json

Function Schemas

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

notion2.notion2_list_pages

Search and list pages in your Notion workspace.

Operation
Read read
Schema command
kosmo integrations:schema notion2.notion2_list_pages --json
ParameterTypeRequiredDescription
query string no Search query to filter pages by title.
filter object no Filter object, e.g. {"property":"object","value":"page"}.
sort object no Sort object, e.g. {"direction":"descending","timestamp":"last_edited_time"}.
start_cursor string no Cursor for pagination from a previous response.
page_size integer no Number of results per page (1–100, default 100).

notion2.notion2_get_page

Get detailed information about a Notion page.

Operation
Read read
Schema command
kosmo integrations:schema notion2.notion2_get_page --json
ParameterTypeRequiredDescription
page_id string yes The ID of the Notion page (UUID).

notion2.notion2_create_page

Create a new page in Notion.

Operation
Write write
Schema command
kosmo integrations:schema notion2.notion2_create_page --json
ParameterTypeRequiredDescription
parent object yes Parent object, e.g. {"page_id":"..."} or {"database_id":"..."}.
properties object no Page property values (title, etc.).
children array no Array of block objects to append as page content.
icon object no Icon for the page (emoji or external).
cover object no Cover image for the page.

notion2.notion2_list_databases

List databases in your Notion workspace.

Operation
Read read
Schema command
kosmo integrations:schema notion2.notion2_list_databases --json
ParameterTypeRequiredDescription
query string no Search query to filter databases by title.
sort object no Sort object, e.g. {"direction":"descending","timestamp":"last_edited_time"}.
start_cursor string no Cursor for pagination from a previous response.
page_size integer no Number of results per page (1–100, default 100).

notion2.notion2_query_database

Query a Notion database with optional filters.

Operation
Read read
Schema command
kosmo integrations:schema notion2.notion2_query_database --json
ParameterTypeRequiredDescription
database_id string yes The ID of the Notion database to query (UUID).
filter object no Filter object to narrow results.
sorts array no Array of sort objects.
start_cursor string no Cursor for pagination from a previous response.
page_size integer no Number of results per page (1–100, default 100).

notion2.notion2_list_users

List all users in your Notion workspace.

Operation
Read read
Schema command
kosmo integrations:schema notion2.notion2_list_users --json
ParameterTypeRequiredDescription
start_cursor string no Cursor for pagination from a previous response.
page_size integer no Number of results per page (1–100, default 100).

notion2.notion2_get_current_user

Get the currently authenticated Notion user/bot.

Operation
Read read
Schema command
kosmo integrations:schema notion2.notion2_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

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.