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-webhook
extension
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.
To create dedicated pages in your API reference documentation for each webhook
event, include tags
and complete example
data in your schema. Then, add a
reference in your
docs.yml
.
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.
To create dedicated pages in your API reference documentation for each webhook
event, include tags
and complete example
data in your schema. Then, add a
reference in your
docs.yml
.
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.