# Custom CSS Fully customize your documentation with custom CSS Custom CSS is available as an add-on to the [pro plan](https://mintlify.com/pricing). Add any number of CSS files to your repository and the defined class names will be applied and available across all of your MDX files. ## Adding style.css For example, you can add the following `style.css` file to customize the styling of the navbar and footer. ```css #navbar { background: "#fffff2"; padding: 1rem; } footer { margin-top: 2rem; } ``` ## Using Identifiers Mintlify has a set of common identifiers to help you tag important elements of the UI. Some, but not all are listed in the following: `#topbar-cta-button` `#navbar` `#sidebar` `#content-area` `#table-of-contents` Use inspect element to find references to elements you're looking to customize. References and the styling of common elements are subject to change as the platform evolves. Please use custom styling with caution. # Custom JS Add JavaScript functionality globally Custom JS is available as an add-on to the [pro plan](https://mintlify.com/pricing). Custom JS allows you to add custom executable code globally. It is the equivalent of adding a ` ``` To use the widget in React and Next.js apps, use the React component from the `@mintlify/widget-react` [package](https://www.npmjs.com/package/@mintlify/widget-react). Here is a basic example of how to use the component in your React application: ```jsx ``` ## Usage In the first script tag or the React component props, you can customize the appearance and other settings of the widget. `mintlifyWidgetSettings` accepts the following props: | Prop | Type | Description | | ------------ | ------------------------------------------------------------------- | ---------------------------------------------------------- | | `connection` | [MintlifyWidgetConnectionProps](#mintlifywidgetconnectionProps) | Information needed to connect to our API. Required. | | `display?` | [MintlifyWidgetDisplayProps](#mintlifywidgetdisplayProps) | Configurations for the widget appearance and interactions. | | `tracking?` | [MintlifyWidgetTrackingFunctions](#mintlifywidgettrackingfunctions) | Callback functions for tracking analytics. | ### MintlifyWidgetConnectionProps | Prop | Type | Description | | -------- | -------- | ----------------------------------------------------------- | | `apiKey` | `string` | Widget API key generated from Mintlify dashboard. Required. | | `url?` | `string` | Used for internal testing only | ### MintlifyWidgetDisplayProps | Prop | Type | Description | | ------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------- | | `trigger?` | [MintlifyWidgetDisplayTriggerProps](#mintlifywidgetdisplaytriggerprops) | Appearance of the trigger. | | `colors?` | [MintlifyWidgetDisplayColorsProps](#mintlifywidgetdisplaycolorsprops) | Colors used across the widget. | | `chat?` | [MintlifyWidgetDisplayChatProps](#mintlifywidgetdisplaychatprops) | Configs specific to AI chat. | | `isDarkMode?` | `boolean` | Controlled dark mode appearance. Defaults to OS preference. | #### MintlifyWidgetDisplayTriggerProps | Prop | Type | Description | | ------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- | | `type?` | `'button'`\|`'input'` | Type of the trigger to display. Defaults to `button`. | | `label?` | `string` | Label displayed in the trigger. Defaults to `Get help` for the button trigger and `Ask anything...` for the input trigger. | | `buttonIcon?` | `'chat'`\|`'sparkles'`\|`'mintlify'` | Icon used in the trigger. Only available for the `button` trigger. Defaults to `chat`. | | `iconOnly?` | `boolean` | Only show icon in the trigger or not. Defaults to `false`. | Here is an overview of what the trigger looks like with different configurations. | `type='input'` | | | -------------- | ---------------------------------------------------------------------------------------- | | | | | `type='button'` | `'chat'` | `'sparkles'` | `'mintlify'` | | ---------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | | `iconOnly=false` | | | | | `iconOnly=true` | | | | #### MintlifyWidgetDisplayColorsProps | Prop | Type | Description | | --------------- | -------- | -------------------------------------------------------- | | `primary?` | `string` | Primary color used in the widget. Defaults to `#0D9373`. | | `primaryLight?` | `string` | Primary color in dark mode. Defaults to `#55D799`. | #### MintlifyWidgetDisplayChatProps | Prop | Type | Description | | ------------------------ | ---------- | ------------------------------------------------------------------ | | `openCitationInSameTab?` | `boolean` | Open the citation url in the same tab or not. Defaults to `false`. | | `exampleQueries?` | `string[]` | Example queries to prompt the user to ask. Defaults to `[]`. | ### MintlifyWidgetTrackingFunctions | Prop | Type | Description | | --------------------- | ------------------------------------------ | -------------------------------------------------- | | `trackChatEnter` | `()=> void` | Triggered when the user opens the chat widget. | | `trackCitationClick` | `(title: string, url: string)=> void` | Triggered when the user clicks on a citation. | | `trackChatThumbsUp` | `(query: string, response: string)=> void` | Triggered when the user thumbs up on a response. | | `trackChatThumbsDown` | `(query: string, response: string)=> void` | Triggered when the user thumbs down on a response. | | `trackChatFollowup` | `(query: string)=> void` | Triggered when the user asks a question. | | `trackChatClose` | `(queriesCount: number)=> void` | Triggered when the user exits the chat widget. | # Authentication You can set authentication parameters to let users use their real API keys. ## Enabling Authentication You can add an authentication method to your mint.json to enable it on every page or you can set it on a per-page basis. The page's authentication method will override mint.json if both are set. ### Bearer Token ```json mint.json "api": { "auth": { "method": "bearer" } } ``` ```md Page Metadata --- title: "Your page title" authMethod: "bearer" --- ``` ### Basic Authentication ```json mint.json "api": { "auth": { "method": "basic" } } ``` ```md Page Metadata --- title: "Your page title" authMethod: "basic" --- ``` ### API Key ```json mint.json "api": { "auth": { "method": "key", "name": "x-api-key" } } ``` ```md Page Metadata --- title: "Your page title" authMethod: "key" --- ``` ### None The "none" authentication method is useful to disable authentication on a specific endpoint after setting a default in mint.json. ```md Page Metadata --- title: "Your page title" authMethod: "none" --- ``` # MDX Setup Generate docs pages for your API endpoints using MDX Mintlify allows you to define your API endpoints using a combination of `mint.json` configuration, MDX metadata fields, and the `` component. From the defined endpoints, we generate an API playground, request examples, and response examples. In your `mint.json` file, define your base URL and auth method: ```json { "api": { "baseUrl": "https://mintlify.com/api", // string array for multiple base URLs "auth": { "method": "bearer" // options: bearer, basic, key. } } } ``` If you would not like to show an API playground, you don't need to include auth types. Hide the playground with the following field: ```json { "api": { "playground": { "mode": "hide" } } } ``` Find a full list of API configurations [here](/settings/global#api-configurations). Each API endpoint page should have a corresponding MDX file. At the top of each file, define: ```md --- title: 'Create new user' api: 'POST https://api.mintlify.com/user' --- ``` You can specify path parameters by adding the parameter name to the path, wrapped with `{}`: ```bash https://api.example.com/v1/endpoint/{userId} ``` If you have `baseUrl` configured in [mint.json](/settings/global), you can use relative paths like `/v1/endpoint`. Add your endpoint pages to the sidebar by adding the paths to the `navigation` field in your `mint.json`. Learn more about structuring your docs [here](/settings/navigation). # Advanced Features Support for advanced OpenAPI features OpenAPI 3 has some advanced features for describing complex APIs. Here's how you can use them with Mintlify. ## `oneOf`, `anyOf`, `allOf` For complex datatypes, OpenAPI provides the `oneOf`, `anyOf`, and `allOf` keywords, allowing you to combine schemas in certain ways. You can read more about these keywords in the [Swagger documentation](https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/), but essentially: * `oneOf` functions like an "exclusive-or" operator * `anyOf` functions like an "or" operator * `allOf` functions like an "and" operator Mintlify treats the `oneOf` and `anyOf` keywords the same. We have found that, when people use `oneOf`, they often *mean* `anyOf` - and there is often no meaningful difference to the user. Mintlify currently does not support the `not` keyword. ### Combining schemas with `allOf` Mintlify performs some preprocessing on your OpenAPI document to display these complex combinations in a readable way. For example, when you combine two object schemas with `allOf`, Mintlify combines the properties of both into a single object. This becomes especially useful when leveraging [OpenAPI's reusable `components`](https://swagger.io/docs/specification/components/). ```yaml org_with_users: allOf: - $ref: '#/components/schemas/Org' - type: object properties: users: type: array description: An array containing all users in the organization ... components: schemas: Org: type: object properties: id: type: string description: The ID of the organization ``` The ID of the organization An array containing all users in the organization ### Providing options with `oneOf` and `anyOf` When you use `oneOf` or `anyOf`, Mintlify displays the options in a tabbed container. To give your options helpful names, make sure to give each subschema a `title` field. For example, here's how you might display two different types of delivery addresses: ```yaml delivery_address: oneOf: - title: StreetAddress type: object properties: address_line_1: type: string description: The street address of the recipient ... - title: POBox type: object properties: box_number: type: string description: The number of the PO Box ... ```
The street address of the residence The number of the PO Box
## `x-codeSamples` If your users interact with your API using an SDK rather than directly through a network request, you can add code samples to your OpenAPI document, and Mintlify will display them in your OpenAPI pages. You can define your code samples using the `x-codeSamples` extension. This property can be added within any request method, and has the following schema: The language of the code sample. The label for the sample. This is useful when providing multiple examples for a single endpoint. The source code of the sample. Here's an example of some code samples for a plant tracking app, which has both a Bash CLI tool and a JavaScript SDK. ```yaml paths: /plants: get: ... x-codeSamples: - lang: bash label: List all unwatered plants source: | planter list -u - lang: javascript label: List all unwatered plants source: | const planter = require('planter'); planter.list({ unwatered: true }); - lang: bash label: List all potted plants source: | planter list -p - lang: javascript label: List all potted plants source: | const planter = require('planter'); planter.list({ potted: true }); ``` # OpenAPI Setup Reference OpenAPI endpoints in your docs pages ## Add an OpenAPI specification file To describe your endpoints with OpenAPI, make sure you have a valid OpenAPI document in either JSON or YAML format that follows the [OpenAPI specification](https://swagger.io/specification/). Your document must follow OpenAPI specification 3.0+. ## Autogenerating the API playground You can either [autogenerate the API playground](/settings/navigation#tabs) or create MDX files for the individual OpenAPI endpoints. ### Auto-populate API pages You can add an `openapi` field to an object in the `tabs` or `anchors` array in the `mint.json`. This can either be with OpenAPI documents that are in the docs repo (json or yaml) or hosted at a link. **Example with Anchors:** ```json {5} { "anchors": [ { "name": "API Reference", "openapi": "/path/to/openapi.json", "url": "api-reference", "icon": "square-terminal" } ] } ``` ![](https://mintlify.s3-us-west-1.amazonaws.com/mintlify/images/anchors-autogeneration-anchors.png) **Example with Tabs:** ```json {6} { "tabs": [ { "name": "API Reference", "url": "api-reference", "openapi": "https://petstore3.swagger.io/api/v3/openapi.json" } ] } ``` ![](https://mintlify.s3-us-west-1.amazonaws.com/mintlify/images/autogeneration-with-tabs.png) ### Create MDX files for OpenAPI endpoints You can also create MDX files associated with each OpenAPI endpoint if you would like to add additional context to specific pages or have more granular control over the navigation. Here is [the code](https://github.com/elevenlabs/elevenlabs-docs/blob/e5e267c97b8d1e4c21db1dcdb8b005eb1dfed7da/api-reference/speech-to-speech.mdx?plain=1#L2) from [Elevenlabs](https://elevenlabs.io/docs/api-reference/speech-to-speech). ![](https://mintlify.s3-us-west-1.amazonaws.com/mintlify/images/elevenlabs-mdx-autogeneration-example.png) If you want to autogenerate MDX files for every endpoint in your OpenAPI document you can use our scraper. #### Autogenerate files Our Mintlify [scraper](https://www.npmjs.com/package/@mintlify/scraping) autogenerates MDX files for your OpenAPI endpoints. Use the relative path to the OpenAPI document in your codebase. If you're using a publicly-hosted OpenAPI document, you can supply the URL in place of a path. ```bash npx @mintlify/scraping@latest openapi-file ``` Add the `-o` flag to specify a folder to populate the files into. If a folder is not specified, the files will populate in the working directory. ```bash npx @mintlify/scraping@latest openapi-file -o api-reference ``` Learn more about our scraping package [here](https://www.npmjs.com/package/@mintlify/scraping). The scraper will output an array of [Navigation entries](/settings/global#structure) containing your OpenAPI MDX files. You can either append these entries to your existing Navigation, or reorder and add the files to your navigation manually. If your OpenAPI document is invalid, the files will not autogenerate. #### Manually specify files By using the OpenAPI reference, the name, description, parameters, responses, and the API playground will be automatically generated using the specifications. If you have multiple OpenAPI files, include the path to the OpenAPI file to map the MDX file to the appropriate OpenAPI file. This is not required if you have only one OpenAPI file - it will automatically detect your OpenAPI file. ```md Example --- title: "Get users" openapi: "/path/to/openapi-1.json GET /users" --- ``` ```md Format --- title: "title of the page" openapi: openapi-file-path method path --- ```
The method endpoint must match the endpoint specified in the OpenAPI specifications exactly. If the endpoint doesn't exist in the OpenAPI file, the page will be empty. ## Create MDX files for OpenAPI schemas Mintlify also allows you to create individual pages for any OpenAPI schema defined in an OpenAPI document's `components.schemas` field: ```md Example --- openapi-schema: OrderItem --- ``` ```md Format --- openapi-schema: "schema-key" --- ``` # Writing OpenAPI Use OpenAPI features to enhance your Mintlify docs ## Describing your API There are many great tools online for learning about and constructing OpenAPI documents. Here are our favorites: * [Swagger's OpenAPI Guide](https://swagger.io/docs/specification/about/) for familiarizing yourself with the OpenAPI syntax * [OpenAPI v3.1.0 Specification](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md) for all the details about the newest OpenAPI specification * [Swagger & OpenAPI Validator](https://apitools.dev/swagger-parser/online/) for debugging your OpenAPI document * [Swagger's Editor](https://editor.swagger.io/) for seeing examples in action Swagger's OpenAPI Guide is for OpenAPI v3.0, but nearly all of the information is applicable to v3.1. For more information on the differences between v3.0 and v3.1, check out [OpenAPI's blog post](https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0). ## Specifying the URL for your API In an OpenAPI document, different API endpoints are specified by their paths, like `/users/{id}`, or maybe simply `/`. To specify the base URL to which these paths should be appended, OpenAPI provides the `servers` field. This field is necessary to use some Mintlify features like the API Playground. Read how to configure the `servers` field in the [Swagger documentation](https://swagger.io/docs/specification/api-host-and-base-path/). The API Playground will use these server URLs to determine where to send requests. If multiple servers are specified, a dropdown will appear to allow toggling between servers. If no server is supplied, the API Playground will use simple mode, as there is no way to send a request. If different endpoints within your API exist at different URLs, you can [override the server field](https://swagger.io/docs/specification/api-host-and-base-path/#:~:text=%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%20%2D%20southeastasia-,Overriding%20Servers,-The%20global%20servers) for a given path or operation. ## Specifying authentication Nearly all APIs require some method of authentication. OpenAPI provides the `securitySchemes` field for defining the methods of authentication used throughout your API, with simple configuration for the most common authentication types - [Basic](https://swagger.io/docs/specification/authentication/basic-authentication/), [Bearer](https://swagger.io/docs/specification/authentication/bearer-authentication/), and [API Keys](https://swagger.io/docs/specification/authentication/api-keys/). To apply these authentication methods to your endpoints, OpenAPI uses the `security` field. The syntax for defining and applying authentication is a bit unintuitive, so definitely check out [Swagger's documentation and examples](https://swagger.io/docs/specification/authentication/) on the topic. The API descriptions and API Playground will add authentication fields based on the security configurations in your OpenAPI document. If different endpoints within your API require different methods of authentication, you can [override the security field](https://swagger.io/docs/specification/authentication/#:~:text=you%20can%20apply%20them%20to%20the%20whole%20API%20or%20individual%20operations%20by%20adding%20the%20security%20section%20on%20the%20root%20level%20or%20operation%20level%2C%20respectively.) for a given operation. # Interactive Playground GET /plants/{id} Enable users to interact with your API The API playground is an interactive environment to make requests and preview an API endpoint. Autogenerating API pages with OpenAPI will automatically generate API playground. Read more about using OpenAPI with Mintlify [here](/api-playground/openapi). # Troubleshooting Common issues with API References API pages are complicated. As a result, there are a lot of things that can go wrong. Here's a list of common issues we've seen customers run into: In this scenario, it's likely that either Mintlify cannot find your OpenAPI document, or your OpenAPI document is invalid. Running `mintlify dev` locally should reveal some of these issues. To verify your OpenAPI document will pass validation: 1. Visit [this validator](https://apitools.dev/swagger-parser/online/) 2. Switch to the "Validate text" tab 3. Paste in your OpenAPI document 4. Click "Validate it!" If the text box that appears below has a green border, your document has passed validation. This is the exact validation package Mintlify uses to validate OpenAPI documents, so if your document passes validation here, there's a great chance the problem is elsewhere. Additionally, Mintlify does not support OpenAPI 2.0. If your document uses this version of the specification, you could encounter this issue. You can convert your document at [editor.swagger.io](https://editor.swagger.io/) (under Edit > Convert to OpenAPI 3): This is usually caused by a misspelled `openapi` field in the page metadata. Make sure the HTTP method and path match the HTTP method and path in the OpenAPI document exactly. Here's an example of how things might go wrong: ```md get-user.mdx --- openapi: "GET /users/{id}/" --- ``` ```yaml openapi.yaml paths: "/users/{id}": get: ... ``` Notice that the path in the `openapi` field has a trailing slash, whereas the path in the OpenAPI document does not. Another common issue is a misspelled filename. If you are specifying a particular OpenAPI document in the `openapi` field, ensure the filename is correct. For example, if you have two OpenAPI documents `openapi/v1.json` and `openapi/v2.json`, your metadata might look like this: ```md api-reference/v1/users/get-user.mdx --- openapi: "v1 GET /users/{id}" --- ``` If you have a custom domain configured, this could be an issue with your reverse proxy. By default, requests made via the API Playground start with a `POST` request to the `/api/request` path on the docs site. If your reverse proxy is configured to only allow `GET` requests, then all of these requests will fail. To fix this, configure your reverse proxy to allow `POST` requests to the `/api/request` path. Alternatively, if your reverse proxy prevents you from accepting `POST` requests, you can configure Mintlify to send requests directly to your backend with the `api.playground.disableProxy` setting in the `mint.json`, as described [here](/settings/global#api-configurations). This will likely require you to configure CORS on your server, as these requests will now come directly from your users' browsers. # Product Updates New updates and improvements ## Web Editor Web Editor We've revamped our web editor so that you can now update docs with a fully WYSIWYG experience, while syncing with markdown. Check out our [docs on getting started with Web Editor](/web-editor). ## /llms.txt support llms.txt support All docs instances are now automatically hosted at /llms.txt and /llms-full.txt so that LLMs can easily ingest your documentation. For more information, read the [docs on the new llms.txt standard.](https://llmstxt.org) ## Localization You can now localize your docs which operates similarly to versioning. Add a `locale` to a version and fixed content in Mintlify like "Was this page helpful?" will also match the locale. ## Changelogs Launched a new [Update component](/content/components/update) to make it easier to display and report updates (like this one) to your users. Changelog ## Code Line Highlighting You can now highlight lines of code in your docs to emphasize and bring attention to important parts by adding a special comment after the language identifier. Use curly braces `{}` and specify line numbers or ranges separated by commas. ```javascript Line Highlighting Example {1,3-5} const greeting = "Hello, World!"; function sayHello() { console.log(greeting); } sayHello(); ``` ````md ```javascript Line Highlighting Example {1,3-5} const greeting = "Hello, World!"; function sayHello() { console.log(greeting); } sayHello(); ``` ```` ## Light mode code blocks Code blocks now have a light mode variant which can be enabled by adding the following to your `mint.json`: ```json "codeBlock": { "mode": "auto" } ``` ## Advanced Footer Advanced Footer You can now add more links to the standard footer. This upgrade provides more consistency between landing pages and docs, or greater customization if you want to spotlight specific pages like socials or status logs. ## Filter search based on the current user When user auth is enabled, search results are now filtered based on the current logged in user so that they only see the relevant content. ## Custom Prompts for AI Chat You can now customize the prompts for the AI chat. Please reach out to [support](mailto:sales@mintlify.com) if you'd like to customize the prompts. ## Dashboard Improvements * Added ability to change custom domain to be /docs directly through dashboard settings. * Consolidated the login and signup pages to decrease friction and confusion. * Implemented the discovery login flow so that users that are members of multiple organizations can now switch between them. * Added login with Google OAuth * Added ability to add new deployment through dashboard settings. ## Bug Fixes * Can now use leading slashes in navigation. * Can now edit CSS & JS files in the web editor. * Fixed `suggestEdit` not showing up even when enabled. * Fixed keyboard navigation for Search and Chat such that you can now use the up and down arrow keys to navigate the results. * Don't allow search engines to crawl user-auth protected pages. * Revalidate the cache when an org is deleted. * We now use the Scalar OpenAPI parser to parse OpenAPI definitions which improves the performance, fixes parsing issues, and surfaces better error messages. * Top-level descriptions are now supported in API reference pages autogenerated from OpenAPI definitions. * Add in-line-style support for icons * Fixed the pop-in of custom CSS in docs. * Properly show in-line code styling in conjunction with links. * Maintain scroll position when you click the back button in a browser. ## Custom Fonts Custom Fonts Personalize the font of your docs to your own font hosted on a CDN or by choosing from Google fonts to match your docs with your brand. ## Images in Card components Add an `img` property to a card to display an image on the top of the card. Learn more about it [here](/content/components/cards#image-card). ## Update Speed Performances Performance Improvements For large projects (\~3,000 files), the download step for docs updates is now \~440x faster - a 99.8% time reduction. Across the board, file downloads during updates are now \~5.5x faster - an 81.8% time reduction. ## SEO improvements SEO Improvements We've fixed both the mobile and desktop layout of our docs so that they are more SEO-friendly - including adding proper aria tags to navbar and toggle elements. ## Dashboard Improvements * App router migration in the dashboard. * Search analytics are now available in the dashboard. * Delete an org functionality has been added to the dashboard. * Shipped GitLab connection UI. * Fix incorrect analytics data. * Add-on's can now be directly purchased through the dashboard. ## Bug Fixes * Fixed a bug where the top bar would not stretch to the width of the screen when it's in custom mode and the sidebar layout is `sidenav`. * Fix relative positioning of the AI widget. ## More * **Troubleshooting for API pages**: API pages could be complicated so we listed common issues to help you sort them out quickly — [Read the docs](/api-playground/troubleshooting) ## OpenAPI Reference Pages * Endpoints defined by OpenAPI that are complex and recursive are now 98% smaller. * We now show [additionalProperties](https://swagger.io/docs/specification/data-models/dictionaries/) in OpenAPI pages. ## File Uploads in API Playground By default, API playground requests are proxied by Mintlify. Now you can use `disableProxy` to disable this behavior and support request types like file uploads. * [Learn more about API configurations](/settings/global#api-configurations) ## Mobile SEO improvements We've fixed the mobile layout of our docs so that they are more SEO-friendly - including adding proper aria tags to elements. ## Support Form We added a more detailed support form to the Mintlify dashboard. You can now submit a form to get in touch with us. ## Bug Fixes * Fixed a bug for the Segment integration functionality. * We now raise more granular error messages for GitHub permissions when interacting with the editor. * Fixed bugs where the navigation would not properly expand when a direct link was used. ## AI Widget AI Widget For `Pro` users, we introduced Mintlify Widget, an extension of your docs to answer your users' questions when and where they asked. You can add this AI-powered chatbot to any web page: your landing page, inside your product, or on your existing documentation pages. * [Read the blog announcement](https://mintlify.com/blog/widget) * [Learn how to install the Widget](/advanced/widget/chat#getting-started) ## Pro Plan We also updated our pricing plans for better customizability and scale. * [Read the blog announcement](https://mintlify.com/blog/pro-plan) ## API Playground Code Example Sync When you browse API docs, the selected code example now syncs across your pages. ## Insights Currently in beta, this feature summarizes common user questions and patterns into easy-to-digest reports with AI-powered suggestions on how to improve your product. # Code Blocks Display inline code and code blocks ## Basic ### Inline Code To denote a `word` or `phrase` as code, enclose it in backticks (\`). ``` To denote a `word` or `phrase` as code, enclose it in backticks (`). ``` ### Code Block Use [fenced code blocks](https://www.markdownguide.org/extended-syntax/#fenced-code-blocks) by enclosing code in three backticks and follow the leading ticks with the programming language of your snippet to get syntax highlighting. Optionally, you can also write the name of your code after the programming language. ```java HelloWorld.java class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } ``` ````md ```java HelloWorld.java class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } ``` ```` Visit the [Code Block page](/content/components/code) for more detailed docs. # Accordion Groups Group multiple accordions into a single display. Simply add `` around your existing `` components. You can put other components inside Accordions. ```java HelloWorld.java class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } ``` Check out the [Accordion](/content/components/accordions) docs for all the supported props. Check out the [Accordion](/content/components/accordions) docs for all the supported props. ````jsx Accordion Group Example You can put other components inside Accordions. ```java HelloWorld.java class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } ``` Check out the [Accordion](/content/components/accordions) docs for all the supported props. Check out the [Accordion](/content/components/accordions) docs for all the supported props. ```` `AccordionGroup` does not have any props. # Accordions A dropdown component for toggling content You can put any content in here. Check out [AccordionGroup](/content/components/accordion-groups) if you want to group multiple Accordions into a single display. ```jsx Accordion Example You can put any content in here. ``` ## Props Title in the Accordion preview. Detail below the title in the Accordion preview. Whether the Accordion is open by default. A [Font Awesome icon](https://fontawesome.com/icons) or SVG code One of "regular", "solid", "light", "thin", "sharp-solid", "duotone", or "brands" # Callout Boxes Use callouts to add eye-catching context to your content ### Note Callouts This adds a note in the content ```jsx This adds a note in the content ``` ### Warning Callouts This raises a warning to watch out for ```jsx This raises a warning to watch out for ``` ### Info Callouts This draws attention to important information ```jsx This draws attention to important information ``` ### Tip Callouts This suggests a helpful tip ```jsx This suggests a helpful tip ``` ### Check Callouts This brings us a checked status ```jsx This brings us a checked status ``` # Card Groups Show cards side by side in a grid format The `CardGroup` component lets you group multiple `Card` components together. It's most often used to put multiple cards on the same column. Neque porro quisquam est qui dolorem ipsum quia dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit Ut enim ad minim veniam, quis nostrud exercitation ullamco Excepteur sint occaecat cupidatat non proident ```jsx Card Group Example Neque porro quisquam est qui dolorem ipsum quia dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit Ut enim ad minim veniam, quis nostrud exercitation ullamco Excepteur sint occaecat cupidatat non proident ``` ## Props The number of columns per row # Cards Highlight main points or links with customizable icons This is how you use a card with an icon and a link. Clicking on this card brings you to the Card Group page. ```jsx Card Example This is how you use a card with an icon and a link. Clicking on this card brings you to the Card Group page. ``` ```jsx Image Card Example Here is an example of a card with an image ``` ### Horizontal Card Add a `horizontal` property to a card to make it horizontally displayed. Here is an example of a horizontal card ### Image Card Add an `img` property to a card to display an image on the top of the card. Here is an example of a card with an image ## Props The title of the card A [Font Awesome icon](https://fontawesome.com/icons) or SVG code in `icon={}` One of `regular`, `solid`, `light`, `thin`, `sharp-solid`, `duotone`, `brands` The color of the icon as a hex code The url that clicking on the card would navigate the user to Makes the card more compact and horizontal The url or local path to an image to display on the top of the card # Code Blocks Display code with optional syntax highlighting ````md Code Block Example ```javascript Code Block Example const hello = "world"; ``` ```` ## Basic Code Block Use [fenced code blocks](https://www.markdownguide.org/extended-syntax/#fenced-code-blocks) by enclosing code in three backticks. ``` helloWorld(); ``` ````md ``` helloWorld(); ``` ```` ## Syntax Highlighting Put the name of your programming language after the three backticks to get syntax highlighting. We use [Prism](https://prismjs.com/#supported-languages) for syntax highlighting. [Test Drive Prism](https://prismjs.com/test.html#language=markup) lists all the languages supported. ```java class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } ``` ````md ```java class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } ``` ```` ## Names You can add more text after the programming language to set the name of your code example. The text can be anything as long as its all in one line. ```javascript Code Block Example const hello = "world"; ``` ````md Code Block Example ```javascript Code Block Example const hello = "world"; ``` ```` ## Line Highlighting You can highlight specific lines in your code blocks by adding a special comment after the language identifier. Use curly braces `{}` and specify line numbers or ranges separated by commas. ```javascript Line Highlighting Example {1,3-5} const greeting = "Hello, World!"; function sayHello() { console.log(greeting); } sayHello(); ``` ````md ```javascript Line Highlighting Example {1,3-5} const greeting = "Hello, World!"; function sayHello() { console.log(greeting); } sayHello(); ``` ```` ## Code Groups Want to display multiple code examples in one code box? Check out the Code Group docs: Read the reference for the Code Group component # Code Groups The CodeGroup component lets you combine code blocks in a display separated by tabs You will need to make [Code Blocks](/content/components/code) then add the `` component around them. Every Code Block must have a filename because we use the names for the tab buttons. See below for an example of the end result. ```javascript helloWorld.js console.log("Hello World"); ``` ```python hello_world.py print('Hello World!') ``` ```java HelloWorld.java class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } ``` ````md Code Group Example ```javascript helloWorld.js console.log("Hello World"); ``` ```python hello_world.py print('Hello World!') ``` ```java HelloWorld.java class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } ``` ```` # Expandables Toggle to display nested properties. The full name of the user Whether the user is over 21 years old ```jsx Expandable Example The full name of the user Whether the user is over 21 years old ``` ## Props The name of the object you are showing. Used to generate the "Show NAME" and "Hide NAME" text. Set to true to show the component as open when the page loads. # Frames Use the Frame component to wrap images or other components in a container. Frames are very helpful if you want to center an image. ## Captions You can add additional context to an image using the optional `caption` prop. ## Props Optional caption text to show centered under your component. ```jsx Frame ``` ```jsx Frame with Captions ``` # Icons Use [Font Awesome](https://fontawesome.com/icons) icons anywhere in the doc ```jsx Icon Example ``` ## Inline Icons The icon will be placed inline when used in a paragraph. ```markdown Inline Icon Example The documentation you want, effortlessly ``` The documentation you want, effortlessly ## Props A [Font Awesome](https://fontawesome.com/icons) icon One of `regular`, `solid`, `light`, `thin`, `sharp-solid`, `duotone`, `brands` The color of the icon as a hex code (e.g., `#FF5733`) The size of the icon in pixels # Mermaid Diagrams Display diagrams using Mermaid ````md Mermaid Flowchart Example ```mermaid flowchart LR subgraph subgraph1 direction TB top1[top] --> bottom1[bottom] end subgraph subgraph2 direction TB top2[top] --> bottom2[bottom] end %% ^ These subgraphs are identical, except for the links to them: %% Link *to* subgraph1: subgraph1 direction is maintained outside --> subgraph1 %% Link *within* subgraph2: %% subgraph2 inherits the direction of the top-level graph (LR) outside ---> top2 ``` ```` [Mermaid](https://mermaid.js.org/) lets you create visual diagrams using text and code. ```mermaid flowchart LR subgraph subgraph1 direction TB top1[top] --> bottom1[bottom] end subgraph subgraph2 direction TB top2[top] --> bottom2[bottom] end %% ^ These subgraphs are identical, except for the links to them: %% Link *to* subgraph1: subgraph1 direction is maintained outside --> subgraph1 %% Link *within* subgraph2: %% subgraph2 inherits the direction of the top-level graph (LR) outside ---> top2 ``` You can create the following using Mermaid diagrams: * Flowchart * Sequence diagram * Class diagram * State diagram * Entity relationship diagram * User journey * and more For a complete list of diagrams supported by Mermaid, check out their [website](https://mermaid.js.org/). ## Syntax for Mermaid diagrams To create a flowchart, you can write the Mermaid flowchart inside a Mermaid code block. ````md ```mermaid // Your mermaid code block here ``` ```` # Parameter Fields Set path, query, and body parameters `ParamField` components help define the parameters for your APIs or SDKs. Adding a ParamField will automatically add an [API Playground](/api-playground/overview). An example of a parameter field ```jsx Path Example An example of a parameter field ``` ```jsx Query Example The filtering command used to sort through the users ``` ```jsx Body Example The age of the user. Cannot be less than 0 ``` ## Props Whether it is a query, path, body, or header parameter followed by the name Expected type of the parameter's value Indicate whether the parameter is required Indicate whether the parameter is deprecated Default value used by the server if the request does not provide a value Value that will be used to initialize the playground Placeholder text for the input in the playground Description of the parameter (markdown enabled) # Response Fields Display API response values The `` component is designed to define the return values of an API. Many docs also use `` on pages when you need to list the types of something. A response field example ```jsx ResponseField Example A response field example ``` ## Props The name of the response value. Expected type of the response value The default value. Show "required" beside the field name. # Steps Sequence content using the Steps component Steps are the best way to display a series of actions of events to your users. You can add as many steps as desired. These are instructions or content that only pertain to the first step. These are instructions or content that only pertain to the second step. These are instructions or content that only pertain to the third step. ```jsx Steps Example These are instructions or content that only pertain to the first step. These are instructions or content that only pertain to the second step. These are instructions or content that only pertain to the third step. ``` ## Steps Props A list of `Step` components. The size of the step titles. One of `p`, `h2` and `h3`. ## Individual Step Props The content of a step either as plain text, or components. A [Font Awesome icon](https://fontawesome.com/icons) or SVG code in `icon={}` One of `regular`, `solid`, `light`, `thin`, `sharp-solid`, `duotone`, `brands` The title is the primary text for the step and shows up next to the indicator. The number of the step. The size of the step titles. One of `p`, `h2` and `h3`. # Sidebar Code Examples Display code blocks at the top-right of the page on desktop devices The `` and `` stick code blocks to the top-right of a page even as you scroll. The components work on all pages even if you don't use an API playground. `` and `` show up like regular code blocks on mobile. ## Request Example The `` component works similar to [CodeGroup](/content/components/code-groups), but displays the request content on the right sidebar. Thus, you can put multiple code blocks inside ``. Please set a name on every code block you put inside RequestExample. ````md RequestExample Example ```bash Request curl --request POST \ --url https://dog-api.kinduff.com/api/facts ``` ```` ## Response Example The `` component is the same as `` but will show up underneath it. ````md ResponseExample Example ```json Response { "status": "success" } ``` ```` # Tabs Toggle content using the Tabs component You can add any number of tabs. ☝️ Welcome to the content that you can only see inside the first Tab. ✌️ Here's content that's only inside the second Tab. 💪 Here's content that's only inside the third Tab. ```jsx Tabs Example ☝️ Welcome to the content that you can only see inside the first Tab. ✌️ Here's content that's only inside the second Tab. 💪 Here's content that's only inside the third Tab. ``` ## Tab Props The title of the tab. Short titles are easier to navigate. # Tooltips Show a definition when you hover over text. Hover over me and see a tooltip in action ```jsx Tooltip Example Hover over me ``` # Update Keep track of changes and updates The `Update` component is used to keep track of changes and updates. ## Changelog You can add anything here, like a screenshot, a code snippet, or a list of changes. #### Features * Responsive design * Sticky section for each changelog ### How to use ```md This is how you use a changelog with a label and a description. This is how you use a changelog with a label and a description. ``` You can use multiple `Update` components to create changelogs. Each `label` creates an anchor and also shows up on the table of contents on the right. ## Props Label in the changelog, on the sticky left side. Description below the label in the Changelog preview. # Local Development Preview changes locally to update your docs **Prerequisite**: Please install Node.js (version 19 or higher) before proceeding. **Step 1**: Install Mintlify: ```bash npm npm i -g mintlify ``` ```bash yarn yarn global add mintlify ``` **Step 2**: Navigate to the docs directory (where the `mint.json` file is located) and execute the following command: ```bash mintlify dev ``` A local preview of your documentation will be available at `http://localhost:3000`. ### Custom Ports By default, Mintlify uses port 3000. You can customize the port Mintlify runs on by using the `--port` flag. To run Mintlify on port 3333, for instance, use this command: ```bash mintlify dev --port 3333 ``` If you attempt to run Mintlify on a port that's already in use, it will use the next available port: ```md Port 3000 is already in use. Trying 3001 instead. ``` ## Mintlify Versions Please note that each CLI release is associated with a specific version of Mintlify. If your local website doesn't align with the production version, please update the CLI: ```bash npm npm i -g mintlify@latest ``` ```bash yarn yarn global upgrade mintlify ``` ## Validating Links The CLI can assist with validating reference links made in your documentation. To identify any broken links, use the following command: ```bash mintlify broken-links ``` ## Deployment If the deployment is successful, you should see the following: ## Code Formatting We suggest using extensions on your IDE to recognize and format MDX. If you're a VSCode user, consider the [MDX VSCode extension](https://marketplace.visualstudio.com/items?itemName=unifiedjs.vscode-mdx) for syntax highlighting, and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) for code formatting. ## Troubleshooting This may be due to an outdated version of node. Try the following: 1. Remove the currently-installed version of mintlify: `npm remove -g mintlify` 2. Upgrade to Node v19 or higher. 3. Reinstall mintlify: `npm install -g mintlify` Solution: Go to the root of your device and delete the \~/.mintlify folder. Afterwards, run `mintlify dev` again. # Images, Videos, and Embeds Add image, video, and other HTML elements Mintlify supports files up to 5 MB. To use larger files, consider a storage service like Cloudinary and embed in your Mintlify documentation. ## Image ### Using Markdown The [markdown syntax](https://www.markdownguide.org/basic-syntax/#images) lets you add images using the following code ```md ![title](/path/image.jpg) ``` Note that the image file size must be less than 5MB. Otherwise, we recommend hosting on a service like [Cloudinary](https://cloudinary.com/) or [S3](https://aws.amazon.com/s3/). You can then use that URL and embed. ### Using Embeds To get more customizability with images, you can also use embeds to add images. ```html ``` ### Disable Image Zoom To disable the default zoom on click for images, add the noZoom property to image embeds. ```html ``` ### Linking Images To link an image, for example to create a button on your docs, encompass the image in a link with the `noZoom` property. Images in `a` tags will automatically have a pointer cursor. ```html ``` ### Dark Mode To use separate images for light and dark mode, use Tailwind CSS to hide and show images. ```html ``` ### Related For more information, we recommend the following sections: Read the reference for the Frame component ## Videos ``` For other videos, use: ```html ``` To autoplay the video, use: ```html ``` Since Mintlify needs to adhere to the JSX syntax, double word attributes will need to be written in camelCase: autoPlay, playsInline. ## iFrames Loads another HTML page within the document. ```html ``` Although not required, we recommend adding the `alt` and `title` attributes to images for better SEO and accessability. Learn more at [image SEO](https://yoast.com/image-seo-alt-tag-and-title-tag-optimization/). # Amplitude Add the following to your `mint.json` file to send analytics to Amplitude. ```json Analytics options in mint.json "analytics": { "amplitude": { "apiKey": "required" } } ``` ```json Example "analytics": { "amplitude": { "apiKey": "76bb138bf3fbf58186XXX00000" } } ``` # Clearbit Add the following to your `mint.json` file to send analytics to Clearbit. ```json Analytics options in mint.json "analytics": { "clearbit": { "publicApiKey": "required" } } ``` ```json Example "analytics": { "clearbit": { "publicApiKey": "pk_1a1882" } } ``` # Fathom Add the following to your `mint.json` file to send analytics to Fathom. You can get the `siteId` from your script settings. ```json Analytics options in mint.json "analytics": { "fathom": { "siteId": "required" } } ``` ```json Example "analytics": { "fathom": { "siteId": "YSVMSDAY" } } ``` # Google Analytics 4 You will need to generate a new GA4 property to use with Mintlify. The data collected will go into the same project as your other Google Analytics data. If you are using the old version of Google Analytics, Universal Analytics, you will still be able to generate a GA4 property. GA4 data is slightly different from UA data but still gets collected in the same project. ## How to Connect GA4 to Mintlify ### Create a Web Stream You will need to create a web stream to get the Measurement ID to put into Mintlify. Click the cog at the bottom left of the Google Analytics screen. Then click on Data Streams. ![](https://mintlify.s3-us-west-1.amazonaws.com/mintlify/images/ga4-web-streams.png) Create a Web Stream and put the URL of your Mintlify docs site as the stream URL. Your Measurement ID looks like `G-XXXXXXX` and will show up under Stream Details immediately after you create the Web Stream. ### Put Measurement ID in mint.json Add your Measurement ID to your `mint.json` file like so: ```json mint.json "analytics": { "ga4": { "measurementId": "G-XXXXXXX" } } ``` ### Wait Google Analytics takes two to three days to show your data. You can use the [Google Analytics Debugger](https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna?hl=en) to check analytics are enabled correctly. The extension will log to your browser's console every time GA4 makes a request. Preview links have analytics turned off. # Google Tag Manager Add your tag ID to `mint.json` file and we'll inject the Google Tag Manager script to all your pages. You are responsible for setting up cookie consent banners with Google Tag Manager if you need them. ```json Analytics options in mint.json "analytics": { "gtm": { "tagId": "required" } } ``` ```json Example "analytics": { "gtm": { "tagId": "GTM-MGBL4PW" } } ``` # Heap Add the following to your `mint.json` file to send analytics to Heap. ```json Analytics options in mint.json "analytics": { "heap": { "appId": "required" } } ``` ```json Example "analytics": { "heap": { "appId": "1234567890" } } ``` # HotJar Add the following to your `mint.json` file to send analytics to HotJar. ```json Analytics options in mint.json "analytics": { "hotjar": { "hjid": "required", "hjsv": "required" } } ``` # Koala Add the following to your `mint.json` file to send analytics to Koala. ```json Analytics options in mint.json "analytics": { "koala": { "publicApiKey": "required" } } ``` ```json Example "analytics": { "koala": { "publicApiKey": "pk_1a1882" } } ``` # LogRocket Add the following to your `mint.json` file to send analytics to LogRocket. ```json Analytics options in mint.json "analytics": { "logrocket": { "apiKey": "required" } } ``` # Mixpanel Add the following to your `mint.json` file to send analytics to Mixpanel. ```json Analytics options in mint.json "analytics": { "mixpanel": { "projectToken": "required" } } ``` # Analytics Integrations Integrate with an analytics platform to track viewer events } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> ## Enabling Analytics Set your analytics keys in `mint.json`. You can add an unlimited number of analytics integrations for free. The syntax for `mint.json` is below. You only need to include entries for the platforms you want to connect. ```json Analytics options in mint.json "analytics": { "amplitude": { "apiKey": "required" }, "clearbit": { "publicApiKey": "required" }, "fathom": { "siteId": "required" }, "ga4": { "measurementId": "required" }, "gtm": { "tagId": "required" }, "hotjar": { "hjid": "required", "hjsv": "required" }, "koala": { "publicApiKey": "required" }, "logrocket": { "appId": "required" }, "mixpanel": { "projectToken": "required" }, "pirsch": { "id": "required" }, "plausible": { "domain": "required" }, "posthog": { "apiKey": "required", "apiHost": "optional" }, } ``` ```json Google Analytics 4 Example "analytics": { "ga4": { "measurementId": "G-XXXXXXX" } } ``` # Pirsch Add the following to your `mint.json` file to send analytics to Pirsch. You can get your site ID from Settings > Developer > Identification Code. ```json Analytics options in mint.json "analytics": { "pirsch": { "id": "required" } } ``` ```json Example "analytics": { "pirsch": { "id": "8Kw7OKxBfswOjnKGZa7P9Day8JmVYwTp" } } ``` # Plausible Add your site's domain to `mint.json` to send analytics to Plausible. Do not include `http://` or `https://` with your domain. ```json Analytics options in mint.json "analytics": { "plausible": { "domain": "required" } } ``` ```json Example "analytics": { "plausible": { "domain": "docs.domain.com" } } ``` # PostHog Add the following to your `mint.json` file to send analytics to PostHog. You only need to include `apiHost` if you are self-hosting PostHog. We send events to `https://app.posthog.com` by default. ```json Analytics options in mint.json "analytics": { "posthog": { "apiKey": "required", "apiHost": "optional" } } ``` ```json Example "analytics": { "posthog": { "apiKey": "phc_TXdpocbYTeZVm5VJmMzHTMrCofBQu3e0kN7HGMNGTVW" } } ```
Enabling PostHog analytics will disable the analytics on the Mintlify dashboard. ## Session Recordings You need to add the URL for your docs website to Posthog's "Authorized domains for recordings" before you can receive session recordings. The option to add your URL is in Posthog's project settings. # Osano Add the following to your `mint.json` file to add the [Osano](https://www.osano.com/) cookie consent manager. ```json Integration options in mint.json "integrations": { "osano": "SOURCE" } ``` ```json Example "integrations": { "osano": "https://cmp.osano.com/2sUB2dqwqdkks/8dqwd-dwd86£-4a9b/osano.js" } ``` The `SOURCE` can be found as the `src` value in the code snippet generated by Osano. It always starts with `https://cmp.osano.com/`. ```html Code snippet from Osano