Authentication setup
Set up user authentication to control access to pages and API references using password, OAuth, JWT, or Mintlify-managed private access.
Authentication requires users to sign in before accessing your content.
You can configure full authentication for all pages or partial authentication where some pages are public and others require authentication.
Authentication is only available for sites hosted on a custom domain or Mintlify subdomain. For example, docs.example.com or example.mintlify.site. Authentication is not supported for sites with a custom subpath. For example, example.com/docs.
When you turn on authentication, you can delete existing preview deployments that would otherwise stay publicly accessible. See Existing previews when you turn on authentication.
To identify visitors while keeping pages public, use personalization. Personalization supports custom subpaths and can prefill API playground inputs without requiring visitors to authenticate before viewing a page.
Choose an authentication method
Use this comparison to pick the method that fits your use case. See Feature availability for how each method interacts with other Mintlify features.
Configure authentication
Password prerequisites
Password setup
Password example
You host your documentation at docs.foo.com and you need basic access control without tracking individual users. You want to prevent public access while keeping setup simple.
Create a strong password in your dashboard. Share credentials with authorized users.
Private authentication prerequisites
Private authentication setup
Private example
You host your documentation at docs.foo.com and your entire team has access to your dashboard. You want to restrict access to team members only.
Enable private authentication in your dashboard settings.
Verify team access by checking that all team members are active in your organization.
OAuth 2.0 prerequisites
OAuth 2.0 setup
Use groups from OAuth token claims
If your identity provider includes group membership in the ID token or access token, you can use those claims instead of an Info API URL. This option is available for OAuth configurations that use a client secret.
When configuring OAuth token claims for your project, use values such as:
For example, with "groups": "general,client" and groupsDelimiter set to ",", Mintlify uses general and client as separate groups.
Mintlify trims whitespace around each group and ignores empty segments. Without groupsDelimiter, the complete string is a single group. Array claims are always one group per string item and are not split.
OAuth 2.0 example
You host your documentation at docs.foo.com and you have an existing OAuth server at auth.foo.com that supports the Authorization Code Flow.
Configure your OAuth server details in your dashboard:
Create a user info endpoint at api.foo.com/docs/user-info, which requires an OAuth access token with the provider.users.docs scope, and returns:
Configure your OAuth server to allow redirects to your callback URL.
JWT prerequisites
JWT setup
When JWT authentication has one login URL, unauthenticated visitors redirect to it automatically. With two or more named login URLs, visitors first see a selection page and then continue to the selected login flow. Mintlify forwards the validated redirect parameter so the visitor returns to the documentation page they originally requested.
JWT example
You host your documentation at docs.foo.com with an existing authentication system at foo.com. You want to extend your login flow to grant access to the docs while keeping your docs separate from your dashboard (or you don’t have a dashboard).
Create a login endpoint at https://foo.com/docs-login that extends your existing authentication.
After verifying user credentials:
Redirect unauthenticated users
When an unauthenticated user tries to access a protected page, the redirect to your login URL preserves the user’s intended destination.
Make pages public
When using authentication, all pages require authentication to access by default. You can make specific pages viewable without authentication at the page or group level with the public property.
Individual pages
To make a page public, add public: true to the page’s frontmatter.
Groups of pages
To make all pages in a group public, add "public": true beneath the group’s name in the navigation object of your docs.json.
Control access with groups
When you use OAuth, JWT, or emails authentication, you can restrict specific pages to certain user groups. This is useful when you want different users to see different content based on their role or attributes.
Manage groups through user data passed during authentication. See User data format for details.
Specify which groups can access specific pages using the groups property in frontmatter.
Users must belong to at least one of the listed groups to access the page. If a user tries to access a page without the required group, they’ll receive a 404 error.
To show or hide part of a page by sign-in state or group, use the visibility component. Mintlify sends signed-in and groups content only to readers who match the rule.
How groups interact with public pages
User data format
When using OAuth or JWT authentication or standalone personalization, your system returns user data that controls session length, group membership, and content personalization.
Required for JWT authentication. The hostname of your documentation site. The string must exactly match the domain where you deploy your documentation. Mintlify validates that the JWT’s host matches the requesting host to prevent token reuse across different sites.
A stable, unique identifier for the user. Mintlify reports this value as user_id on analytics events for tool calls to your authenticated MCP server, so you can attribute usage to individual users. Use an opaque ID instead of personal information like an email address.
For OAuth, Mintlify reads sub from your user info API response, or from the token when you use groups from token claims. Most OpenID Connect providers include it by default. For JWT, add sub to the JWT payload.
The value must be a string. Sessions and MCP connections created before you add sub don’t include it. Users must sign in again and reconnect their MCP clients.
Session expiration time in seconds since epoch. When the current time passes this value, Mintlify expires the stored user data. The visitor must authenticate again or repeat the identification flow to refresh it.
List of groups the user belongs to. With authentication, pages with matching groups in their frontmatter are accessible to this user. With standalone personalization, groups control page and content visibility but do not restrict access to a page’s direct URL.
Example: A user with groups: ["admin", "engineering"] matches content tagged with either the admin or engineering groups.
Custom data accessible in MDX pages via the user variable for personalized content.
Prefills API playground fields with user-specific values. When a user authenticates, these values populate the corresponding input fields in the API playground. Users can override prefilled values, and their overrides persist in local storage.
Mintlify applies only values that match the current endpoint’s security scheme.
Header values to prefill, keyed by header name.
Query parameter values to prefill, keyed by parameter name.
Cookie values to prefill, keyed by cookie name.
Server variable values to prefill, keyed by variable name.
Path parameter values to prefill, keyed by parameter name.
Feature availability
Some features behave differently or are unavailable when you enable authentication.
Encryption at rest
When your site requires authentication, Mintlify encrypts content for your site at rest with a key unique to your site. Mintlify encrypts pages and snippets, editor drafts and history, comments, and database rows.
Some content isn’t encrypted, including page titles and navigation, API reference and OpenAPI specification files, PDF exports, and images and other media files.
Sites that use personalization without authentication are public, so Mintlify doesn’t encrypt their content.
Mintlify only encrypts preview deployments when they require authentication or a password.