Server URL templating
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.
URL templating is currently supported for Python and Java SDK generation only.
Generated SDK behavior
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.
Python
Java
The generated SDK exposes an Environment class:
environment.py
SDK users can override the base URL when constructing the client:
Setting up server URL templating
Define URL template variables in your API definition and provide a static fallback URL for SDK users who don’t customize variables:
OpenAPI
Fern Definition
openapi.yml
For full configuration details, see the docs for your API definition format: