Filter your endpoints (audiences)

View as Markdown
Enterprise feature

This feature is available only for the Enterprise plan. To get started, reach out to support@buildwithfern.com.

Use audiences to generate tailored SDKs for different groups of API consumers, such as internal teams, beta testers, or customers. Tag API elements with an audience in your spec, then filter each SDK group to the audiences you want in generators.yml.

For OpenAPI, you can also filter by URL path instead of by tag.

1

Tag elements in your spec

Tag endpoints, schemas, and properties with x-fern-audiences. Here, an internalNotes property is tagged internal:

openapi.yml
1components:
2 schemas:
3 Plant:
4 properties:
5 internalNotes:
6 type: string
7 x-fern-audiences:
8 - internal
2

Filter your SDKs

Set the audiences field on an SDK group in generators.yml. The following group generates only elements tagged public:

generators.yml
1groups:
2 sdks:
3 audiences:
4 - public
5 generators:
6 - name: fern-typescript-sdk
7 version: 0.8.8

Elements tagged with a matching audience are included, and elements tagged only with other audiences are dropped. Untagged elements aren’t scoped to any audience, so they’re always included. If you don’t set audiences, every element is included regardless of its tags.