Strapi API documentation with OpenAPI and Swagger UI: when teams need it
The Strapi Documentation plugin generates an OpenAPI 3.0 Swagger file from your content types and routes, and serves it through Swagger UI so developers can read the contract without opening the code. Teams need this when the API has consumers outside the team that built it: front-end developers in another company, partner integrations, mobile teams, or internal groups who generate typed clients from a specification. A machine-readable contract also gives reviewers one place to check the API surface before a release, which matters most when editors or product owners ask which endpoints exist and which fields they expose. If your Strapi project only serves one front end maintained by the same developers who wrote the content types, the schema in the codebase may already be enough, and the plugin adds another artifact to keep current.
The plugin reads what Strapi already knows: the content types you have defined, the routes they register, and the settings in src/extensions/documentation/config/settings.json. The output is only as accurate as the routes it can see, so custom controllers and custom routes you have written by hand may need review in the generated file, and the team should confirm that each endpoint returns what the specification says. Before you publish the file anywhere, decide who needs to read it. Documentation that lists every content type, including internal ones, can reveal more about your data model than some teams intend, so restricting access to the documentation view is a decision to make early rather than after a partner has already received the link.
Ask your team a few direct questions before adopting it: how many consumers read the contract, whether any of them generate client code from it, who approves changes to the API surface, and whether anyone will regenerate the file after each model change. The plugin does not keep the documentation current by itself, so the regeneration step needs an owner, and the answers determine whether a plugin-generated contract is enough or whether the team needs a hand-maintained specification. Confirm the current plugin behavior and supported Strapi version in the Strapi Documentation plugin docs before you plan the rollout.
Documentation plugin settings and when each fits
This table compares the options in the Documentation plugin's settings file and the situations each one suits: a public developer portal, an internal-only API, or sharing with partners. Read each row as a decision about who should see the specification, then confirm the exact key names and behavior in the Strapi docs before editing the file. Access restriction is the setting that most often needs a deliberate decision.
| Setting | When it fits | What to confirm first |
|---|---|---|
| OpenAPI version (openapi 3.0.0) | Teams whose client generators, gateways and contract tests expect OpenAPI 3.0 | Confirm the version your tooling supports before changing the value |
| Info fields (title, description, version) | Public portal: describe audience and versioning. Internal API: keep brief and name the owning team. | Confirm exact key names; this text is visible to anyone who opens the docs |
| Server URLs | Public portal: list the production host. Staging or partner sandbox: list those hosts separately. | Confirm how multiple servers are declared; a wrong URL sends test calls to production |
| Access restriction, public | Public developer portal where any reader may view the full specification | Confirm the default visibility in your version and what the open page exposes |
| Access restriction, internal only | Internal API where only admin or internal roles should read routes and schemas | Confirm which roles can open the docs and test that anonymous requests are refused |
| Partner sharing | Partners need the contract without admin panel access | Confirm whether the exported Swagger file includes internal routes before sending it |
| Regeneration after model changes | Any environment where content types, routes or components change | Confirm whether the spec regenerates automatically or needs a manual step in each environment |
How to set up and regenerate the documentation
This sequence takes a Strapi 5 project from no API documentation to a generated OpenAPI 3.0 specification served through Swagger UI. It also shows how to confirm the output matches the live API and how to refresh it after schema or route changes.
Install the documentation plugin
A developer adds the Documentation plugin to the Strapi project with the package manager used by the repository, then rebuilds the admin panel and restarts the server. The plugin appears in the admin under Settings once the server starts. Confirm the install by checking that the package is listed in package.json and that the plugin's documentation pages load in the admin without errors.
Locate and review the settings file
Open the plugin's settings at src/extensions/documentation/config/settings.json in the project. This file controls the generated OpenAPI version, the API metadata and the access restrictions. Create it if it does not exist, following the plugin's documentation, and commit it to version control so every environment uses the same settings. Done means the file is tracked in the repository and the server still starts with it present.
Set the OpenAPI version and metadata
Set the openapi field to 3.0.0 so the generated file follows the OpenAPI 3.0 specification. Then add the title, version, description and server URLs that your API consumers need to see. Keep the metadata owned by the team that publishes the API, and review it with them before the first generation. Done means the settings file contains these values and they match what consumers should read in the spec.
Generate the specification
Run the generation from the Documentation plugin in the admin panel, or from the command the plugin documents for your version, and let it inspect the content types and routes in the project. Save the output file that the plugin produces and store it with the code. Done means a spec file exists, it parses as valid OpenAPI 3.0, and it lists the content-type endpoints you expect, including the custom routes your team added.
Open Swagger UI and check against real endpoints
Open the Swagger UI page served by the plugin, which is protected by the access settings you configured. Pick several operations, such as a list request and a single-entry request for one collection type, and run them against a development instance with a valid token. Done means each sampled operation returns a status and response shape that match what the spec describes. Any mismatch goes back to the content type or route definition before the spec is published.
Regenerate after model or route changes
After any content type, component, field or custom route change, a developer runs the generation again so the spec reflects the new schema. Schema changes are usually made in the Content-type Builder or in code, so review the diff of the spec file in the same pull request as the model change. Done means the regenerated spec is committed alongside the change and the reviewer has seen the diff.
Confirm removed operations disappear
Compare the new spec with the previous version and check that operations for deleted or renamed content types and routes are gone. Stale paths in the spec mislead integrators who call endpoints that no longer exist. Also check that Swagger UI no longer lists them after a restart. Done means the diff shows the expected removals and no unintended ones, and the Swagger UI listing matches the spec.
Verify spec output against a test request
Send a test request to an endpoint described in the spec, using the same method, path and parameters, and compare the status code, required fields and response properties with the documented schema. Repeat for one endpoint of each type you changed. Keep these checks in the team's test suite if possible, so future regenerations are verified the same way. Done means every compared request matches the documented response, and the results are recorded with the release notes.
Customizing the spec versus keeping defaults
When the only readers are your own developers and QA staff, the generated Swagger file is usually enough as a working reference. The Documentation plugin inspects content types and routes and produces an OpenAPI 3.0.0 document, so the main job is confirming that it describes what your team actually calls. Customization here is light: a clear server description, accurate titles and a note on which endpoints are for editors and which are for front-end consumers.
- Server and info fields: Set the API title, version and server URL so developers know which environment the file describes.
- Hidden or unused routes: Check for default routes that no client uses and decide whether to leave them visible.
- Authentication description: Make sure the token method is described in plain terms that match your Users and Permissions setup.
- Regeneration habit: Agree on when the file is rebuilt, typically after any content-type change that affects the API.
- Access to the viewer: Restrict the documentation page to internal networks or authenticated staff.
Before relying on this file internally, ask the API owner to confirm that the field names and response shapes match a live request in your environment.
When partners, integrators or the public will read the spec, the generated output becomes a product surface. Every path, schema and example is a commitment that outside teams will build against, so the effort shifts from generation to review. Expect to edit descriptions, remove internal-only fields and confirm that the spec matches the permissions that really apply to each consumer.
- Field and schema descriptions: Add plain-language descriptions for fields that editors understand but integrators will not.
- Internal and draft fields: Remove or hide fields that expose editorial state or internal relations.
- Public versus authenticated routes: Confirm that the documented security requirements match the Users and Permissions settings for each route.
- Examples and error responses: Replace placeholder values with realistic sample data and document the error shapes clients will receive.
- Versioning statement: State how breaking changes are announced, since the spec will be copied into other teams' tools.
The API owner should sign off on the final spec, check it against a staging instance and confirm which version is published, because outside consumers will not see your internal changelog.
Custom routes and controllers are where generated documentation most often goes wrong. The plugin reads content types and routes, but custom logic, extra parameters and non-standard response bodies may not be described the way your code behaves. Effort rises with the number of custom endpoints, the complexity of their inputs and how often controllers change, so the spec needs a review step tied to code changes, not a one-time check.
- Route coverage: Compare every custom route against the generated paths and add any that are missing or mislabeled.
- Request and response bodies: Confirm that the schemas match what your controller validates and returns, including optional fields.
- Policies and middleware: Document which policies gate each route, since access rules are not always obvious from the route file alone.
- Settings changes: Review the settings file in
src/extensions/documentation/config/settings.jsonafter any change that affects routes. - Regeneration checks: Add a step to your release process that regenerates the spec and diffs it against the previous version.
Before publication, the API owner should test each custom endpoint against the documented schema and confirm that no internal behavior is exposed through the spec.
How the spec moves from content types to Swagger UI
The flow starts with content types and routes in the Strapi project, which the Documentation plugin inspects. The plugin reads its settings file, src/extensions/documentation/config/settings.json, and produces a Swagger file that follows the OpenAPI specification with openapi set to 3.0.0. Swagger UI then serves that file to viewers who pass the access restriction, which is the trust boundary in the diagram. Regeneration is a loop: after a content type or route changes, the spec must be rebuilt, or the documentation will describe an API that no longer exists. Check the regenerated file against the live routes before you publish it.
Content model changes flow through the plugin into a restricted Swagger UI view.
Restricting who can view the API documentation
A generated OpenAPI file is a map of your API, so who can open it and how current it stays matter as much as how it was built. The cards below cover the access control the Documentation plugin describes, why the spec can expose more than you intend, and the ownership gaps that leave documentation stale or public.
Restrict access to the documentation
The Documentation plugin lets you restrict who can view the generated documentation, so it is not open to every visitor of the host by default. Confirm the exact restriction mechanism in the Strapi docs for your version, then test it from an unauthenticated browser and from a non-admin account. Check that the Swagger UI page and the raw spec file are both covered, since either one can expose the full route list.
Documentation plugin docsSpec reveals internal routes
An OpenAPI file lists every route the plugin scans, including custom routes and endpoints that editors never call from the front end. A reader can use that list to find admin-adjacent or unfinished endpoints and to plan attacks against them. Before publishing the spec anywhere, review the paths and remove or exclude anything that should not be advertised.
Spec reveals field structure
Schemas in the spec describe attribute names, types and relations, which tells outsiders how your content model is built and which fields exist beyond those your public responses return. Compare the documented schemas with what your public permissions actually expose. Any mismatch is a finding to resolve before the documentation is shared outside the team.
Documentation exposed on public hosts
Staging and preview environments often run the same plugin with the same defaults, and their hostnames may be indexed or shared in tickets. A documentation page left on a public host can reveal the schema of unreleased content types. Inventory every environment that serves the plugin, and confirm that non-production hosts are reachable only by approved users.
Stale docs after schema changes
The spec is generated from the current content types and routes, so a spec saved earlier describes an API that no longer exists. Consumers who build against an old file will hit errors, and reviewers may approve changes against the wrong contract. Regenerate the documentation as part of the same change that modifies a content type, and record the regeneration in the release checklist.
No clear owner for regeneration
Without a named owner, regeneration depends on whoever remembers to run it, and access reviews of the documentation rarely happen. Assign one role, such as the Strapi platform owner, to regenerate the spec, review its exposure and confirm access settings after each schema release. Write that responsibility into the change process so it survives staff changes.
Questions teams ask before generating Strapi API docs
Can our in-house team generate Strapi API docs without outside help?
Yes, a team that already runs Strapi can enable the Documentation plugin and generate an OpenAPI file on its own. The plugin inspects your content types and routes and produces a Swagger file that follows the OpenAPI specification, with openapi 3.0.0 set in its settings. The harder part is deciding what the documentation should say: which routes are public, how custom controllers are described, and who may view the result. Teams without an owner for the API often generate a file that is technically correct but misleading to consumers. If your team has a developer who knows the content model and the custom routes, the work is usually small enough to keep in-house. If nobody has that time, a partner can take the scoping and review work, and the decision should rest on that gap rather than on the plugin itself.
What makes the documentation effort larger or smaller?
Effort follows the shape of your API more than the plugin's setup steps. The main drivers are:
- The number of content types and components that appear in routes, since each one needs a clear schema and readable descriptions.
- Custom routes and controllers, which the plugin does not describe automatically in the same detail as generated routes, so each one needs manual review.
- Review cycles with the API owner and front-end teams, because wording, examples and required fields usually change after the first draft.
- Changes to the content model during the project, which mean regenerating and checking the file again.
A small API with standard routes is a short exercise. A large API with many custom endpoints and several consuming teams takes longer, mainly in review. Ask any quote to name how many content types, custom routes and review rounds it assumes.
What does the work need from our team?
The work needs three things from your side. First, a named API owner who can answer questions about each endpoint, approve the wording and decide which routes are external. Second, a staging Strapi instance that matches production's content model, so the generated file reflects what consumers will actually call and you do not expose draft or experimental schema. Third, access decisions: who may view the Swagger UI, whether it sits behind your identity provider or a separate restriction, and whether any internal endpoints should be left out of the published file. Confirm these three items before work starts, because they shape the settings file at src/extensions/documentation/config/settings.json and the access restriction that goes with it.
How long does Strapi API documentation take to generate?
Duration depends on scope, and no fixed figure applies to every project. The plugin generation step itself is quick once settings are in place. The time goes into scoping which routes to document, writing accurate descriptions, reviewing custom endpoints and fixing the access restriction. A project with a short list of standard routes and one reviewer can move quickly, while a project with many custom controllers, several consumers and multiple review rounds takes longer. Ask for a timeline tied to a written scope that lists the content types, custom routes and review steps, and ask what happens when the content model changes after sign-off. DeployOpen plans most engagements as fixed scope, with scope, deliverables and timelines agreed in writing before work starts.
Does regenerating the docs after model changes need a new project?
No, regeneration is a routine step, but it needs a process. When you add, rename or remove a content type or field, the generated OpenAPI file no longer matches the API until you regenerate it and check the result. Teams that skip this step publish outdated documentation and confuse consumers. Set a rule that every schema change in the Content-type Builder triggers a regeneration and a quick diff review. If you want this handled after launch, ask for an ongoing support arrangement. DeployOpen offers ongoing support, upgrades and continuous testing as retainers, and the scope of any retainer should be written down before you rely on it.
Who can view the generated documentation, and how is access restricted?
The Documentation plugin lets you restrict access to the generated documentation, so the decision about who may view it belongs to your security team and API owner together. Consider whether internal teams, partners or the public should see the Swagger UI, and whether the route should require authentication. Confirm the exact restriction method against the plugin documentation for your version and test it from an unauthenticated browser before you publish. Also check that the documentation does not reveal internal routes or sample data you would not show outside the team. Keep this in the scope so that access testing is part of the handover, not an afterthought.
Does DeployOpen issue an audit report or certification for our API documentation?
No. DeployOpen prepares systems, controls and evidence for compliance assessments, but it does not issue audit reports, attestations or certifications. Independent auditors and certification bodies perform those assessments. If your API documentation is part of an assessment, DeployOpen can help you set up access restrictions, document the settings and assemble the evidence your assessor will ask for. The assessor then decides whether that evidence meets the relevant requirements. Ask your auditor early which artifacts they expect to see, such as the settings file, the access configuration and the change record for regenerated documentation.
Which Strapi edition or plan do we need for the Documentation plugin?
The Documentation plugin is an extension in your project, so the choice depends on the plugin's current license terms and on your Strapi plan rather than on a documentation feature listed in the pricing pages. The Community Edition is under the MIT Expat license, and code under ee directories falls under the separate Strapi license. Confirm the plugin's license and compatibility with your Strapi version before you install it, and check the self-hosted pricing page for the features your plan includes. Your licensing review should be part of the scope so that the documentation work does not rest on an assumption about which edition you run.
How DeployOpen scopes and delivers API documentation
DeployOpen agrees the scope in writing before any work starts. For API documentation, that scope names the content types and custom routes to be documented, which routes are excluded from the generated file, where the documentation will be hosted and who may view it. It also records the handover: who receives the configured src/extensions/documentation/config/settings.json, who owns the spec file and who signs off the final output. Because the Documentation plugin reads your content types and routes, the written scope should list any custom controllers that expose endpoints outside the default Content API, since those are the places where documentation drifts first. Confirm with DeployOpen which Strapi version and Node.js version the instance runs before the scope is fixed, because both affect the plugin setup.
Delivery covers the configured Documentation plugin in your own environment, a reviewed OpenAPI 3.0.0 specification generated from your project, Swagger UI access restricted to the roles you choose, and a regeneration runbook. The runbook is the part most teams need after handover. It describes when to regenerate after a model or route change, who reviews the diff in the spec, how the change moves through your staging and production environments, and how to check that restricted access still holds after a deployment. Ask for the runbook to be tested by someone on your team who did not build it.
Optional retainer support covers upgrades of Strapi and the Documentation plugin, regeneration after schema changes that your editors or developers make over time, and periodic checks that the documentation still matches the running API. Retainers are priced from the written scope, and DeployOpen does not publish a price list. Ask for the quote to separate the one-time setup from any recurring support, and to state what happens when a model change is made without regeneration. DeployOpen configures and documents this work but does not issue certifications or attestations for it.

