From aa8c7dd9f99e00a2c5acc799d1ed2ac0971c587b Mon Sep 17 00:00:00 2001 From: "mintlify-development[bot]" <109878554+mintlify-development[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 04:44:57 +0000 Subject: [PATCH] Documentation edits made through Mintlify web editor --- advanced/user-auth/oauth.mdx | 54 +- advanced/user-auth/shared-session.mdx | 61 +- advanced/widget/chat.mdx | 92 +-- api-playground/mdx/configuration.mdx | 39 +- api-playground/openapi/setup.mdx | 145 ++--- api-playground/openapi/writing-openapi.mdx | 37 +- content/components/accordions.mdx | 2 +- content/components/mermaid-diagrams.mdx | 59 +- development.mdx | 91 +-- integrations/analytics/google-analytics.mdx | 42 +- integrations/analytics/google-tag-manager.mdx | 10 +- integrations/analytics/overview.mdx | 525 ++---------------- integrations/analytics/posthog.mdx | 22 +- integrations/privacy/osano.mdx | 18 +- integrations/sdks/speakeasy.mdx | 54 +- integrations/sdks/stainless.mdx | 26 +- migration.mdx | 137 +---- mint.json | 19 +- quickstart.mdx | 194 ++----- reusable-snippets.mdx | 116 +--- 20 files changed, 349 insertions(+), 1394 deletions(-) diff --git a/advanced/user-auth/oauth.mdx b/advanced/user-auth/oauth.mdx index 98251eb..7432f77 100644 --- a/advanced/user-auth/oauth.mdx +++ b/advanced/user-auth/oauth.mdx @@ -1,41 +1,37 @@ --- title: 'OAuth 2.0' -description: 'Integrate with your OAuth server to enable user login via the PKCE flow' +description: 'Enable user login via OAuth PKCE flow' --- -If you have an existing OAuth server that supports the PKCE flow, you can integrate with Mintlify for a seamless login experience. +Integrate your existing OAuth server with Mintlify to enable user authentication. -## Implementation +## Setup Steps - - Create an API endpoint that can be accessed with an OAuth access token, and responds with a JSON payload following the [UserInfo](./sending-data) format. Take note of the scope or scopes required to access this endpoint. + + Create an API endpoint that accepts an OAuth access token and returns user information in the [UserInfo](./sending-data) format. - - Go to your [Mintlify dashboard settings](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/user-authentication), select the OAuth option, and fill out the required fields: - - - **Authorization URL**: The base URL for the authorization request, to which we will add the appropriate query parameters. - - **Client ID**: An ID for the OAuth 2.0 client to be used. - - **Scopes**: An array of scopes that will be requested. - - **Token URL**: The base URL for the token exchange request. - - **Info API URL**: The endpoint that will be hit to retrieve user info. + + In your [Mintlify dashboard](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/user-authentication), select OAuth and configure: + - Authorization URL + - Client ID + - Required scopes + - Token URL + - Info API URL - - Copy the Redirect URL listed in the [Mintlify dashboard settings](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/user-authentication) and add it as an authorized redirect URL for your OAuth server. + + Add the Redirect URL from your Mintlify dashboard to your OAuth server's authorized redirects. -## Example - -I have an existing OAuth server that supports the PKCE flow. I want to set up authentication for my docs hosted at `foo.com/docs`. - -To set up authentication with Mintlify, I create an endpoint `api.foo.com/docs/user-info` which requires an OAuth access token with the `docs-user-info` scope, and responds with the user's custom data according to Mintlify’s specification. - -I then go to the Mintlify dashboard settings, navigate to the User Auth settings, select OAuth, and enter the relevant values for the OAuth flow and Info API endpoint: -- **Authorization URL**: `https://auth.foo.com/authorization` -- **Client ID**: `ydybo4SD8PR73vzWWd6S0ObH` -- **Scopes**: `['docs-user-info']` -- **Token URL**: `https://auth.foo.com/exchange` -- **Info API URL**: `https://api.foo.com/docs/user-info` - -Finally, I copy the Redirect URL displayed in the dashboard settings and add it as an authorized redirect URL in my OAuth client configuration settings. +## Example Configuration + +```json +{ + "authorizationUrl": "https://auth.foo.com/authorization", + "clientId": "ydybo4SD8PR73vzWWd6S0ObH", + "scopes": ["docs-user-info"], + "tokenUrl": "https://auth.foo.com/exchange", + "infoApiUrl": "https://api.foo.com/docs/user-info" +} +``` \ No newline at end of file diff --git a/advanced/user-auth/shared-session.mdx b/advanced/user-auth/shared-session.mdx index d2925a2..0e20caf 100644 --- a/advanced/user-auth/shared-session.mdx +++ b/advanced/user-auth/shared-session.mdx @@ -1,50 +1,39 @@ --- title: 'Shared Session Auth' -description: 'Seamlessly share user sessions between your dashboard and your docs' +description: 'Share user sessions between your dashboard and docs' --- -This method utilizes the session authentication info already stored in your user’s browser to create a seamless documentation experience. +Share your existing user sessions between your dashboard and documentation for a seamless experience. -## Implementation +## Setup - - Create an API endpoint that uses session authentication to identify users, and responds with a JSON payload following the [UserInfo](./sending-data) format. - - If the API domain does not *exactly match* the docs domain: - - Add the docs domain to your API's `Access-Control-Allow-Origin` header (must not be `*`) - - Ensure your API’s `Access-Control-Allow-Credentials` header is `true` - - These CORS options only need to be enabled on the *single endpoint* responsible for returning user information. We do not recommend enabling these options on all dashboard endpoints. - + + Create an API endpoint that: + - Uses your existing session authentication + - Returns user data in the [UserInfo](./sending-data) format + - Sets proper CORS headers if your API and docs domains differ: + - `Access-Control-Allow-Origin`: Set to your docs domain + - `Access-Control-Allow-Credentials`: Set to `true` - - Go to your [Mintlify dashboard settings](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/user-authentication) and add the API URL and your Login URL to your User Auth settings. + + Add your API URL and Login URL in your [Mintlify dashboard settings](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/user-authentication). -## Examples - -### Dashboard at subdomain, docs at subdomain - -I have a dashboard at `dash.foo.com`, which uses cookie-based session authentication. My dashboard API routes are hosted at `dash.foo.com/api`. I want to set up authentication for my docs hosted at `docs.foo.com`. - -To set up authentication with Mintlify, I create another dashboard endpoint `dash.foo.com/api/docs/user-info` which identifies the user using session auth, and responds with their custom data according to Mintlify’s specification. I then add `https://docs.foo.com` to the `Access-Control-Allow-Origin` allow-list **for this route only**, and ensure my `Access-Control-Allow-Credentials` configuration is set to `true` **for this route only**. - -I then go to the Mintlify dashboard settings and enter `https://dash.foo.com/api/docs/user-info` for the API URL field. - -### Dashboard at subdomain, docs at root - -I have a dashboard at `dash.foo.com`, which uses cookie-based session authentication. My dashboard API routes are hosted at `dash.foo.com/api`. I want to set up authentication for my docs hosted at `foo.com/docs`. - -To set up authentication with Mintlify, I create another dashboard endpoint `dash.foo.com/api/docs/user-info` which identifies the user using session auth, and responds with their custom data according to Mintlify’s specification. I then add `https://foo.com` to the `Access-Control-Allow-Origin` allow-list **for this route only**, and ensure my `Access-Control-Allow-Credentials` configuration is set to `true` **for this route only**. - -I then go to the Mintlify dashboard settings and enter `https://dash.foo.com/api/docs/user-info` for the API URL field. - -### Dashboard at root, docs at root +## Common Setups -I have a dashboard at `foo.com/dashboard`, which uses cookie-based session authentication. My dashboard API routes are hosted at `foo.com/api`. I want to set up authentication for my docs hosted at `foo.com/docs`. +1. **Docs and Dashboard on Subdomains** + - Dashboard: `dash.foo.com` + - Docs: `docs.foo.com` + - API Endpoint: `dash.foo.com/api/docs/user-info` -To set up authentication with Mintlify, I create another dashboard endpoint `foo.com/api/docs/user-info` which identifies the user using session auth, and responds with their custom data according to Mintlify’s specification. +2. **Dashboard on Subdomain, Docs on Root** + - Dashboard: `dash.foo.com` + - Docs: `foo.com/docs` + - API Endpoint: `dash.foo.com/api/docs/user-info` -I then go to the Mintlify dashboard settings and enter `https://foo.com/api/docs/user-info` for the API URL field. \ No newline at end of file +3. **Both on Root Domain** + - Dashboard: `foo.com/dashboard` + - Docs: `foo.com/docs` + - API Endpoint: `foo.com/api/docs/user-info` \ No newline at end of file diff --git a/advanced/widget/chat.mdx b/advanced/widget/chat.mdx index 216179a..5fb83c8 100644 --- a/advanced/widget/chat.mdx +++ b/advanced/widget/chat.mdx @@ -2,20 +2,16 @@ title: "Chat Widget" --- -Integrate the Mintlify widget into your products to offer users quick access to AI-powered chat with your docs content as the knowledge base. +Add an AI-powered chat widget to your product that lets users search your documentation. ![widget](https://mintlify-assets.b-cdn.net/widget/hero.webp) -## Getting started +## Quick Start -First, generate an API key in [the Mintlify dashboard](https://dashboard.mintlify.com/chat/widget-auth). - -![widget](https://mintlify-assets.b-cdn.net/widget/key.webp) - -## Installation - -Add the widget by adding these script tags into your site's `...` tag. +1. Get your API key from the [Mintlify dashboard](https://dashboard.mintlify.com/chat/widget-auth) +2. Add the widget to your site: +### HTML Installation ```html ``` -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: - +### React Installation ```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 +## Customization -| 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 `[]`. | +The widget can be customized using these main properties: -### MintlifyWidgetTrackingFunctions +| Property | Description | +|------------|-----------------------------------------------------| +| `connection` | Required. Contains your API key | +| `display` | Optional. Customize appearance and interactions | +| `tracking` | Optional. Add analytics tracking | -| 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. | +[View detailed configuration options →](https://mintlify.com/docs/widget/configuration) \ No newline at end of file diff --git a/api-playground/mdx/configuration.mdx b/api-playground/mdx/configuration.mdx index 55682df..7b950af 100644 --- a/api-playground/mdx/configuration.mdx +++ b/api-playground/mdx/configuration.mdx @@ -3,25 +3,24 @@ title: 'MDX Setup' description: '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. +Mintlify helps you create interactive API documentation using MDX. Here's how to get started: - - In your `mint.json` file, define your base URL and auth method: + + Add your API configuration to `mint.json`: ```json { "api": { - "baseUrl": "https://mintlify.com/api", // string array for multiple base URLs + "baseUrl": "https://mintlify.com/api", "auth": { - "method": "bearer" // options: bearer, basic, key. + "method": "bearer" } } } ``` - 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: - + To hide the API playground, use: ```json { "api": { @@ -31,35 +30,25 @@ Mintlify allows you to define your API endpoints using a combination of `mint.js } } ``` - - 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: + + Create MDX files for each endpoint with the required metadata: ```md --- title: 'Create new user' - api: 'POST https://api.mintlify.com/user' + api: 'POST /user' --- ``` - You can specify path parameters by adding the parameter name to the path, wrapped with `{}`: - + For paths with parameters, use `{paramName}` syntax: ```bash - https://api.example.com/v1/endpoint/{userId} + /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). + + Add your endpoint pages to the `navigation` field in `mint.json` to display them in your sidebar. - + \ No newline at end of file diff --git a/api-playground/openapi/setup.mdx b/api-playground/openapi/setup.mdx index 7d45da4..0cdc9ef 100644 --- a/api-playground/openapi/setup.mdx +++ b/api-playground/openapi/setup.mdx @@ -3,20 +3,19 @@ title: "OpenAPI Setup" description: "Reference OpenAPI endpoints in your docs pages" --- -## Add an OpenAPI specification file +## Add your OpenAPI specification -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+. +To get started, make sure you have a valid OpenAPI 3.0+ document in either JSON or YAML format that follows the [OpenAPI specification](https://swagger.io/specification/). -## Auto-populate API pages +## Set up API Documentation -The fastest way to get started with OpenAPI is to add an `openapi` field to a tab or anchor in the `mint.json`. This field can contain either the path to an OpenAPI document in your docs repo, or the URL of a hosted OpenAPI document. Mintlify will automatically generate a page for each OpenAPI operation and place them in the tab/anchor. +There are two main ways to document your API with OpenAPI: -**Example with Anchors:** +### 1. Auto-generate API Pages (Recommended) -```json {5} +The simplest way to get started is by adding an `openapi` field to your `mint.json`. This can be either a local path or URL to your OpenAPI document. + +```json { "anchors": [ { @@ -29,121 +28,39 @@ The fastest way to get started with OpenAPI is to add an `openapi` field to a ta } ``` -![](/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" - } - ] -} -``` - -![](/images/autogeneration-with-tabs.png) - -When using this option, the metadata for the generated pages will have the following default values: - -* `title`: The `summary` field from the OpenAPI operation, if present. Otherwise a title generated from the HTTP method and endpoint. - -* `description`: The `description` field from the OpenAPI operation, if present. - -* `version`: The `version` value from the anchor or tab, if present. - -There are some scenarios in which the default behavior isn't sufficient. If you need more customizability, you can create an MDX page for your OpenAPI operation, and modify it just like any other MDX page. +This will automatically generate pages for all your API endpoints with: +- Titles from the OpenAPI operation summaries +- Descriptions from the OpenAPI operation details +- Version information when specified -## Create MDX files for API pages +### 2. Custom MDX Pages -If you want to customize the page metadata, add additional content, omit certain OpenAPI operations, or reorder OpenAPI pages in your navigation, you'll need an MDX page for each operation. Here is [an example MDX OpenAPI page](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). - -![](/images/elevenlabs-mdx-autogeneration-example.png) - -### Autogenerate files - -For large OpenAPI documents, creating one MDX page for each OpenAPI operation can be a lot of work. To make it easier, we created a local OpenAPI page scraper. - -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. - -```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. +For more control over your API documentation, you can create individual MDX pages for each endpoint. You can either: +1. Auto-generate the MDX files using our scraper: ```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 - -You can always create an MDX page manually, and reference the OpenAPI operation in the page's metadata using the `openapi` field. - - - -By using the OpenAPI reference, the name, description, parameters, responses, -and the API playground will be automatically generated from the OpenAPI document. - -If you have multiple OpenAPI files, include the path to the OpenAPI file to ensure Mintlify finds the correct OpenAPI document. 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 - --- - ``` - - -
+2. Create pages manually by referencing OpenAPI operations: +```md +--- +title: "Get users" +openapi: "GET /users" +--- +``` - The method and path must match the method and path specified in the OpenAPI - document exactly. If the endpoint doesn't exist in the OpenAPI file, - the page will be empty. + If you have multiple OpenAPI files, include the full path in the openapi reference: + `openapi: "/path/to/openapi.json GET /users"` -## 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: +## OpenAPI Schemas - - ```md Example - --- - openapi-schema: OrderItem - --- - ``` +To create pages for your OpenAPI schemas, use the `openapi-schema` field in your MDX files: - ```md Format - --- - openapi-schema: "schema-key" - --- - ``` - \ No newline at end of file +```md +--- +openapi-schema: "SchemaName" +--- +``` \ No newline at end of file diff --git a/api-playground/openapi/writing-openapi.mdx b/api-playground/openapi/writing-openapi.mdx index 57cd936..c0ff45e 100644 --- a/api-playground/openapi/writing-openapi.mdx +++ b/api-playground/openapi/writing-openapi.mdx @@ -3,30 +3,37 @@ title: "Writing OpenAPI" description: "Use OpenAPI features to enhance your Mintlify docs" --- -## Describing your API +## Getting Started with OpenAPI -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 +To write OpenAPI documentation, you can use these helpful tools: +- [Swagger Editor](https://editor.swagger.io/) - Create and test your OpenAPI docs +- [Swagger & OpenAPI Validator](https://apitools.dev/swagger-parser/online/) - Check your OpenAPI document for errors - 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). + New to OpenAPI? Start with [Swagger's OpenAPI Guide](https://swagger.io/docs/specification/about/) to learn the basics. -## Specifying the URL for your API +## Setting Up Your API URL -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/). +To use the API Playground, you'll need to set up your API's base URL: -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. +1. Use the `servers` field to specify your API's base URL +2. This URL will be combined with endpoint paths like `/users` or `/products` +3. You can specify multiple servers, and users can switch between them in the API Playground -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. +## Adding Authentication -## Specifying authentication +Most APIs need authentication. Here's how to set it up: -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. +1. Use `securitySchemes` to define your authentication methods +2. Common types include: + - Basic Authentication + - Bearer tokens + - API Keys +3. Apply authentication using the `security` field -The API descriptions and API Playground will add authentication fields based on the security configurations in your OpenAPI document. +The API Playground will automatically add the proper authentication fields based on your configuration. -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. + + Different endpoints can use different URLs or authentication methods. You can override these settings for specific operations in your OpenAPI document. + \ No newline at end of file diff --git a/content/components/accordions.mdx b/content/components/accordions.mdx index a48159b..c7215cf 100644 --- a/content/components/accordions.mdx +++ b/content/components/accordions.mdx @@ -41,4 +41,4 @@ icon: "square-caret-down" One of "regular", "solid", "light", "thin", "sharp-solid", "duotone", or "brands" - + \ No newline at end of file diff --git a/content/components/mermaid-diagrams.mdx b/content/components/mermaid-diagrams.mdx index 1334bde..e18fec1 100644 --- a/content/components/mermaid-diagrams.mdx +++ b/content/components/mermaid-diagrams.mdx @@ -4,70 +4,41 @@ description: 'Display diagrams using Mermaid' icon: 'diagram-project' --- +[Mermaid](https://mermaid.js.org/) lets you create visual diagrams using text and code. + -````md Mermaid Flowchart Example +````md Mermaid 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. +You can create various types of diagrams including: -```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 +- Flowcharts +- Sequence diagrams +- Class diagrams +- State diagrams +- Entity relationship diagrams +- User journeys - and more -For a complete list of diagrams supported by Mermaid, check out their [website](https://mermaid.js.org/). +## Usage -## Syntax for Mermaid diagrams - -To create a flowchart, you can write the Mermaid flowchart inside a Mermaid code block. +To create a diagram, use the Mermaid code block syntax: ````md ```mermaid -// Your mermaid code block here +// Your mermaid code here ``` ```` + +For a complete list of diagrams and detailed syntax, visit the [Mermaid documentation](https://mermaid.js.org/). \ No newline at end of file diff --git a/development.mdx b/development.mdx index 1558101..a26232b 100644 --- a/development.mdx +++ b/development.mdx @@ -4,99 +4,46 @@ description: 'Preview changes locally to update your docs' --- - -**Prerequisite**: Please install Node.js (version 19 or higher) before proceeding. - +**Prerequisite**: Node.js (version 19 or higher) -**Step 1**: Install Mintlify: - - - - ```bash npm - npm i -g mintlify - ``` +## Quick Setup -```bash yarn -yarn global add mintlify +1. Install Mintlify: +```bash +npm i -g mintlify ``` - - -**Step 2**: Navigate to the docs directory (where the `mint.json` file is located) and execute the following command: - +2. Run the development server: ```bash mintlify dev ``` -A local preview of your documentation will be available at `http://localhost:3000`. +Your docs 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: +## Common Commands ```bash +# Start on a different port 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: - +# Update Mintlify CLI +npm i -g mintlify@latest - ```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 +# Check for broken links 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` + + 1. Remove mintlify: `npm remove -g mintlify` + 2. Upgrade to Node v19+ + 3. Reinstall: `npm install -g mintlify` - - - Solution: Go to the root of your device and delete the \~/.mintlify folder. Afterwards, run `mintlify dev` again. + + Delete the ~/.mintlify folder and run `mintlify dev` again. - + \ No newline at end of file diff --git a/integrations/analytics/google-analytics.mdx b/integrations/analytics/google-analytics.mdx index 7ebfe16..3d75038 100644 --- a/integrations/analytics/google-analytics.mdx +++ b/integrations/analytics/google-analytics.mdx @@ -2,28 +2,16 @@ title: "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. +Follow these steps to add Google Analytics 4 (GA4) tracking to your Mintlify documentation: -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. - -![](/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: +1. Create a GA4 property in your Google Analytics account +2. Set up a Web Stream: + - Go to Settings (cog icon) → Data Streams + - Click "Add Stream" → Web + - Enter your Mintlify docs URL + - Copy your Measurement ID (format: `G-XXXXXXX`) +3. Add the Measurement ID to your `mint.json`: ```json mint.json "analytics": { "ga4": { @@ -32,14 +20,10 @@ Add your Measurement ID to your `mint.json` file like so: } ``` -### 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. - +- Data takes 2-3 days to appear in Google Analytics +- Preview links don't track analytics +- Use [Google Analytics Debugger](https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna?hl=en) to verify tracking + + \ No newline at end of file diff --git a/integrations/analytics/google-tag-manager.mdx b/integrations/analytics/google-tag-manager.mdx index 0e715d0..8735d28 100644 --- a/integrations/analytics/google-tag-manager.mdx +++ b/integrations/analytics/google-tag-manager.mdx @@ -2,13 +2,16 @@ title: "Google Tag Manager" --- -Add your tag ID to `mint.json` file and we'll inject the Google Tag Manager script to all your pages. +To add Google Tag Manager to your documentation: -You are responsible for setting up cookie consent banners with Google Tag Manager if you need them. +1. Add your GTM configuration to the `mint.json` file +2. The script will automatically be injected into all your pages + +Note: You are responsible for implementing any required cookie consent banners. -```json Analytics options in mint.json +```json mint.json "analytics": { "gtm": { "tagId": "required" @@ -25,3 +28,4 @@ You are responsible for setting up cookie consent banners with Google Tag Manage ``` + \ No newline at end of file diff --git a/integrations/analytics/overview.mdx b/integrations/analytics/overview.mdx index dff95d3..05f0eea 100644 --- a/integrations/analytics/overview.mdx +++ b/integrations/analytics/overview.mdx @@ -12,512 +12,49 @@ description: "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. +## Setup -The syntax for `mint.json` is below. You only need to include entries for the platforms you want to connect. +Add your analytics credentials to `mint.json` using the following format: - - -```json Analytics options in mint.json -"analytics": { +```json +{ + "analytics": { "amplitude": { - "apiKey": "required" - }, - "clearbit": { - "publicApiKey": "required" - }, - "fathom": { - "siteId": "required" + "apiKey": "" }, "ga4": { - "measurementId": "required" - }, - "gtm": { - "tagId": "required" - }, - "hotjar": { - "hjid": "required", - "hjsv": "required" - }, - "koala": { - "publicApiKey": "required" - }, - "logrocket": { - "appId": "required" + "measurementId": "G-XXXXXXX" }, "mixpanel": { - "projectToken": "required" - }, - "pirsch": { - "id": "required" + "projectToken": "" }, "plausible": { - "domain": "required" - }, - "posthog": { - "apiKey": "required", - "apiHost": "optional" - }, -} -``` - -```json Google Analytics 4 Example -"analytics": { - "ga4": { - "measurementId": "G-XXXXXXX" + "domain": "" } + // Add other analytics platforms as needed + } } ``` - \ No newline at end of file +You can enable multiple analytics platforms simultaneously. Each platform will track page views and events independently. \ No newline at end of file diff --git a/integrations/analytics/posthog.mdx b/integrations/analytics/posthog.mdx index b78cabb..6540da7 100644 --- a/integrations/analytics/posthog.mdx +++ b/integrations/analytics/posthog.mdx @@ -2,37 +2,25 @@ title: "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. +Configure PostHog analytics by adding the following to your `mint.json`: -```json Analytics options in mint.json +```json mint.json "analytics": { "posthog": { "apiKey": "required", - "apiHost": "optional" - } -} -``` - -```json Example -"analytics": { - "posthog": { - "apiKey": "phc_TXdpocbYTeZVm5VJmMzHTMrCofBQu3e0kN7HGMNGTVW" + "apiHost": "optional" // Only needed for self-hosted PostHog } } ``` -
- - Enabling PostHog analytics will disable the analytics on the Mintlify dashboard. + Enabling PostHog analytics will disable Mintlify dashboard analytics. ## 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. +To enable session recordings, add your docs website URL to PostHog's "Authorized domains for recordings" in project settings. \ No newline at end of file diff --git a/integrations/privacy/osano.mdx b/integrations/privacy/osano.mdx index ded3d2d..bee5348 100644 --- a/integrations/privacy/osano.mdx +++ b/integrations/privacy/osano.mdx @@ -2,26 +2,16 @@ title: "Osano" --- -Add the following to your `mint.json` file to add the [Osano](https://www.osano.com/) cookie consent manager. +To integrate the [Osano](https://www.osano.com/) cookie consent manager, add your Osano source URL to `mint.json`: -```json Integration options in mint.json +```json mint.json "integrations": { - "osano": "SOURCE" -} -``` - -```json Example -"integrations": { - "osano": "https://cmp.osano.com/2sUB2dqwqdkks/8dqwd-dwd86£-4a9b/osano.js" + "osano": "https://cmp.osano.com/YOUR_SOURCE_URL/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 -