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.

Source Repository
📓 acme/acme-openapi
Source Repository...
Stainless SDK Studio
Stainless SDK Studio
1. Auto-updates from your OpenAPI Spec
GitHub Action:
stainless-api/upload-openapi-spec-action
1. Auto-updates from your OpenAPI Spec...
Preview Repository
📓 stainless-sdks/acme-node
Preview Repository...
Public Repository
📓 acme/acme-node
Public Repository...
2. Connecting a public repository
Stainless Github App
2. Connecting a public repository...
Package registry
npm:acme
Package registry...
3. Push to package registries:
Release your package to NPM
3. Push to package registries:...

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:
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'
config_path: 'path/to/my-company.stainless.yaml'
project_name: 'my-stainless-project'

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.