Define Webhooks in OpenAPI

Use the x-fern-webhook extension to define webhooks in your OpenAPI spec

Simply define a path in your OpenAPI, and add the extension x-fern-webhook. Fern will treat the requestBody as the webhook payload.

openapi.yml
1paths:
2 /payment/updated/:
3 post:
4 summary: Payment Initiated
5 x-fern-webhook: true
6 requestBody:
7 content:
8 application/json:
9 schema:
10 type: object
11 properties:
12 amount:
13 type: number
14 currency:
15 $ref: '#/components/schemas/Currency'
16 required:
17 - amount
18 - currency

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.