Search code examples
swaggerwebhooksdocumentationswagger-editor

How to document webhooks in Swagger?


I'm building a set of APIs and webhooks. For the usual APIs, I have no problem writing the YAML file to document that in Swagger. However, I would like to also document the webhooks such as their request body payload and other information about them in the Swagger documentation.

How are webhooks or reversed API usually documented in Swagger?


Solution

  • Webhooks are supported in OpenAPI 3.1 which was probably not available when you posted this question.

    I notice there is an x-webhooks extensions for 3.0 see https://redocly.com/docs-legacy/api-reference-docs/specification-extensions/x-webhooks but I'm not sure how widely supported it is by OpenAPI clients.