Webhooks
Define webhooks using OpenAPI 3.1+ native webhook support or Fern’s extensions
Fern supports two methods for defining webhooks in your OpenAPI specification:
- Using OpenAPI 3.1’s native webhook support (recommended)
- Using Fern’s
x-fern-webhookextension
OpenAPI 3.1 webhooks
For OpenAPI 3.1 specifications, use the webhooks top-level field to define your webhook operations. Each webhook requires an operationId to be properly processed by Fern.
Fern webhook extension
For OpenAPI 3.0, use the x-fern-webhook: true extension to define webhooks. Fern will treat the requestBody as the webhook payload.
The path that you choose when defining a webhook can be arbitrary. Since webhooks can be sent to any server, Fern just ignores the path.
Generate webhook reference
Fern Docs can automatically generate your webhook reference documentation from your definition. Set this up in your docs.yml file.
Your webhook reference can be a single documentation page:
Or you can configure individual documentation pages per webhook event:
For more information on how to configure your webhook reference in docs.yml, see Generate your webhook reference.