Reads your Payload config and serves project-specific API documentation under a configurable route. It produces an HTML guide, an OpenAPI 3.1 spec, a Scalar-based API browser, agent instructions, a JSON project map, llms.txt and query recipes. Requires Payload 3.85.0 or later and is added through the plugins array.
Generate a live API reference and agent-first query guide for your Payload CMS project
Installation
npm i @matija2209/payload-agent-api-guide2
Stars
0
Forks
0
Open Issues
6 months ago
Last Updated
8
Weekly Downloads
v1.0.1
npm Version
121.2 KB
Unpacked Size
0
Dependencies
20 since Sep 7
| Date | Stars |
|---|---|
| Dec 6, 2026 | 2 |
| Dec 5, 2026 | 2 |
| Dec 4, 2026 | 2 |
| Dec 3, 2026 | 2 |
| Dec 2, 2026 | 2 |
| Dec 1, 2026 | 2 |
| Nov 30, 2026 | 2 |
| Nov 29, 2026 | 2 |
| Nov 28, 2026 | 2 |
| Nov 27, 2026 | 2 |
| Nov 26, 2026 | 2 |
| Nov 25, 2026 | 2 |
| Nov 24, 2026 | 2 |
| Nov 23, 2026 | 2 |
| Nov 22, 2026 | 2 |
| Nov 21, 2026 | 2 |
| Nov 20, 2026 | 2 |
| Nov 19, 2026 | 2 |
| Nov 18, 2026 | 2 |
| Nov 17, 2026 | 2 |
| Nov 16, 2026 | 2 |
| Nov 15, 2026 | 2 |
| Nov 14, 2026 | 2 |
| Nov 13, 2026 | 2 |
| Nov 12, 2026 | 2 |
| Nov 11, 2026 | 2 |
| Nov 10, 2026 | 2 |
| Nov 9, 2026 | 2 |
| Nov 8, 2026 | 2 |
| Nov 7, 2026 | 2 |
| Nov 6, 2026 | 2 |
| Nov 5, 2026 | 2 |
| Nov 4, 2026 | 2 |
| Nov 3, 2026 | 2 |
| Nov 2, 2026 | 2 |
| Nov 1, 2026 | 2 |
| Oct 31, 2026 | 2 |
| Oct 30, 2026 | 2 |
| Oct 29, 2026 | 2 |
| Oct 28, 2026 | 2 |
| Oct 27, 2026 | 2 |
| Oct 26, 2026 | 2 |
| Oct 25, 2026 | 2 |
| Oct 24, 2026 | 2 |
| Oct 23, 2026 | 2 |
| Oct 22, 2026 | 2 |
| Oct 21, 2026 | 2 |
| Oct 20, 2026 | 2 |
| Oct 19, 2026 | 2 |
| Oct 18, 2026 | 2 |
| Oct 17, 2026 | 2 |
| Oct 16, 2026 | 2 |
| Oct 15, 2026 | 2 |
| Oct 14, 2026 | 2 |
| Oct 13, 2026 | 2 |
| Oct 12, 2026 | 2 |
| Oct 11, 2026 | 2 |
| Oct 10, 2026 | 2 |
| Oct 9, 2026 | 2 |
| Oct 8, 2026 | 2 |
| Oct 7, 2026 | 2 |
| Oct 6, 2026 | 2 |
| Oct 5, 2026 | 2 |
| Oct 4, 2026 | 2 |
| Oct 3, 2026 | 2 |
| Oct 2, 2026 | 2 |
| Oct 1, 2026 | 2 |
| Sep 30, 2026 | 2 |
| Sep 29, 2026 | 2 |
| Sep 28, 2026 | 2 |
| Sep 27, 2026 | 2 |
| Sep 26, 2026 | 2 |
| Sep 25, 2026 | 2 |
| Sep 24, 2026 | 2 |
| Sep 23, 2026 | 2 |
| Sep 22, 2026 | 2 |
| Sep 21, 2026 | 2 |
| Sep 20, 2026 | 2 |
| Sep 19, 2026 | 2 |
| Sep 18, 2026 | 2 |
| Sep 17, 2026 | 2 |
| Sep 16, 2026 | 2 |
| Sep 15, 2026 | 2 |
| Sep 14, 2026 | 2 |
| Sep 13, 2026 | 2 |
| Sep 12, 2026 | 2 |
| Sep 11, 2026 | 2 |
| Sep 10, 2026 | 2 |
| Sep 9, 2026 | 2 |
| Sep 8, 2026 | 2 |
| Sep 7, 2026 | 2 |
8+3 since Sep 7
| Date | Weekly downloads |
|---|---|
| Dec 6, 2026 | 8 |
| Dec 5, 2026 | 5 |
| Dec 4, 2026 | 6 |
| Dec 3, 2026 | 6 |
| Dec 2, 2026 | 4 |
| Dec 1, 2026 | 5 |
| Nov 30, 2026 | 7 |
| Nov 29, 2026 | 7 |
| Nov 28, 2026 | 6 |
| Nov 27, 2026 | 5 |
| Nov 26, 2026 | 4 |
| Nov 25, 2026 | 4 |
| Nov 24, 2026 | 3 |
| Nov 23, 2026 | 1 |
| Nov 22, 2026 | 3 |
| Nov 21, 2026 | 4 |
| Nov 20, 2026 | 4 |
| Nov 19, 2026 | 4 |
| Nov 18, 2026 | 6 |
| Nov 17, 2026 | 5 |
| Nov 16, 2026 | 5 |
| Nov 15, 2026 | 4 |
| Nov 14, 2026 | 3 |
| Nov 13, 2026 | 3 |
| Nov 12, 2026 | 3 |
| Nov 11, 2026 | 1 |
| Nov 10, 2026 | 3 |
| Nov 9, 2026 | 3 |
| Nov 8, 2026 | 4 |
| Nov 7, 2026 | 6 |
| Nov 6, 2026 | 6 |
| Nov 5, 2026 | 6 |
| Nov 4, 2026 | 8 |
| Nov 3, 2026 | 6 |
| Nov 2, 2026 | 7 |
| Nov 1, 2026 | 6 |
| Oct 31, 2026 | 5 |
| Oct 30, 2026 | 5 |
| Oct 29, 2026 | 5 |
| Oct 28, 2026 | 3 |
| Oct 27, 2026 | 4 |
| Oct 26, 2026 | 3 |
| Oct 25, 2026 | 3 |
| Oct 24, 2026 | 2 |
| Oct 23, 2026 | 2 |
| Oct 22, 2026 | 4 |
| Oct 21, 2026 | 4 |
| Oct 20, 2026 | 3 |
| Oct 19, 2026 | 6 |
| Oct 18, 2026 | 6 |
| Oct 17, 2026 | 6 |
| Oct 16, 2026 | 6 |
| Oct 15, 2026 | 4 |
| Oct 14, 2026 | 4 |
| Oct 13, 2026 | 4 |
| Oct 12, 2026 | 1 |
| Oct 11, 2026 | 1 |
| Oct 10, 2026 | 2 |
| Oct 9, 2026 | 2 |
| Oct 8, 2026 | 2 |
| Oct 7, 2026 | 2 |
| Oct 6, 2026 | 2 |
| Oct 5, 2026 | 2 |
| Oct 4, 2026 | 1 |
| Oct 3, 2026 | 0 |
| Oct 2, 2026 | 0 |
| Oct 1, 2026 | 0 |
| Sep 30, 2026 | 0 |
| Sep 29, 2026 | 0 |
| Sep 28, 2026 | 0 |
| Sep 27, 2026 | 0 |
| Sep 26, 2026 | 5 |
| Sep 25, 2026 | 5 |
| Sep 24, 2026 | 5 |
| Sep 23, 2026 | 5 |
| Sep 22, 2026 | 6 |
| Sep 21, 2026 | 8 |
| Sep 20, 2026 | 11 |
| Sep 19, 2026 | 6 |
| Sep 18, 2026 | 7 |
| Sep 17, 2026 | 8 |
| Sep 16, 2026 | 8 |
| Sep 15, 2026 | 9 |
| Sep 14, 2026 | 7 |
| Sep 13, 2026 | 4 |
| Sep 12, 2026 | 5 |
| Sep 11, 2026 | 4 |
| Sep 10, 2026 | 4 |
| Sep 9, 2026 | 5 |
| Sep 8, 2026 | 4 |
| Sep 7, 2026 | 5 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1258571172-root)<a href="https://payloaddirectory.dev/plugins/1258571172-root"><img src="https://payloaddirectory.dev/badge/1258571172-root.svg" alt="Payload Directory"></a>README
Generate a live API reference and agent-first query guide from your Payload CMS configuration.
This plugin reads your live Payload config and turns it into practical API documentation, an OpenAPI reference, and agent-readable instructions — so developers and AI coding agents can understand how to query your project without guessing.
Payload's REST API is powerful, but beginners and AI agents often get the details wrong. They may assume generic REST patterns — for example, fetching a post by slug with /api/posts/my-slug — instead of using Payload's actual query syntax with where.slug.equals.
This plugin solves that by generating project-specific documentation directly from your Payload setup.
All routes are served under {payload.routes.api}/api-guide (default: /api/api-guide).
| Route | Description |
|---|---|
/api/api-guide | Human-readable HTML guide |
/api/api-guide/reference | Interactive API browser (Scalar UI) |
/api/api-guide/openapi.json | OpenAPI 3.1 spec |
/api/api-guide/agent.md | Concise rules guide for AI coding agents |
/api/api-guide/agent.json | Structured project map (collections, fields, endpoints) |
/api/api-guide/llms.txt | LLM entry point with links to all resources |
/api/api-guide/query-recipes.json | Common query patterns per collection |
npm install @matija2209/payload-agent-api-guide
# or
pnpm add @matija2209/payload-agent-api-guide
Peer dependency: payload >= 3.85.0
import { buildConfig } from 'payload'
import { apiGuidePlugin } from '@matija2209/payload-agent-api-guide'
export default buildConfig({
plugins: [
apiGuidePlugin({
title: 'My Project API Guide',
}),
],
// ...rest of config
})
type ApiGuidePluginOptions = {
/** Disable the plugin without removing it. Default: true */
enabled?: boolean
/** Base path under the Payload API route. Default: '/api-guide' */
basePath?: string
/** Title shown in the HTML guide and OpenAPI spec. Default: 'Payload API Guide' */
title?: string
/** Include auth-enabled collections. Default: true */
includeAuth?: boolean
}
For each collection the plugin reads:
slug field exists (for slug-based fetch recipes)For each global:
/api/api-guide — A self-contained HTML page explaining how to use the REST API for this specific project. Includes field tables per collection, fetch examples, and a common-mistakes section.
/api/api-guide/reference — Scalar UI loaded from CDN, pointed at the generated OpenAPI spec.
/api/api-guide/openapi.json — A complete OpenAPI 3.1 spec with:
GET, POST, PATCH, DELETE) and global (GET, POST)slug fieldwhere, depth, select, limit, page, sort, locale, draft)/api/api-guide/agent.md — A markdown guide written for AI coding agents. Includes:
qs-esm code example/api/api-guide/agent.json — A structured JSON project map. Includes:
apiBase, collections, globalsqueryGuide block explaining Payload REST conventions in machine-readable form/api/api-guide/llms.txt — An entry-point file for LLMs following the llms.txt convention. Lists all generated resources with links.
/api/api-guide/query-recipes.json — An array of concrete query recipes per collection:
The recommended agent workflow when entering a Payload project with this plugin:
/api/api-guide/llms.txt for an overview of available resources/api/api-guide/agent.md for the rules of how to query this project/api/api-guide/agent.json for collections, fields, and endpoint patterns/api/api-guide/openapi.json for formal endpoint referenceNever fetch by slug as a path segment.
This is the most common Payload REST mistake:
// Wrong — returns 404 or wrong data
fetch('/api/posts/my-slug')
// Correct — use where query
fetch('/api/posts?where[slug][equals]=my-slug&limit=1')
.then(r => r.json())
.then(({ docs }) => docs[0])
Use qs-esm to build where queries safely:
import qs from 'qs-esm'
const query = qs.stringify({
where: { slug: { equals: 'my-post' } },
depth: 1,
limit: 1,
})
const res = await fetch(`/api/posts?${query}`)
const { docs } = await res.json()
const post = docs[0]
>= 3.85.0>= 18.20.2The package is intended to publish compiled output from dist/.
Before publishing locally:
pnpm install
pnpm build
pnpm test:int
npm pack --dry-run
npm publish --dry-run
For the first public release, publish manually:
npm publish --access public
After the package exists on npm, configure npm trusted publishing for
@matija2209/payload-agent-api-guide and use the GitHub Actions workflows in
.github/workflows/.
Recommended release flow:
.github/workflows/ci.yml run build, lint, integration tests, and e2e.package.json to the next version and commit it.v1.0.1..github/workflows/publish.yml publishes only if the tag matches the package version exactly.MIT
mcp
Adds Model Context Protocol capabilities to a Payload application
98275.9k/wk46.1kv3 v4
payload oapi
Generate an OpenAPI spec from your Payload config with optional documentation UIs
7631.1k/wk125v3
payload plugin openapi
Generate an OpenAPI 3.0, 3.1 or 3.2 spec from your Payload config and serve it with Scalar or Swagger UI
701.4k/wk18v4
swagger
Generate OpenAPI 3 docs from your Payload config and serve them through Swagger UI
541.4k/wk143v1
openapi
Generate OpenAPI 3 documents from your Payload config, including collection, global and custom endpoints
521.4k/wk143v1
create api docs
CLI that generates OpenAPI 3 documentation for a Payload CMS project
4348/wk143v1