data
Payload CMS CLI for Headless Automation
Use the Payload CMS CLI for headless automation with headless JSON commands, schema discovery, credentials, and permission controls.
7 functions 6 read 1 write API token auth
Payload CMS 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 Payload CMS CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Payload CMS CLI for Headless Automation
kosmokrator integrations:configure payload-cms --set api_token="$PAYLOAD_CMS_API_TOKEN" --enable --read allow --write ask --json
kosmo integrations:call payload-cms.payload_cms_list_collections '{}' --json Discovery Before Execution
Agents and scripts can inspect Payload CMS docs and schemas before choosing a function.
kosmo integrations:docs payload-cms --json
kosmo integrations:docs payload-cms.payload_cms_list_collections --json
kosmo integrations:schema payload-cms.payload_cms_list_collections --json
kosmo integrations:search "Payload CMS" --json
kosmo integrations:list --json Useful Payload CMS CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
payload-cms.payload_cms_list_collections | Read | none | List all collections defined in the Payload CMS instance. Returns each collection's slug, labels, and field configuration. |
payload-cms.payload_cms_get_collection | Read | slug | Get detailed information about a specific collection by its slug. Returns field definitions, labels, default sort, and other configuration. |
payload-cms.payload_cms_list_documents | Read | collection, limit, page, sort, where | List documents in a Payload CMS collection. Supports pagination (limit, page), sorting, and filtering via the where parameter. Returns document IDs, timestamps, and field values. |
payload-cms.payload_cms_get_document | Read | collection, document_id | Get detailed information about a specific document by its ID within a collection. Returns all field values, timestamps, and metadata. |
payload-cms.payload_cms_create_document | Write | collection, data | Create a new document in a Payload CMS collection. Provide the collection slug and a JSON object of field values. The document is created as a draft by default (if versions are enabled on the collection). |
payload-cms.payload_cms_list_users | Read | limit, page | List users in the Payload CMS instance. Supports pagination with limit and page parameters. Returns user IDs, emails, names, and roles. |
payload-cms.payload_cms_get_current_user | Read | none | Get the profile of the currently authenticated Payload CMS user. Returns email, name, roles, and account metadata. |
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.