KosmoKrator

other

Clerk CLI for AI Agents

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

7 functions 4 read 3 write API key auth

Clerk CLI Setup

Clerk can be configured headlessly with `kosmokrator integrations:configure clerk`.

# 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 clerk --set secret_key="$CLERK_SECRET_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor clerk --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
secret_key CLERK_SECRET_KEY Secret secret yes Secret Key

Call Clerk Headlessly

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

kosmo integrations:call clerk.clerk_list_users '{
  "limit": 1,
  "offset": 1,
  "email_address": "example_email_address",
  "phone_number": "example_phone_number",
  "query": "example_query",
  "order_by": "example_order_by"
}' --json

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

kosmo integrations:clerk clerk_list_users '{
  "limit": 1,
  "offset": 1,
  "email_address": "example_email_address",
  "phone_number": "example_phone_number",
  "query": "example_query",
  "order_by": "example_order_by"
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs clerk --json
kosmo integrations:docs clerk.clerk_list_users --json
kosmo integrations:schema clerk.clerk_list_users --json
kosmo integrations:search "Clerk" --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 Clerk.

clerk.clerk_list_users

Read read

List users from Clerk with optional filtering and pagination. Returns user IDs, emails, names, and profile details.

Parameters
limit, offset, email_address, phone_number, query, order_by

Generic CLI call

kosmo integrations:call clerk.clerk_list_users '{"limit":1,"offset":1,"email_address":"example_email_address","phone_number":"example_phone_number","query":"example_query","order_by":"example_order_by"}' --json

Provider shortcut

kosmo integrations:clerk clerk_list_users '{"limit":1,"offset":1,"email_address":"example_email_address","phone_number":"example_phone_number","query":"example_query","order_by":"example_order_by"}' --json

clerk.clerk_get_user

Read read

Retrieve a single Clerk user by their user ID. Returns full profile details including email, name, and metadata.

Parameters
id

Generic CLI call

kosmo integrations:call clerk.clerk_get_user '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:clerk clerk_get_user '{"id":"example_id"}' --json

clerk.clerk_create_user

Write write

Create a new user in Clerk. Requires at least one email address. Optionally set name, password, and username.

Parameters
email_address, first_name, last_name, password, username

Generic CLI call

kosmo integrations:call clerk.clerk_create_user '{"email_address":"example_email_address","first_name":"example_first_name","last_name":"example_last_name","password":"example_password","username":"example_username"}' --json

Provider shortcut

kosmo integrations:clerk clerk_create_user '{"email_address":"example_email_address","first_name":"example_first_name","last_name":"example_last_name","password":"example_password","username":"example_username"}' --json

clerk.clerk_update_user

Write write

Update an existing Clerk user's profile. Provide the user ID and fields to update.

Parameters
id, first_name, last_name, username

Generic CLI call

kosmo integrations:call clerk.clerk_update_user '{"id":"example_id","first_name":"example_first_name","last_name":"example_last_name","username":"example_username"}' --json

Provider shortcut

kosmo integrations:clerk clerk_update_user '{"id":"example_id","first_name":"example_first_name","last_name":"example_last_name","username":"example_username"}' --json

clerk.clerk_delete_user

Write write

Delete a user from Clerk. This action is irreversible and will remove all associated data.

Parameters
id

Generic CLI call

kosmo integrations:call clerk.clerk_delete_user '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:clerk clerk_delete_user '{"id":"example_id"}' --json

clerk.clerk_list_organizations

Read read

List organizations from Clerk with optional filtering and pagination. Returns organization IDs, names, and metadata.

Parameters
limit, offset, query

Generic CLI call

kosmo integrations:call clerk.clerk_list_organizations '{"limit":1,"offset":1,"query":"example_query"}' --json

Provider shortcut

kosmo integrations:clerk clerk_list_organizations '{"limit":1,"offset":1,"query":"example_query"}' --json

clerk.clerk_get_current_user

Read read

Health check — verify Clerk API connectivity by fetching the first user. Returns a single user or empty result to confirm the API is reachable.

Parameters
none

Generic CLI call

kosmo integrations:call clerk.clerk_get_current_user '{}' --json

Provider shortcut

kosmo integrations:clerk clerk_get_current_user '{}' --json

Function Schemas

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

clerk.clerk_list_users

List users from Clerk with optional filtering and pagination. Returns user IDs, emails, names, and profile details.

Operation
Read read
Schema command
kosmo integrations:schema clerk.clerk_list_users --json
ParameterTypeRequiredDescription
limit integer no Maximum number of users to return (default: 10, max: 500).
offset integer no Number of users to skip for pagination.
email_address string no Filter users by email address.
phone_number string no Filter users by phone number.
query string no Search query to filter users by name, email, or username.
order_by string no Sort order for results. Use "+created_at" for ascending or "-created_at" for descending (default: "+created_at").

clerk.clerk_get_user

Retrieve a single Clerk user by their user ID. Returns full profile details including email, name, and metadata.

Operation
Read read
Schema command
kosmo integrations:schema clerk.clerk_get_user --json
ParameterTypeRequiredDescription
id string yes The Clerk user ID (e.g., "user_2abc123").

clerk.clerk_create_user

Create a new user in Clerk. Requires at least one email address. Optionally set name, password, and username.

Operation
Write write
Schema command
kosmo integrations:schema clerk.clerk_create_user --json
ParameterTypeRequiredDescription
email_address array yes Array of email addresses for the user. At least one is required.
first_name string no The user's first name.
last_name string no The user's last name.
password string no The user's password. Minimum 8 characters.
username string no The user's username.

clerk.clerk_update_user

Update an existing Clerk user's profile. Provide the user ID and fields to update.

Operation
Write write
Schema command
kosmo integrations:schema clerk.clerk_update_user --json
ParameterTypeRequiredDescription
id string yes The Clerk user ID to update (e.g., "user_2abc123").
first_name string no Updated first name.
last_name string no Updated last name.
username string no Updated username.

clerk.clerk_delete_user

Delete a user from Clerk. This action is irreversible and will remove all associated data.

Operation
Write write
Schema command
kosmo integrations:schema clerk.clerk_delete_user --json
ParameterTypeRequiredDescription
id string yes The Clerk user ID to delete (e.g., "user_2abc123").

clerk.clerk_list_organizations

List organizations from Clerk with optional filtering and pagination. Returns organization IDs, names, and metadata.

Operation
Read read
Schema command
kosmo integrations:schema clerk.clerk_list_organizations --json
ParameterTypeRequiredDescription
limit integer no Maximum number of organizations to return (default: 10, max: 500).
offset integer no Number of organizations to skip for pagination.
query string no Search query to filter organizations by name.

clerk.clerk_get_current_user

Health check — verify Clerk API connectivity by fetching the first user. Returns a single user or empty result to confirm the API is reachable.

Operation
Read read
Schema command
kosmo integrations:schema clerk.clerk_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.