To integrate Stainless with Mintlify’s OpenAPI support, follow these steps:

  1. Add to your Stainless config:
openapi.stainless.yml
openapi:
  code_samples: mintlify
  1. Configure the OpenAPI setup in your docs.

  2. Set up a GitHub Action to push your Stainless-enhanced OpenAPI spec:

name: Upload OpenAPI spec to Stainless and Mintlify docs

on:
  push:
    branches: [main]
  workflow_dispatch:

jobs:
  stainless:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: stainless-api/upload-openapi-spec-action@main
        with:
          input_path: 'path/to/my-company-openapi.json'
          config_path: 'path/to/my-company.stainless.yaml'
          output_path: 'path/to/my-company-openapi.documented.json'
          project_name: 'my-stainless-project'
      - uses: dmnemec/copy_file_to_another_repo_action@main
        env:
          API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
        with:
          source_file: 'config/my-company-openapi.documented.json'
          destination_repo: '{DOCS_REPO_NAME}'
          destination_folder: 'openapi-specs'
          user_email: '{EMAIL}'
          user_name: '{USERNAME}'
          commit_message: 'Auto-updates from Stainless'

Required GitHub Secrets:

  • STAINLESS_API_KEY: Your Stainless API key
  • API_TOKEN_GITHUB: GitHub Personal Access Token with docs repo push access

Was this page helpful?