Skip to main content
Integrate SDK generators to automatically include code samples in your API playground. SDK integrations display language-specific code snippets for your API endpoints, making it easier for developers to get started.

Supported SDK generators

Mintlify integrates with leading SDK generation platforms:

Speakeasy

Automated SDK generation with code samples

Stainless

Type-safe SDK generation from OpenAPI specs

Speakeasy

Integrate autogenerated code snippets from Speakeasy SDKs directly into your API reference documentation. SDK usage snippets appear in the interactive playground of your Mintlify-powered documentation.

Prerequisites

Setup

1

Get the combined spec URL

Navigate to your Speakeasy Dashboard and open the API Registry tab.Find and open the entry ending with -with-code-samples for your API.
If you don’t see a “Combined Spec” entry, ensure your API has an automatic code sample URL configured.
Copy the public URL from the registry entry page.
2

Add to docs.json

Add the combined spec URL to your docs.json file in either an anchor or tab configuration.For anchors:
docs.json
{
  "anchors": [
    {
      "name": "API Reference",
      "openapi": "https://your-speakeasy-combined-spec-url",
      "url": "api-reference",
      "icon": "square-terminal"
    }
  ]
}
For tabs:
docs.json
{
  "tabs": [
    {
      "name": "API Reference",
      "url": "api-reference",
      "openapi": "https://your-speakeasy-combined-spec-url"
    }
  ]
}
3

View code samples

Your API playground now displays Speakeasy-generated code snippets for each endpoint.Users can interact with the code samples and copy them directly to their projects.

How it works

When you configure Speakeasy:
  1. Speakeasy generates SDKs from your OpenAPI specification
  2. Code samples are added to a combined OpenAPI spec
  3. Mintlify reads the combined spec and displays SDK code samples in the playground
  4. Samples automatically update when you regenerate your SDKs

Supported languages

Speakeasy can generate SDKs in multiple languages:
  • TypeScript/JavaScript
  • Python
  • Go
  • Java
  • C#
  • PHP
  • Ruby
  • Swift
The languages that appear in your playground depend on which SDKs you’ve configured in Speakeasy.

Stainless

Automate SDK code samples in your API playground using Stainless-generated SDKs. Stainless creates type-safe client libraries from your OpenAPI specification.

Prerequisites

  • A Stainless account
  • An OpenAPI specification for your API

Setup

1

Configure OpenAPI decoration

In your stainless.yml config file, add:
stainless.yml
openapi:
  code_samples: 'mintlify'
This tells Stainless to format code samples for Mintlify integration.See the Stainless documentation for more configuration options.
2

Publish your OpenAPI spec

In your Stainless project:
  1. Navigate to the Release tab
  2. Select Setup OpenAPI publishing
  3. Copy the URL to your publicly accessible OpenAPI spec
Stainless automatically decorates your OpenAPI spec with SDK code samples when you publish.
3

Add to docs.json

Add the Stainless OpenAPI spec URL to your docs.json file:
docs.json
{
  "anchors": [
    {
      "name": "API Reference",
      "openapi": "https://your-stainless-spec-url",
      "url": "api-reference"
    }
  ]
}
See OpenAPI Setup for more configuration options.

How it works

  1. Stainless reads your OpenAPI specification
  2. Generates type-safe SDKs in your target languages
  3. Adds code samples to your OpenAPI spec in Mintlify format
  4. Mintlify renders the code samples in your API playground

Supported languages

Stainless generates SDKs in:
  • TypeScript/JavaScript
  • Python
  • Go
  • Kotlin

Benefits of SDK integrations

Automatic updates

Code samples update automatically when you regenerate SDKs

Type safety

Generated SDKs are fully typed for better developer experience

Multiple languages

Support developers across different programming languages

Reduced maintenance

No manual code sample updates needed

Code sample display

When SDK integrations are configured, your API playground displays:
  • Language selector tabs for each generated SDK
  • Installation instructions for each SDK
  • Example code for each API endpoint
  • Request/response examples
  • Authentication setup code
Developers can:
  • Switch between programming languages
  • Copy code samples with one click
  • See real parameter values in examples
  • Test API calls directly in the playground

Comparison

FeatureSpeakeasyStainless
Setup complexityMediumLow
Language support8+ languages4 languages
Code sample formatCombined specDecorated spec
Auto-updates
Type safety
Custom templates

Best practices

  • Update your OpenAPI spec whenever your API changes
  • Regenerate SDKs after spec updates
  • Use CI/CD to automate spec publishing
  • Generate SDKs for languages your users actually use
  • Start with 2-3 popular languages
  • Add more languages based on user demand
  • Verify code samples work before publishing
  • Test authentication flows in samples
  • Ensure examples use realistic data
  • Maintain SDK versions alongside API versions
  • Document breaking changes in SDK releases
  • Provide migration guides for major versions

Troubleshooting

  • Verify the OpenAPI spec URL is publicly accessible
  • Check that the spec includes code sample extensions
  • Ensure your docs.json has the correct openapi field
  • Clear your browser cache and reload
  • Regenerate your SDKs in the provider dashboard
  • Republish your OpenAPI spec
  • Wait a few minutes for CDN cache to clear
  • Verify the languages are configured in your SDK generator
  • Check that code samples exist for those languages in the spec
  • Regenerate SDKs if languages were recently added

Next steps

OpenAPI Setup

Learn more about configuring OpenAPI specs

API Playground

Explore API playground features

Speakeasy Docs

Read Speakeasy documentation

Stainless Docs

Read Stainless documentation

Build docs developers (and LLMs) love