Skip to main content

Mintlify

Mintlify is a documentation platform that allows you to create beautiful AI-native documentation sites with minimal effort.

With the Stainless <> Mintlify integration, you can:

  1. Generate robust and polished SDKs directly from your OpenAPI spec.
  2. Inject code samples into API docs, providing developers with language-specific implementation examples.
  3. Keep docs and SDKs automatically in sync as your API evolves.

JavaScript code example rendered by Mintlify API docs

This integration bridges the gap between documentation and implementation, giving developers copy-paste-ready examples that demonstrate your API in action.

Prerequisites

Before starting, make sure you have:

  • An account on Stainless
  • An existing Mintlify documentation project
  • Your OpenAPI specification

1. Create Your SDKs in the Studio

  1. Log in to the Stainless dashboard
  2. Click "New Project" and upload your OpenAPI specification
  3. Stainless will analyze your API and create an initial SDK configuration

The SDK Studio provides an immediate preview of your SDK structure based on your API's resources, methods, and models.

Stainless SDK Studio showing SDK preview

When first created, Stainless organizes your API into logical resources, but the exact names and hierarchy is up to you, allowing you to create the most intuitive experience for your users.

The Studio lets you customize everything from resource naming to authentication schemes - dive into the configuration guide to learn how to prepare SDKs developers will love.

2. Generate Code Examples

In the Studio, add the following to your Stainless configuration file:

openapi:
code_samples: 'mintlify'

This tells Stainless to create a copy of your OpenAPI file extended with SDK code examples, in a format Mintlify can render. For advanced integration options and support for other documentation platforms, explore the documentation integration guide.

3. Publish the URL to your OpenAPI spec

Go to your Stainless project page, select the "Release" tab, and select "Setup OpenAPI publishing."

Publishing your documented OpenAPI spec

Turn the OpenAPI publishing toggle on. This will create a stable publicly accessible URL for your OpenAPI spec which can be used by Mintlify. This OpenAPI spec is enriched with Stainless SDK code samples in the x-code-samples field.

The URL is stable and will always stay up-to-date with the latest information about your SDKs.

Finally, click the "copy" button next to the URL.

4. Provide your OpenAPI URL to Mintlify

Now that you have a URL pointing to your documented OpenAPI, the last step is to add it to your Mintlify project's docs.json file in the openapi field. See Mintlify's documentation for more information about their OpenAPI integration.

Your docs.json file will contain something like:

{
"navigation": {
"tabs": [
{
"tab": "API Reference",
"openapi": "https://app.stainless.com/api/spec/documented/<project>/openapi.documented.yml"
}
]
}
}

By combining Stainless's SDK generation with Mintlify's documentation capabilities, you're providing developers with a seamless experience from discovery to implementation.