Authentication setup
Set up user authentication to control access to pages and API references using password, OAuth, JWT, or Mintlify-managed private access.
Private authentication for your Mintlify organization is available on all plans.
Password authentication requires a Pro or Enterprise plan.
OAuth and JWT authentication require an Enterprise plan.
Authentication requires users to log 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.
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.
| Method | Best for | Plan | Group-based access | API playground pre-fill | Personalization |
|---|---|---|---|---|---|
| Password | Simple shared access with no per-user tracking | Pro or Enterprise | No | No | No |
| Private authentication | Internal site for members of your Mintlify organization | All plans | No | No | No |
| OAuth 2.0 | Existing identity provider or SSO with per-user sessions | Enterprise | Yes | Yes | Yes |
| JWT | Custom auth backend or embedded content behind your own login | Enterprise | Yes | Yes | Yes |
Configure authentication
Password authentication provides access control only and does not support user-specific features like group-based access control or API playground pre-filling.
Password prerequisites
- Your security requirements allow sharing passwords among users.
Password setup
Create a password.
- In your dashboard, go to Authentication.
- In the Authentication method section, set site visibility to Private.
- Click Password.
- Enter a secure password.
- Click Save changes.
After you save, your site redeploys. When it finishes deploying, anyone who visits your site must enter the password to access your content.
Distribute access.
Securely share the password and documentation URL with authorized users.
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.
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.
---
title: "Public page"
public: true
---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.
{
"navigation": {
"groups": [
{
"group": "Public group",
"public": true,
"icon": "play",
"pages": [
"quickstart",
"installation",
"settings"
]
},
{
"group": "Private group",
"icon": "pause",
"pages": [
"private-information",
"secret-settings"
]
}
]
}
}Control access with groups
When you use OAuth or JWT 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.
{
"groups": ["admin", "beta-users"],
"expiresAt": 1735689600
}Specify which groups can access specific pages using the groups property in frontmatter.
---
title: "Admin dashboard"
groups: ["admin"]
---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.
How groups interact with public pages
- All pages require authentication by default.
- Pages with a
groupsproperty are only accessible to authenticated users in those groups. - Pages without a
groupsproperty are accessible to all authenticated users. - Pages with
public: trueand nogroupsproperty are accessible to everyone.
---
title: "Public guide"
public: true
---User data format
When using OAuth or JWT authentication, your system returns user data that controls session length, group membership, and content personalization.
type User = {
host?: string;
expiresAt?: number;
groups?: string[];
content?: Record<string, any>;
apiPlaygroundInputs?: {
server?: Record<string, string>;
header?: Record<string, unknown>;
query?: Record<string, unknown>;
cookie?: Record<string, unknown>;
path?: Record<string, unknown>;
};
};hoststringRequired 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.
expiresAtnumberSession expiration time in seconds since epoch. When the current time passes this value, the user must re-authenticate.
exp claim, which determines when a JWT is considered invalid. Set the JWT exp claim to a short duration (10 seconds or less) for security. Use expiresAt for the actual session length (hours to weeks).groupsstring[]List of groups the user belongs to. Pages with matching groups in their frontmatter are accessible to this user.
Example: A user with groups: ["admin", "engineering"] can access pages tagged with either the admin or engineering groups.
contentRecord<string, any>Custom data accessible in MDX pages via the user variable for personalized content.
apiPlaygroundInputsobjectPre-fills 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 pre-filled values, and their overrides persist in local storage.
Mintlify applies only values that match the current endpoint’s security scheme.
Show Hide properties
headerRecord<string, unknown>Header values to pre-fill, keyed by header name.
queryRecord<string, unknown>Query parameter values to pre-fill, keyed by parameter name.
cookieRecord<string, unknown>Cookie values to pre-fill, keyed by cookie name.
serverRecord<string, string>Server variable values to pre-fill, keyed by variable name.
pathRecord<string, unknown>Path parameter values to pre-fill, keyed by parameter name.
Feature availability
Some features behave differently or are unavailable when you enable authentication.
| Feature | Public | Fully authenticated (all pages protected) | Partially authenticated (some public pages) |
|---|---|---|---|
| llms.txt and llms-full.txt | Full support | Available behind authentication, so AI tools may not be able to access the files | Publicly accessible, reflecting public pages only |
| MCP server | Full support | Requires authentication to connect | Available without authentication for public pages and with authentication for protected pages |
| Markdown export | Full support | Full support, respects user groups | Full support, respects user groups |
| PDF export | Full support | Full support, respects user groups. Authenticated pages export with images and assets included. | Full support, respects user groups. Authenticated pages export with images and assets included. |
| Search | Full support | Full support, respects user groups | Full support, respects user groups |
| Assistant | Full support | Full support, respects user groups | Full support, respects user groups |
| skill.md | Full support | Not supported | Not supported |
| Sitemap | Full support | Available behind authentication, but excludes pages in groups | Available behind authentication, but excludes pages in groups |
| robots.txt | Full support | Available behind authentication | Available behind authentication |