Set up OpenAPI
Add an OpenAPI specification to your docs from your repository or a URL, validate it, keep it in sync with your API, and control who can download it.
OpenAPI is a format for describing HTTP APIs. Add an OpenAPI specification to your docs, and Mintlify generates a page for every endpoint, with an interactive API playground and request examples. When your specification changes, the pages update.
Mintlify supports OpenAPI 3.0, 3.1, and 3.2 documents in JSON or YAML. To use a Swagger 2.0 document, convert it first, for example with Swagger Editor (Edit > Convert to OpenAPI 3).
Add your specification
To list only some endpoints, mix endpoints with other pages, or use more than one specification, see Organize endpoints in navigation.
Mintlify supports $ref for internal references only, within a single OpenAPI document. Bundle multi-file specifications into one file before you add them.
Validate your specification
Run mint validate to check your specifications, pages, and navigation before you deploy.
To learn the OpenAPI format, see Swagger’s OpenAPI guide and the OpenAPI specification. Swagger’s guide covers OpenAPI 3.0, but most of it applies to 3.1 and 3.2. For the differences, see Migrating from OpenAPI 3.0 to 3.1.0 and Upgrading from OpenAPI 3.1 to 3.2.
Use a specification from a local server
During local development, you can reference a specification served by an API running on your machine:
Pass --local-schema to let the CLI fetch the specification over HTTP:
To validate the same configuration, run mint validate --local-schema. Deployments require specification URLs to use HTTPS.
Keep a hosted specification in sync
If your openapi field points to a URL, your docs rebuild only when you push to your docs repository. Changes to the specification at the URL don’t trigger a rebuild.
To update your docs when your specification changes, call the Trigger deployment endpoint from the CI job that publishes your specification. Call it after the new specification is live, so the build doesn’t fetch a partial file.
Builds fetch the URL from the public internet without credentials. If your specification is behind authentication or a private network, commit it to your docs repository instead. See Fix “Failed to load OpenAPI file” error.
To change a specification you don’t own, such as one another team publishes, use overlays.
Control access to your specification
If your site doesn’t require authentication, Mintlify serves every JSON and YAML file in your docs repository at its path on your docs domain, such as https://docs.example.com/openapi.json. This includes specifications that docs.json doesn’t reference. Remove specification files you don’t want public from your repository.
x-hidden and x-excluded keep endpoints out of your docs, but the specification file still contains them.
Let visitors download your spec
To add a Download API spec option to the page context menu, add "download-spec" to contextual.options in your docs.json:
The option downloads your OpenAPI specification. If your project has more than one specification, the download is a zip file named api-specs.zip. On sites with authentication, only signed-in readers can download the specification.
Enabling download-spec also publishes an RFC 9727 API catalog at /.well-known/api-catalog. The catalog links to each OpenAPI specification in your docs.json, so AI agents can find your API without crawling your docs. Without download-spec, /.well-known/api-catalog returns a 404.