Define Webhooks in OpenAPI

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

To define a webhook in your OpenAPI specification, add the x-fern-webhook: true extension to your endpoint. OpenAPI 3.0.0 or higher is required. Fern will treat the requestBody as the webhook payload.

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.

Built with