Your API may leverage certain headers for every endpoint or most endpoints. These are called global headers.
Once you configure a global header (either automatically detected or manually specified), Fern generates an SDK that accepts this as a constructor parameter. Users can then provide the value once, and the generated SDK automatically includes the header in all their API calls:
Fern automatically identifies headers that are used in every request, or the
majority of requests, and marks them as global. You can manually configure additional
global headers in either api.yml (Fern Definition) or openapi.yml.
To specify headers that are meant to be included on every request:
You can also specify path parameters that are meant to be included on every request:
If you have certain endpoints that do not live at the configured base-path, you can
override the base-path at the endpoint level.
You cannot yet specify query parameters that are meant to be included on every request. If you’d like to see this feature, please upvote this issue.
Use the x-fern-global-headers extension to label additional headers as global
or to alias the names of global headers:
This configuration yields the following client: