Dosu LogoDosu Logo
Ask
Join our Discord
StrapiPublic
Strapi
DocumentsStrapi
documentation
documentation
Type
External
Status
Published
Created
Mar 5, 2026
Updated
Sep 9, 2026
Updated by
Dosu Bot
Source
View

Documentation plugin#

The Documentation plugin auto-generates OpenAPI/Swagger docs for your API by scanning content types and routes. This documentation walks you through installation, customizing settings, and restricting access to the docs.

The Documentation plugin automates your API documentation creation. It basically generates a swagger file. It follows the .

Usable via the admin panel.
Configured through both admin panel and server code, with different sets of options. `@strapi/plugin-documentation`

:::caution Unmaintained plugin
The Documentation plugin is not actively maintained and may not work with Strapi 5.
:::

If installed, the Documentation plugin will inspect content types and routes found on all APIs in your project and any plugin specified in the configuration. The plugin will then programmatically generate documentation to match the . The Documentation plugin generates the and and converts all Strapi types to .

The generated documentation JSON file can be found in your application at the following path: src/extensions/documentation/documentation/<version>/full_documentation.json

Installation#

To install the documentation plugin, run following command in your terminal:

yarn add @strapi/plugin-documentation
npm install @strapi/plugin-documentation

Once the plugin is installed, starting Strapi generates the API documentation.

Configuration#

Most configuration options for the Documentation plugin are handled via your Strapi project's code. A few settings are available in the admin panel.

Admin panel settings#

The Documentation plugin affects multiple parts of the admin panel. The following table lists all the additional options and settings that are added to a Strapi application once the plugin has been installed:

Section impactedOptions and settings
Documentation
    Addition of a new Documentation option in the main navigation which shows a panel with buttons to open and regenerate the documentation.
Settings
  • Addition of a "Documentation plugin" setting section, which controls whether the documentation endpoint is private or not (see restricting access).
    👉 Path reminder: Settings > Documentation plugin

  • Activation of role based access control for accessing, updating, deleting, and regenerating the documentation. Administrators can authorize different access levels to different types of users in the Plugins tab and the Settings tab (see Users & Permissions documentation).
    👉 Path reminder: Settings > Administration Panel > Roles

Restricting access to your API documentation {#restrict-access}#

By default, your API documentation will be accessible by anyone.

To restrict API documentation access, enable the Restricted Access option from the admin panel:

  1. Navigate to Settings in the main navigation of the admin panel.
  2. Choose Documentation.
  3. Toggle Restricted Access to ON.
  4. Define a password in the password input.
  5. Save the settings.

Code-based configuration#

To configure the Documentation plugin, create a settings.json file in the src/extensions/documentation/config folder. In this file, you can specify all your environment variables, licenses, external documentation links, and all the entries listed in the .

The following is an example configuration:

{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "DOCUMENTATION",
    "description": "",
    "termsOfService": "YOUR_TERMS_OF_SERVICE_URL",
    "contact": {
      "name": "TEAM",
      "email": "contact-email@something.io",
      "url": "mywebsite.io"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    }
  },
  "x-strapi-config": {
    "plugins": ["upload", "users-permissions"],
    "path": "/documentation"
  },
  "servers": [
    {
      "url": "http://localhost:1337/api",
      "description": "Development server"
    }
  ],
  "externalDocs": {
    "description": "Find out more",
    "url": "https://docs.strapi.io/developer-docs/latest/getting-started/introduction.html"
  },
  "security": [
    {
      "bearerAuth": []
    }
  ]
}
Tip

If you need to add a custom key, prefix it by x- (e.g., x-strapi-something).

Creating a new version of the documentation {#create-a-new-version-of-the-documentation}#

To create a new version, change the info.version key in the settings.json file:

{
  "info": {
    "version": "2.0.0"
  }
}

This will automatically create a new version.

Defining which plugins need documentation generated {#define-which-plugins}#

If you want plugins to be included in documentation generation, they should be included in the plugins array in the x-strapi-config object. By default, the array is initialized with ["upload", "users-permissions"]:

{
  "x-strapi-config": {
    "plugins": ["upload", "users-permissions"]
  }
}

To add more plugins, such as your custom plugins, add their name to the array.

If you do not want plugins to be included in documentation generation, provide an empty array (i.e., plugins: []).

Overriding the generated documentation#

The Documentation plugins comes with 3 methods to override the generated documentation: excludeFromGeneration, registerOverride, and mutateDocumentation.

excludeFromGeneration() {#excluding-from-generation}#

To exclude certain APIs or plugins from being generated, use the excludeFromGeneration found on the documentation plugin’s override service in your application or plugin's register lifecycle.

Info

excludeFromGeneration gives more fine-grained control over what is generated.

For example, pluginA might create several new APIs while pluginB may only want to generate documentation for some of those APIs. In that case, pluginB could still benefit from the generated documentation it does need by excluding only what it does not need.


ParameterTypeDescription
apiString or Array of StringsThe name of the API/plugin, or list of names, to exclude

module.exports = {
  register({ strapi }) {
    strapi
      .plugin("documentation")
      .service("override")
      .excludeFromGeneration("restaurant");
    // or several
    strapi
      .plugin("documentation")
      .service("override")
      .excludeFromGeneration(["address", "upload"]);
  }
}
registerOverride() {#register-override}#

If the Documentation plugin fails to generate what you expect, it is possible to replace what has been generated.

The Documentation plugin exposes an API that allows you to replace what was generated for the following OpenAPI root level keys: paths, tags, components .

To provide an override, use the registerOverride function found on the Documentation plugin’s override service in your application or plugin's register lifecycle.

ParameterTypeDescription
overrideObjectOpenAPI object including any of the following keys paths, tags, components. Accepts JavaScript, JSON, or yaml
optionsObjectAccepts pluginOrigin and excludeFromGeneration
options.pluginOriginStringThe plugin that is registering the override
options.excludeFromGenerationString or Array of StringThe name of the API/plugin, or list of names, to exclude

Plugin developers providing an override should always specify the pluginOrigin options key. Otherwise the override will run regardless of the user’s configuration.

The Documentation plugin will use the registered overrides to replace the value of common keys on the generated documentation with what the override provides. If no common keys are found, the plugin will add new keys to the generated documentation.

If the override completely replaces what the documentation generates, you can specify that generation is no longer necessary by providing the names of the APIs or plugins to exclude in the options key array excludeFromGeneration.

If the override should only be applied to a specific version, the override must include a value for info.version. Otherwise, the override will run on all documentation versions.


module.exports = {
  register({ strapi }) {
    if (strapi.plugin('documentation')) {
      const override = {
        // Only run this override for version 1.0.0
        info: { version: '1.0.0' },
        paths: {
          '/answer-to-everything': {
            get: {
              responses: { 200: { description: "*" }}
            }
          }
        }
      }

      strapi
        .plugin('documentation')
        .service('override')
        .registerOverride(override, {
          // Specify the origin in case the user does not want this plugin documented
          pluginOrigin: 'upload',
          // The override provides everything don't generate anything
          excludeFromGeneration: ['upload'],
        });
    }
  },
}

The overrides system is provided to try and simplify amending the generated documentation. It is the only way a plugin can add or modify the generated documentation.

mutateDocumentation() {#mutate-documentation}#

The Documentation plugin’s configuration also accepts a mutateDocumentation function on info['x-strapi-config']. This function receives a draft state of the generated documentation that be can be mutated. It should only be applied from an application and has the final say in the OpenAPI schema.

ParameterTypeDescription
generatedDocumentationDraftObjectThe generated documentation with applied overrides as a mutable object

module.exports = {
  documentation: {
    config: {
      "x-strapi-config": {
        mutateDocumentation: (generatedDocumentationDraft) => {
          generatedDocumentationDraft.paths[
            "/answer-to-everything" // must be an existing path
          ].get.responses["200"].description = "*";
        },
      },
    },
  },
};

Usage#

The Documentation plugin visualizes your API using . To access the UI, select in the main navigation of the admin panel. Then click Open documentation to open the Swagger UI. Using the Swagger UI you can view all of the endpoints available on your API and trigger API calls.

Tip

Once the plugin is installed, the plugin user interface can be accessed at the following URL:
<server-url>:<server-port>/documentation/<documentation-version>
(e.g., ).

Regenerating documentation {#regenerate-documentation}#

There are 2 ways to update the documentation after making changes to your API:

  • restart your application to regenerate the version of the documentation specified in the Documentation plugin's configuration,
  • or go to the Documentation plugin page and click the regenerate button for the documentation version you want to regenerate.

Authenticating requests#

Strapi is secured by default, which means that most of your endpoints require the user to be authorized. If the CRUD action has not been set to Public in the Users & Permissions feature then you must provide your JSON web token (JWT). To do this, while viewing the API Documentation, click the Authorize button and paste your JWT in the bearerAuth value field.

Documents
Admin Homepage Date Serialization
Admin Modal Management
Admin Panel Locale Management
admin-panel
setting-up-admin-panel
Admin User Management
Blocks Editor
Content Manager i18n Preview
locale
Content Manager Pagination
Content Manager Preview
breaking-changes
Content Manager Query Persistence
Content Manager RBAC
Content Manager URL & Filter State
admin-panel-api
content-manager
Content Type Builder
breaking-changes
content-type-builder
controllers
create-components-for-plugins
faq
models
populate-creator-fields
quick-start
store-and-access-data
Database Migration Concurrency and Idempotency
deployment
step-by-step
Date Field Serialization
Discard-Drafts Migration
Document ID Migration
breaking-changes
faq
step-by-step
Document Service Clone & Relation Handling
Document Service Populate Concurrency
Draft & Publish Relation Synchronization
do-not-update-repeatable-components-with-document-service-api
document-service
lifecycle-hooks-document-service
populate
publishedat-always-set-when-dandp-disabled
relations
status
DynamicZone Stability
breaking-changes
components-and-dynamic-zones-do-not-return-id
components-dynamic-zones
no-shared-population-strategy-components-dynamic-zones
EnumerationInput Component
GraphQL Abort Signal Propagation
GraphQL Context Propagation
document-service
draft-and-publish
graphql
i18n Locale Validation
breaking-changes
locale
locale
i18n Locale-Scoped Operations
breaking-changes
crud
database-columns
document
document-service
draft-and-publish
i18n-content-manager-locale
locale
locale
locale
no-locale-all
parameters
populate
relations
Koa Type Augmentation
Media Library Asset Replace
Media Library Permissions
Monorepo Module Resolution
Nested Relation Modal Navigation
Relation Field Validation
Relation Modal State Management
relations
Strapi Data Transfer
cli
deployment
Strapi Project Scaffolding
cli
create-a-plugin
deployment
How can I create my first Strapi project on a brand new MacBook with no prior coding experience, including all necessary terminal commands and setup steps?
quick-start
Strapi TypeScript Build Performance
Strapi v5 Plugin API
admin-panel-rbac-store-updated
admin-permissions-for-plugins
breaking-changes
controllers
faq
get-where-removed
helper-plugin
helper-plugin-deprecated
inject-content-manager-component
introduction
introduction-and-faq
model-config-path-uses-uid
pass-data-from-server-to-admin
plugins-migration
rbac
redux-content-manager-app-state
remove-webhook-populate-relations
strapi-imports
Users & Permissions OAuth Flow
Vite Build Configuration
admin-panel
introduction-and-faq
vite
webpack-aliases-removed
Content Manager Mobile and Tablet UI Improvements
FilesManager API Reference
Focal Point Picker in Strapi Media Library
Nested Route File Structure for Strapi Plugins
Plugin-Specific Handling in the Strapi JavaScript Client
Strapi SDK Initialization and Architecture Guide
access-cast-environment-variables
access-configuration-values
adding-support-to-existing-project
admin-panel-customization
advanced-policies
advanced-queries
amazon-s3
api
api-tokens
attributes-and-content-types-names-reserved
audit-logs
auth-zero
authentication
aws-cognito
backend-customization
bulk-operations
bundlers
cas
cli
client
cloudinary
community
configurations
configure-sso
content-api
content-history
content-manager-apis
core-service-methods-use-document-service
cron
custom-fields
customization
data-management
database
database-identifiers-shortened
database-migrations
database-transactions
default-index-removed
default-input-validation
design-system
developing-plugins
development
discord
discord
docker
documentation
documents-and-entries
edit-view-layout-and-list-view-layout-rewritten
email
email-custom-providers
email-nodemailer
entity-service
entity-service-deprecated
environment
error-handling
examples
extension
facebook
favicon
features
fetch
fields
filter
filtering
filters
filters
from-entity-service-to-document-service
functions
github
github
google
google
graphql
graphql-api-updated
guides
homepage
host-port-path
instagram
installation
installing-plugins-via-marketplace
interactive-query-builder
internationalization
intro
intro
is-supported-image-removed
keycloak
keycloak
koa-body-v6
license-only
linkedin
local-upload
locales-translations
logos
mailgun-provider-variables
media-library
media-library-providers
microsoft
middlewares
middlewares
middlewares
middlewares
mysql5-unsupported
new-provider-guide
new-response-format
no-find-page-in-document-service
no-upload-at-entry-creation
okta
only-better-sqlite3-for-sqlite
only-mysql2-package-for-mysql
openapi
order-pagination
order-pagination
patreon
plugin-sdk
plugin-structure
plugins
plugins-extension
policies
policies
populate
populate-select
populating
preview
project-structure
publication-state-removed
query-engine
rbac
react-router-dom-6
reddit
register-allowed-fields
releases
removed-support-for-some-env-options
requests-responses
rest
review-workflows
routes
routes
sentry
server
server-api
server-default-log-level
server-proxy
services
services-and-controllers
setup-deployment
single-operations
sort-by-id
sort-pagination
sort-pagination
sso
status
strapi-container
strapi-utils-refactored
strict-requirements-config-files
templates
templates
testing
theme-extension
twitch
twitter
typescript
typescript
understanding-populate
upgrade-to-apollov4
upgrade-tool
upgrades
upload
usage-information
use-document-id
users-and-permissions-providers
users-permissions
vk
webhooks
wysiwyg-editor
yarn-not-default