aamdmn

payload cli

by aamdmn
Testing & developer experience
v3
^3.0.0
MIT

Overview

Summary generated from the README

A CLI that imports your Payload config, initializes the Local API and runs commands directly against your database. No server, API keys or MCP are needed. It can list and describe collections, query, create, update and delete documents, and upload or download media. Requires Node.js 22.12 or newer and Payload 3.

Features

  • Discover collections and globals and describe their schemas, with example JSON field structures
  • Find, create, update and delete documents, including bulk update and delete with where filters
  • Upload and download media, and attach files to document fields with the file flag
  • Machine-readable JSON output and dry-run validation before writing
  • Locale and fallback locale options for localized fields
  • Includes a Claude Code skill that teaches agents a discover, read, write and verify workflow

Use cases

  • Let AI coding agents read and edit CMS content without running a server or exposing API keys
  • Script bulk content updates, deletions or media imports from the terminal
  • Inspect collection schemas and data quickly while developing a Payload project

From the author

PayloadCMS CLI for AI agents and humans. Simple, direct access to your CMS data.

Installation

npm i payload-cli

13

Stars

0

Forks

0

Open Issues

2 months ago

Last Updated

8

Weekly Downloads

v0.6.0

npm Version

189.4 KB

Unpacked Size

1

Dependencies

GitHub stars

13+3 since Sep 6

Show data
GitHub stars by day (UTC)
DateStars
Dec 5, 202613
Dec 4, 202613
Dec 3, 202613
Dec 2, 202613
Dec 1, 202613
Nov 30, 202613
Nov 29, 202613
Nov 28, 202613
Nov 27, 202613
Nov 26, 202613
Nov 25, 202613
Nov 24, 202613
Nov 23, 202613
Nov 22, 202613
Nov 21, 202613
Nov 20, 202613
Nov 19, 202613
Nov 18, 202613
Nov 17, 202613
Nov 16, 202613
Nov 15, 202613
Nov 14, 202613
Nov 13, 202613
Nov 12, 202613
Nov 11, 202613
Nov 10, 202613
Nov 9, 202613
Nov 8, 202613
Nov 7, 202613
Nov 6, 202613
Nov 5, 202613
Nov 4, 202613
Nov 3, 202613
Nov 2, 202613
Nov 1, 202613
Oct 31, 202613
Oct 30, 202613
Oct 29, 202613
Oct 28, 202613
Oct 27, 202613
Oct 26, 202613
Oct 25, 202613
Oct 24, 202613
Oct 23, 202613
Oct 22, 202613
Oct 21, 202613
Oct 20, 202613
Oct 19, 202613
Oct 18, 202613
Oct 17, 202613
Oct 16, 202613
Oct 15, 202613
Oct 14, 202613
Oct 13, 202613
Oct 12, 202613
Oct 11, 202612
Oct 10, 202612
Oct 9, 202611
Oct 8, 202611
Oct 7, 202611
Oct 6, 202611
Oct 5, 202611
Oct 4, 202611
Oct 3, 202611
Oct 2, 202611
Oct 1, 202611
Sep 30, 202611
Sep 29, 202611
Sep 28, 202611
Sep 27, 202611
Sep 26, 202611
Sep 25, 202611
Sep 24, 202611
Sep 23, 202611
Sep 22, 202611
Sep 21, 202611
Sep 20, 202611
Sep 19, 202611
Sep 18, 202611
Sep 17, 202611
Sep 16, 202611
Sep 15, 202611
Sep 14, 202611
Sep 13, 202610
Sep 12, 202610
Sep 11, 202610
Sep 10, 202610
Sep 9, 202610
Sep 8, 202610
Sep 7, 202610
Sep 6, 202610
npm weekly downloads

3−5 since Sep 6

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 20263
Dec 4, 20263
Dec 3, 20263
Dec 2, 20262
Dec 1, 20265
Nov 30, 20266
Nov 29, 20265
Nov 28, 20265
Nov 27, 20265
Nov 26, 20265
Nov 25, 20265
Nov 24, 20262
Nov 23, 20261
Nov 22, 20263
Nov 21, 20265
Nov 20, 20267
Nov 19, 20269
Nov 18, 202611
Nov 17, 202611
Nov 16, 202611
Nov 15, 202610
Nov 14, 20269
Nov 13, 202610
Nov 12, 202611
Nov 11, 202610
Nov 10, 202611
Nov 9, 202613
Nov 8, 202614
Nov 7, 202615
Nov 6, 202611
Nov 5, 20269
Nov 4, 20268
Nov 3, 20267
Nov 2, 20267
Nov 1, 20267
Oct 31, 20267
Oct 30, 20269
Oct 29, 20268
Oct 28, 20268
Oct 27, 20269
Oct 26, 20268
Oct 25, 20269
Oct 24, 20268
Oct 23, 20266
Oct 22, 20269
Oct 21, 20269
Oct 20, 20268
Oct 19, 20269
Oct 18, 20266
Oct 17, 20269
Oct 16, 20269
Oct 15, 20268
Oct 14, 20268
Oct 13, 20269
Oct 12, 20267
Oct 11, 20268
Oct 10, 20264
Oct 9, 20264
Oct 8, 20264
Oct 7, 20264
Oct 6, 20263
Oct 5, 20264
Oct 4, 20263
Oct 3, 20264
Oct 2, 20265
Oct 1, 20263
Sep 30, 20264
Sep 29, 20264
Sep 28, 20264
Sep 27, 20265
Sep 26, 20267
Sep 25, 20266
Sep 24, 20266
Sep 23, 20266
Sep 22, 20268
Sep 21, 20268
Sep 20, 20269
Sep 19, 20266
Sep 18, 20266
Sep 17, 20267
Sep 16, 20268
Sep 15, 20266
Sep 14, 20267
Sep 13, 20265
Sep 12, 20265
Sep 11, 20265
Sep 10, 20264
Sep 9, 20266
Sep 8, 20266
Sep 7, 20268
Sep 6, 20268

Each point is npm's rolling 7-day download count.

Health Score

58/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1179965144-root.svg)](https://payloaddirectory.dev/plugins/1179965144-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1179965144-root"><img src="https://payloaddirectory.dev/badge/1179965144-root.svg" alt="Payload Directory"></a>
Updated Sep 17, 2026Created Mar 12, 2026Published Jun 1, 2026

README



payload-cli

PayloadCMS automation CLI for AI agents



Direct database access to PayloadCMS through the Local API. No server, no API keys, no MCP. Just commands.

Built for AI coding agents (Opencode, Claude Code, etc.) but works great for humans too.

Quick Start

cd your-payload-project
npx payload-cli collections                  # discover
npx payload-cli describe posts               # understand schema
npx payload-cli describe posts --examples    # see JSON field structures
npx payload-cli find posts --limit 5         # read
npx payload-cli create posts --data '{"title":"Hello"}' # write

Or point at a config directly:

npx payload-cli find posts --config ./src/payload.config.ts

Commands

CommandDescription
collectionsList all collections
globalsList all globals
describe <name> [--examples]Show full schema (with sample JSON field structures)
statusInstance status
find <collection>Query documents (--where, --limit, --sort, --select, --depth)
find-by-id <collection> <id>Get a single document
create <collection> --data '{...}'Create a document
update <collection> <id> --data '{...}'Partial update
update-many <collection> --where --dataBulk update
delete <collection> <id> --confirmDelete (previews first)
delete-many <collection> --where --confirmBulk delete
upload <collection> <file|dir>Upload file(s) to an upload collection
download <collection> <id|--where>Download media to disk
get-global <slug>Read a global
update-global <slug> --data '{...}'Update a global

Media

Upload, download, and attach files to documents:

# Upload
payload-cli upload media ./hero.jpg --data '{"alt":"Hero image"}'
payload-cli upload media ./photos/             # bulk upload directory

# Download
payload-cli download media 6789abc --out ./downloads/
payload-cli download media --where '{"alt":{"contains":"hero"}}'

# Auto-upload and attach to a document field
payload-cli create pages --data '{"title":"About"}' --file 'heroImage=./hero.jpg'
payload-cli update pages <id> --data '{}' --file 'thumbnail=./thumb.png'

The --file flag auto-detects the target upload collection from the field schema, uploads the file, and injects the resulting ID.

Flags

FlagDescription
--jsonMachine-readable JSON output
--dry-runValidate without writing
--confirmConfirm destructive operations
--config <path>Path to payload.config.ts
--locale <code>Locale for reading/writing localized fields (use all to see all locales)
--fallback-locale <code>Fallback locale for reads (use none to disable)
--file 'field=./path'Upload and attach file to a field
--data @file.jsonRead --data JSON from a file instead of inline
--examplesShow example values for json fields (use with describe)
--include-sensitiveInclude password hashes, API keys, etc.

How It Works

payload-cli find posts --limit 5
       |
       v
  Import your payload.config.ts
  Initialize Payload Local API
  payload.find({ collection: 'posts', limit: 5 })
  Output result

No HTTP server needed. Connects directly to your database through Payload's own Local API.

Agent Skill

The skills/ directory contains a Claude Code skill that teaches agents the discover-describe-read-write-verify workflow:

# Agents learn to:
# 1. payload-cli collections              -> what exists?
# 2. payload-cli describe posts           -> what fields?
# 3. payload-cli describe posts --examples -> what shape are json fields?
# 4. payload-cli find posts               -> what data?
# 5. payload-cli create posts --data      -> write
# 6. payload-cli find-by-id posts         -> verify

Requirements

  • Node.js >=22.12.0
  • Payload CMS ^3.0.0

License

MIT

Similar plugins