Use audiences to filter your API
Use x-fern-audiences
to filter to relevant services, methods and messages
Audiences are a useful tool for segmenting your gRPC API for different consumers. Common examples of audiences include public
and beta
.
Remember to filter your SDKs and Docs after specifying audiences. If no audiences are specified, nothing will be filtered.
SDKs
The following example configures the SDK to filter to the public
audience:
Docs
The following example configures the docs to filter to the public
audience:
Filter services
Add x-fern-audiences
to services to control which services are included for specific audiences:
Filter individual methods
You can filter specific methods within services:
Filter message fields
Filter specific fields within message types:
Filter entire messages
Filter entire message types to different audiences:
Filter enums and enum values
Filter enum values based on audience:
Request/Response filtering
Filter request and response messages based on audience:
Conditional method definitions
Use audiences to expose different versions of methods:
Streaming method filtering
Filter streaming methods by audience:
Multiple audience support
Assign multiple audiences to services or methods:
Using custom extensions
Define custom Fern extensions for audience filtering:
This allows you to create different views of the same gRPC API for different types of consumers, ensuring each audience only sees the services, methods, and data relevant to their use case.