Skip to main content

Automate OpenAPI updates

Stainless aims to make every part of shipping SDKs as painless as possible for developers. Here's how code flows from your repository to your end users.

Automating updates

There's two ways of giving us your new OpenAPI spec, through a GitHub action or by configuring polling from a persistent url.

From a repository containing your OpenAPI spec, configure our GitHub action to send us updates when your OpenAPI spec changes.

.github/workflows/stainless.yml
name: Upload OpenAPI spec to Stainless

on:
push:
branches: [main]
workflow_dispatch:

jobs:
stainless:
concurrency: upload-openapi-spec-action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: stainless-api/upload-openapi-spec-action@main
with:
stainless_api_key: ${{ secrets.STAINLESS_API_KEY }}
input_path: 'path/to/my-company-openapi.json'
project_name: 'my-stainless-project'

You can optionally add config_path: 'path/to/my-company.stainless.yaml' to the with: block if you'd like to send us updates to your Stainless config.

More detailed setup instructions are available in the Action's README.

Option 2: Poll from a persistent URL

For a simpler but less powerful approach, you can grab a persistent link (such as a raw GitHub link) and set up polling on our SDK Studio. To get to the configuration panel, you can navigate to Studio > OpenAPI > Automate > Fetch URL.

We will check for changes to this link every hour, and it can be manually triggered on the UI.