OpenAPI

Autogenerate an OpenAPI specification from a Payload CMS instance and render it with Swagger UI, Redoc, RapiDoc, or Scalar.

Community 124 14.7k/wk MIT v0.3.0

Installation

pnpm add payload-oapi

About

The plugin walks your Payload config and emits a complete OpenAPI spec covering collection CRUD, global CRUD, auth operations, preferences, and custom endpoints. It supports both OpenAPI 3.0 and 3.1 output, down-converting from 3.1 when needed. The spec is served from a configurable endpoint, `/api/openapi.json` by default. Auth collections are documented according to their auth config. `disableLocalStrategy` drops the password operations, `loginWithUsername` changes the login body shape, `maxLoginAttempts: 0` removes `/unlock`, and enabling `verify` adds `/verify/{id}`. Custom endpoints declared via `endpoints` on a collection, global, or the config root are picked up when they carry an OpenAPI operation under `custom.openapi`; the generator fills in `tags`, `operationId`, `summary`, and `security` for anything you omit. You can filter which collections and globals appear using `includeCollections`, `excludeCollections`, `includeGlobals`, `excludeGlobals`, and `hideInternalCollections`. An `apiBasePath` option lets you override the path prefix for generated operations, useful when the API sits behind a reverse proxy under a different prefix. For browsing, the package ships separate UI plugins for Scalar, Swagger UI, RapiDoc, and Redoc. Add one alongside the core `openapi` plugin and the docs become available at `/api/docs`. The package targets Payload CMS 3.x and is written in TypeScript.

Package info

Package name
payload-oapi
Latest version
0.3.0
Unpacked size
187 kB
License
MIT
Weekly downloads
14.7k
Last publish
Sep 18, 2026

Similar plugins

More in Devtools