Kest

Search

Search the documentation

OpenAPI

Decorators

Mark endpoints as secured or hidden.

Two annotations control who sees what in the documentation:

AnnotationOnEffect
@ApiBearerAuthcontroller or handlermarks it as needing a bearer token; the Authorize button in the reference then sends it
@ApiHiddencontroller or handlerleaves it out of the reference and the export
@Controller("/admin") @ApiBearerAuth @ApiHidden class InternalController { ... }       // needs a token, and is not documented publicly
  • @Authenticated, @Role and @Roles imply @ApiBearerAuth: an endpoint guarded that way is already shown as secured. Use the annotation for endpoints you protect in some other way (a guard of your own).
  • Hidden is not secret. @ApiHidden only omits the endpoint from the docs. Protect it with a guard as usual.
  • Hide internal and operational endpoints (health, metrics, admin tools) from the public reference.

For the kind of authentication (bearer, API key, OAuth2) shown in the OpenAPI file see Security.

Read more