Server URL templating lets you define base URLs with variable placeholders (e.g., {region}, {environment}) that SDK users can customize at runtime. This is useful for APIs deployed across multiple regions, environments, or custom domains.
Fern generates an environments module that exposes the default URLs for each named server. SDK users can select a pre-defined environment or pass custom URL strings.
The generated SDK exposes an Environment class:
SDK users can override the base URL when constructing the client:
Define URL template variables in your API definition and provide a static fallback URL for SDK users who don’t customize variables:
For full configuration details, see Server names and URL templating in OpenAPI.