Prompt
What should I use for API docs with multiple environments?
Latest observation
Oct 16, 2026
OpenAI APIWeb search: off
If you have multiple environments like dev, staging, and prod, the best choice for API docs is usually one of these patterns:
Best option: OpenAPI + environment-specific servers
Use OpenAPI (Swagger) and define multiple servers entries, for example:
servers:
- url: https://api.dev.example.com
description: Development
- url: https://api.staging.example.com
description: Staging
- url: https://api.example.com
description: Production
This works well because:
- one source of truth
- easy to generate docs
- supports code generation and testing
- lets users switch environments in the docs UI
Good tools for this
- Swagger UI / Redoc / Scalar for rendering OpenAPI docs
- Stoplight if you want design + documentation + mocking
- Postman if your team also uses collections for testing
- MkDocs / Docusaurus if you want broader developer portal docs around the API
If you want environment switching in the UI
Choose a docs tool that supports selecting the server URL, such as:
- Swagger UI
- Redocly
- Scalar
Recommendation
For most teams:
- Use OpenAPI as the spec
- Document all environments in
servers - Render with Swagger UI, Redoc, or Scalar
If you want, I can also recommend the best stack based on your use case:
- public API docs,
- internal docs, or
- docs for a developer portal.