Configure personalization
Enable personalization on the Add-ons page of your dashboard. Personalization is mutually exclusive with full authentication. JWT and OAuth authentication include personalization features.- Navigate to the Add-ons page of your dashboard.
- In the Personalization section, select shared session, JWT, or OAuth.
- Configure your selected personalization method.
- Click Save changes.
Shared session
Shared session reuses a visitor’s existing application session, so they don’t need to log in again on your Mintlify site.- Select Shared session in the Personalization settings.
- Enter an Info API URL that returns the current visitor’s user data.
- Optionally enter a Login URL. Mintlify displays a login link when the Info API does not return user data.
- Click Save changes.
GET request to the Info API from the visitor’s browser with credentials included. Return a successful JSON response for an identified visitor:
User data response
401. Mintlify leaves the visitor unidentified and keeps public content available.
If the Info API is on a different origin from your documentation, configure it to allow credentialed cross-origin requests from the exact documentation origin. Do not use a wildcard origin with credentials. Prevent browsers and intermediary caches from storing user data by returning Cache-Control: private, no-store.
JWT and OAuth
JWT and OAuth personalization use the same user data format as shared session but don’t restrict access to your documentation. Configure these methods in Add-ons, not Authentication. For JWT personalization:- Enter the URL of your existing login flow.
- Click Save changes.
- Click Generate new key and store the downloaded private key securely.
- In your login flow, create a JWT containing the identified visitor’s user data and sign it with the generated private key using the ES256 algorithm.
- Redirect the visitor to a page on your documentation site with the signed JWT as the URL fragment. For example,
https://docs.example.com/get-started#{SIGNED_JWT}. For a custom subpath, include the subpath in this URL.
exp claim to a short duration of 10 seconds or less. Use the user data expiresAt field to control how long Mintlify stores the personalization data.
For OAuth personalization:
- Enter your authorization URL, client ID, scopes, token URL, Info API URL, and any optional settings, then click Save changes. OAuth personalization uses the Authorization Code flow with Proof Key for Code Exchange (PKCE) and does not require a client secret.
- Copy the Redirect URL from the dashboard and add it as an authorized redirect URL for your OAuth provider.
- Configure the Info API to accept a
GETrequest with the OAuth access token in theAuthorization: Bearer <access_token>header and return user data.
/mintlify-oauth-callback. On a custom subpath, the dashboard includes the subpath in the redirect URL.
Mintlify exchanges the authorization code and requests user data from the visitor’s browser. If the token or Info API endpoint is on a different origin from your documentation, configure it to allow cross-origin requests from the exact documentation origin. The Info API must allow the Authorization request header.
API key prefilling
Automatically populate API playground fields with user-specific values by returning matching field names in your user data. Include the values in theapiPlaygroundInputs field of your user data.
Dynamic MDX content
Display content based on user information like name, plan, or organization with theuser variable in your MDX pages. Include custom data in the content field of your user data.
user variable in JSX components.
The
user variable is an empty object for logged-out users. Use optional chaining on all user fields to prevent errors. For example, {user.org?.plan} instead of {user.org.plan}.window.mintlify.user and listen for the mintlify:user event.
Page visibility
Control which pages appear in navigation based on user groups by addinggroups to page frontmatter.
OpenAPI content filtering
Filter API reference content based on user groups with thex-mint extension in your OpenAPI specification. You can filter entire endpoints, individual schema properties, oneOf variants, and enum values.
Filter endpoints
Addx-mint.groups to an operation or path to show the endpoint in navigation only to specific user groups. With standalone personalization, users not in the listed groups can still open the endpoint page by its direct URL.
Filter schema properties
Addx-mint.groups to individual properties within request bodies, parameters, or responses. Properties without x-mint.groups remain visible to all users.
Restricted property
name property. Only users in the admin group see the internal_id property.
Filter oneOf variants
Addx-mint.groups to individual oneOf options to restrict which schema variants a user can see.
Restricted oneOf variant
Filter enum values
Use thex-mint-enum extension to restrict individual enum values by group. List each restricted value as a key, with its allowed groups as the value. Enum values not listed in x-mint-enum are visible to all users.
Restricted enum values
free. Users in the pro or enterprise groups see pro. Only users in the enterprise group see enterprise.
x-mint-enum is a separate top-level extension on the schema object, not nested under x-mint.User data format
Your identification or authentication system returns user data that controls personalization. Thegroups, content, and apiPlaygroundInputs fields described on this page are all part of the user data object.
For the full user data format and field reference, see User data format.
Logout behavior
Logout occurs on the client side. When users click the logout button, Mintlify clears their stored session data in the browser. To limit how long personalization data persists, set theexpiresAt field in your user data.