Environments
You can specify the environments where your server is deployed.
Single URL environments
api.yml
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.
api.yml
If you choose to use this feature, you must specify a url for each service you define:
auth.yml
Default environment
You can also provide a default environment:
api.yml
By providing a default environment, the generated SDK will be setup to hit that URL out-of-the-box.
URL templating
URL templating is currently supported for Python and Java SDK generation only.
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.
api.yml
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:
api.yml
Audiences
If you have listed environments that you want to filter, you can leverage audiences.
api.yml