scalar() and swaggerUi(). Each is a separate Payload plugin you add alongside openapi() — mount one, or both on different paths:
payload.config.ts
routes.api, /api by default).
Options
Both renderers accept the same options:
The default
cdnBase is https://cdn.jsdelivr.net/npm/@scalar/api-reference for Scalar and https://cdn.jsdelivr.net/npm/swagger-ui-dist for Swagger UI.
Passing UI configuration
configuration is passed straight through to the underlying library — Scalar’s createApiReference config or Swagger UI’s SwaggerUIBundle options. It must be JSON-serializable; functions aren’t supported here.
payload.config.ts
Serving a static spec
The UI loads the spec from a URL, and that URL doesn’t have to be the plugin’s runtime endpoint. PointspecEndpoint at a pre-generated file and the UI renders it directly:
payload.config.ts
Language switcher
For multi-language docs, point Scalar’ssources at the spec endpoint with different ?lang= values. When sources is set, the renderer’s own specEndpoint is ignored. Swagger UI has no built-in switcher — mount one instance per language instead. See Internationalization for both setups.