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 operationId: initiatePayment
6 x-fern-webhook: true
7 requestBody:
8 content:
9 application/json:
10 schema:
11 type: object
12 properties:
13 amount:
14 type: number
15 currency:
16 $ref: '#/components/schemas/Currency'
17 required:
18 - amount
19 - 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.