Environments
Fern Definition isn’t recommended for new customers and Fern isn’t accepting feature requests for this format. It remains supported for existing users.
You can specify the environments where your server is deployed.
Single URL environments
Multiple URLs per environment
You can specify multiple URLs per environment. This is helpful if you have a microservice architecture, and you want a single SDK to interact with multiple servers.
If you choose to use this feature, you must specify a url for each service you define:
Default environment
You can also provide a default environment:
URL templating
For APIs deployed across multiple regions or environments, you can define URL templates with variable placeholders that SDK users customize at runtime. To set this up:
- Define your static base URLs under
urls— these appear in the generated environments enum. - Add
url-templateswith{variable}placeholders (e.g.,https://api.{region}.example.com/v1) for each service. Fern exposes these as configurable parameters in the SDK. - Provide
default-urlsas concrete fallbacks so SDK users get a working client out of the box without supplying variables. - List the available
variablesfor each service, each with anid, adefaultvalue, and an optionalvalueslist to constrain allowed options.
Base path
If you would like all of your endpoints to be prefixed with a path, use base-path.
In the example below, every endpoint is prefixed with a /v1:
Audiences
If you have listed environments that you want to filter, you can leverage audiences.