Fern Definition isn’t recommended for new customers and Fern isn’t accepting feature requests for this format. It remains supported for existing users.
This feature is available only for the Team and Enterprise plans. To get started, reach out to support@buildwithfern.com.
Audiences are a useful tool for segmenting your API for different consumers. You can configure your Fern Docs to publish documentation specific to an Audience. You can use audiences in your OpenAPI Specification, too.
Common examples of audiences include:
By default, if no audience is specified, it will be accessible to all consumers.
The Fern Definition has a first-class concept for marking different endpoints, types, and properties for different audiences.
To use audiences in your Fern Definition, add them to api.yml.
In the example below, we have created audiences for internal, beta, and customer groups:
To mark an endpoint for a particular consumer, add an audience with the relevant groups.
In this example, the sendEmail endpoint is only available to internal consumers:
Types can also be marked for different audiences.
In this example, the Email type is available to internal and beta consumers:
Properties of a type can also be marked for different audiences.
In this example, the to property is available to beta consumers only:
In generators.yml, you can apply audience filters so that only certain
endpoints are passed to the generators.
The following example configures the SDKs to filter for customers:
If generating Fern Docs, update your docs.yml configuration to include your audiences.
The following example shows how to configure your docs.yml to publish documentation for the customers audience: