Builds an OpenAPI document from the sanitized Payload config, covering collections, globals, auth, versions, uploads, jobs and endpoints of official plugins. It plugs in through the plugins array and serves the spec plus an interactive Scalar or Swagger UI page. Requires Payload 4.0.0-beta.4 or later, Next.js 16.4 or later and Node.js 24.22.1 or later. Sends opt-out anonymous telemetry.
Payload plugin that generates OpenAPI 3.0/3.1/3.2 docs, with Scalar or Swagger UI
Installation
npm i @seshuk/payload-plugin-openapi18
Stars
1
Forks
6
Open Issues
1 weeks ago
Last Updated
1.5k
Weekly Downloads
v0.2.3
npm Version
469.1 KB
Unpacked Size
1
Dependencies
18+4 since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 18 |
| Dec 4, 2026 | 18 |
| Dec 3, 2026 | 18 |
| Dec 2, 2026 | 18 |
| Dec 1, 2026 | 18 |
| Nov 30, 2026 | 18 |
| Nov 29, 2026 | 18 |
| Nov 28, 2026 | 18 |
| Nov 27, 2026 | 18 |
| Nov 26, 2026 | 18 |
| Nov 25, 2026 | 18 |
| Nov 24, 2026 | 18 |
| Nov 23, 2026 | 18 |
| Nov 22, 2026 | 18 |
| Nov 21, 2026 | 18 |
| Nov 20, 2026 | 18 |
| Nov 19, 2026 | 18 |
| Nov 18, 2026 | 18 |
| Nov 17, 2026 | 18 |
| Nov 16, 2026 | 18 |
| Nov 15, 2026 | 18 |
| Nov 14, 2026 | 18 |
| Nov 13, 2026 | 18 |
| Nov 12, 2026 | 18 |
| Nov 11, 2026 | 18 |
| Nov 10, 2026 | 18 |
| Nov 9, 2026 | 18 |
| Nov 8, 2026 | 18 |
| Nov 7, 2026 | 18 |
| Nov 6, 2026 | 18 |
| Nov 5, 2026 | 18 |
| Nov 4, 2026 | 18 |
| Nov 3, 2026 | 18 |
| Nov 2, 2026 | 18 |
| Nov 1, 2026 | 18 |
| Oct 31, 2026 | 18 |
| Oct 30, 2026 | 18 |
| Oct 29, 2026 | 18 |
| Oct 28, 2026 | 18 |
| Oct 27, 2026 | 18 |
| Oct 26, 2026 | 18 |
| Oct 25, 2026 | 18 |
| Oct 24, 2026 | 18 |
| Oct 23, 2026 | 18 |
| Oct 22, 2026 | 18 |
| Oct 21, 2026 | 18 |
| Oct 20, 2026 | 18 |
| Oct 19, 2026 | 18 |
| Oct 18, 2026 | 18 |
| Oct 17, 2026 | 18 |
| Oct 16, 2026 | 18 |
| Oct 15, 2026 | 18 |
| Oct 14, 2026 | 17 |
| Oct 13, 2026 | 17 |
| Oct 12, 2026 | 17 |
| Oct 11, 2026 | 17 |
| Oct 10, 2026 | 15 |
| Oct 9, 2026 | 14 |
| Oct 8, 2026 | 14 |
| Oct 7, 2026 | 14 |
| Oct 6, 2026 | 14 |
| Oct 5, 2026 | 14 |
| Oct 4, 2026 | 14 |
| Oct 3, 2026 | 14 |
| Oct 2, 2026 | 14 |
| Oct 1, 2026 | 14 |
| Sep 30, 2026 | 14 |
| Sep 29, 2026 | 14 |
| Sep 28, 2026 | 14 |
| Sep 27, 2026 | 14 |
| Sep 26, 2026 | 14 |
| Sep 25, 2026 | 14 |
| Sep 24, 2026 | 14 |
| Sep 23, 2026 | 14 |
| Sep 22, 2026 | 14 |
| Sep 21, 2026 | 14 |
| Sep 20, 2026 | 14 |
| Sep 19, 2026 | 14 |
| Sep 18, 2026 | 14 |
| Sep 17, 2026 | 14 |
| Sep 16, 2026 | 14 |
| Sep 15, 2026 | 14 |
| Sep 14, 2026 | 14 |
| Sep 13, 2026 | 14 |
| Sep 12, 2026 | 14 |
| Sep 11, 2026 | 14 |
| Sep 10, 2026 | 14 |
| Sep 9, 2026 | 14 |
| Sep 8, 2026 | 14 |
| Sep 7, 2026 | 14 |
| Sep 6, 2026 | 14 |
1.5K+1.2K since Sep 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 1,472 |
| Dec 4, 2026 | 1,472 |
| Dec 3, 2026 | 1,450 |
| Dec 2, 2026 | 1,515 |
| Dec 1, 2026 | 1,511 |
| Nov 30, 2026 | 1,529 |
| Nov 29, 2026 | 1,409 |
| Nov 28, 2026 | 1,470 |
| Nov 27, 2026 | 1,404 |
| Nov 26, 2026 | 1,317 |
| Nov 25, 2026 | 1,053 |
| Nov 24, 2026 | 1,044 |
| Nov 23, 2026 | 1,018 |
| Nov 22, 2026 | 986 |
| Nov 21, 2026 | 865 |
| Nov 20, 2026 | 811 |
| Nov 19, 2026 | 769 |
| Nov 18, 2026 | 857 |
| Nov 17, 2026 | 858 |
| Nov 16, 2026 | 876 |
| Nov 15, 2026 | 821 |
| Nov 14, 2026 | 796 |
| Nov 13, 2026 | 724 |
| Nov 12, 2026 | 762 |
| Nov 11, 2026 | 785 |
| Nov 10, 2026 | 789 |
| Nov 9, 2026 | 785 |
| Nov 8, 2026 | 988 |
| Nov 7, 2026 | 1,015 |
| Nov 6, 2026 | 1,051 |
| Nov 5, 2026 | 1,040 |
| Nov 4, 2026 | 1,045 |
| Nov 3, 2026 | 1,042 |
| Nov 2, 2026 | 1,047 |
| Nov 1, 2026 | 936 |
| Oct 31, 2026 | 939 |
| Oct 30, 2026 | 924 |
| Oct 29, 2026 | 721 |
| Oct 28, 2026 | 503 |
| Oct 27, 2026 | 525 |
| Oct 26, 2026 | 514 |
| Oct 25, 2026 | 583 |
| Oct 24, 2026 | 719 |
| Oct 23, 2026 | 595 |
| Oct 22, 2026 | 771 |
| Oct 21, 2026 | 940 |
| Oct 20, 2026 | 952 |
| Oct 19, 2026 | 1,079 |
| Oct 18, 2026 | 1,092 |
| Oct 17, 2026 | 1,522 |
| Oct 16, 2026 | 1,735 |
| Oct 15, 2026 | 1,732 |
| Oct 14, 2026 | 1,639 |
| Oct 13, 2026 | 1,620 |
| Oct 12, 2026 | 1,486 |
| Oct 11, 2026 | 1,377 |
| Oct 10, 2026 | 728 |
| Oct 9, 2026 | 665 |
| Oct 8, 2026 | 633 |
| Oct 7, 2026 | 655 |
| Oct 6, 2026 | 640 |
| Oct 5, 2026 | 636 |
| Oct 4, 2026 | 644 |
| Oct 3, 2026 | 699 |
| Oct 2, 2026 | 705 |
| Oct 1, 2026 | 641 |
| Sep 30, 2026 | 669 |
| Sep 29, 2026 | 658 |
| Sep 28, 2026 | 666 |
| Sep 27, 2026 | 761 |
| Sep 26, 2026 | 720 |
| Sep 25, 2026 | 691 |
| Sep 24, 2026 | 747 |
| Sep 23, 2026 | 740 |
| Sep 22, 2026 | 761 |
| Sep 21, 2026 | 758 |
| Sep 20, 2026 | 640 |
| Sep 19, 2026 | 586 |
| Sep 18, 2026 | 620 |
| Sep 17, 2026 | 593 |
| Sep 16, 2026 | 598 |
| Sep 15, 2026 | 596 |
| Sep 14, 2026 | 602 |
| Sep 13, 2026 | 588 |
| Sep 12, 2026 | 587 |
| Sep 11, 2026 | 490 |
| Sep 10, 2026 | 445 |
| Sep 9, 2026 | 379 |
| Sep 8, 2026 | 367 |
| Sep 7, 2026 | 354 |
| Sep 6, 2026 | 315 |
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/1254944928-root)<a href="https://payloaddirectory.dev/plugins/1254944928-root"><img src="https://payloaddirectory.dev/badge/1254944928-root.svg" alt="Payload Directory"></a>README
Generate an OpenAPI 3.0/3.1/3.2 specification from your Payload config and serve it with Scalar or Swagger UI.
custom.openapi key. No wrapper, no separate registry.payload openapi:generate for CI, schema diffs, or client codegen.Requires Payload 4.0.0-beta.4 or later, Next.js 16.4 or later and Node.js 24.22.1 or later. On Payload 3, use @seshuk/payload-plugin-openapi@0.
npm install @seshuk/payload-plugin-openapi@beta
v1 is in beta under the beta npm tag, and Payload 4 is published under beta.
Add the plugin to your Payload config, plus a docs UI renderer:
import { openapi, scalar } from '@seshuk/payload-plugin-openapi'
import { buildConfig } from 'payload'
export default buildConfig({
plugins: [
openapi({
info: {
title: 'My API',
version: '1.0.0',
},
}),
scalar(),
],
})
Two endpoints are now live, both relative to your API route (/api by default):
GET /api/openapi.json — the generated OpenAPI documentGET /api/docs — the interactive API referenceinfo.title and info.version are required; the plugin throws at boot without them. Prefer Swagger UI? Swap scalar() for swaggerUi(), or mount both on different paths.
The document is built lazily from the fully sanitized config, so collections, fields, and endpoints added by other plugins are picked up regardless of plugin order.
Add filters to control what is exposed, interactiveAuth for a login dialog in the docs UI, extensions for anything the generator doesn't produce on its own — see the configuration reference.
v1 renames a few options. The plugin throws at boot when it finds an old name.
// 0.x
openapi({
metadata: { title, version },
specEndpoint: '/spec.json',
interactiveAuth: { endpoint: '/login' },
securityWhen: ({ slug }) => (slug === 'feed' ? true : undefined),
filters: { excludeWhen: ({ path }) => path.includes('/internal/') },
})
scalar({ specEndpoint: '/api/spec.json' })
// v1
openapi({
info: { title, version },
path: '/spec.json',
interactiveAuth: { path: '/login' },
security: ({ slug }) => (slug === 'feed' ? 'public' : undefined),
filters: { excludeOperations: [({ path }) => path.includes('/internal/')] },
})
scalar() // follows the openapi() path; use specURL for another URL
// 0.x
custom: { openapi: { security: { read: true, create: false } } }
// v1
custom: { openapi: { security: { read: 'public', create: 'secured' } } }
The spec no longer reads servers from the Host header. It uses serverURL, the new servers option, or hosts you list in trustedHosts. An extension transform that throws now fails the request. The spec and docs page are open by default. Add access to openapi() and scalar() to make them private. See Upgrading from 0.x.
Full docs are at https://payload-plugin-openapi.seshuk.im/:
openapi:generateWhen you install an official Payload plugin, the spec documents the REST endpoints it mounts: @payloadcms/plugin-ecommerce, plugin-stripe, plugin-mcp, plugin-seo, plugin-search, plugin-multi-tenant, plugin-import-export and storage-r2. There is nothing to configure. Filter them with excludeOperations: [{ plugin: '@payloadcms/plugin-stripe' }] or { kind: 'plugin' }. See Official plugins.
If you maintain a Payload plugin, attach a custom.openapi Operation Object to the endpoints you add and they show up in the generated spec — no dependency on this package, and nothing for your users to wire up. The same key works on fields. If this plugin isn't installed, the metadata is inert. See For plugin authors.
The plugin sends an anonymous, opt-out usage report once per day: plugin, Payload, and Node versions plus which features are enabled. It never sends secrets, IPs, keys, URLs, paths, hostnames, collection names, or anything from your spec. A one-time notice prints on first run.
Opt out with telemetry: false, DO_NOT_TRACK=1, or OPENAPI_TELEMETRY_DISABLED=1 (also disabled automatically in CI and when payload.config.telemetry is false). See Telemetry for the full list of what is and isn't collected.
Bug reports, feature requests, and questions go to GitHub Issues. For Payload itself, see the Payload docs and Discord.
MIT — see LICENSE.
Built by Maxim Seshuk for the Payload community.
If this plugin saves you time, you can buy me a coffee ☕
Topics
payload oapi
Generate an OpenAPI spec from your Payload config with optional documentation UIs
7631.1k/wk125v3
create api docs
CLI that generates OpenAPI 3 documentation for a Payload CMS project
4348/wk143v1
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
query
Typesafe query filters and field selection for Payload's REST and internal APIs
4526/wk143v1
payload plugin api guide
Generates a live API reference and agent-readable query guide from your Payload configuration
448/wk2v3