For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Slack communityLog inBook a demo
  • Getting Started
    • Overview
    • Quickstart
    • Customer Showcase
  • Writing Content
    • Markdown
    • Visual Editor
    • Reusable Markdown
    • Custom React Components
      • Generate API Reference
      • SDK Snippets
      • HTTP Snippets
      • Endpoint Errors
      • Audiences
      • Customize API Reference Layout
      • Write Markdown in API Reference
      • Generate Webhook Reference
      • Multiple Server URLs
      • Generate WebSocket Reference
      • Generate OpenRPC Reference
    • Changelog
LogoLogo
Slack communityLog inBook a demo
On this page
  • Directory Structure
  • Include more than one Webhook Reference
API References

Generate your Webhook Reference

Was this page helpful?
Previous

Multiple Server URLs

Switch between different API environments seamlessly
Next
Built with

Similar to API References, Fern Docs can automatically generate your Webhook Reference documentation from your API definition. Simply add x-fern-webhook: true to the webhook definitions in your OpenAPI specification or define webhooks in your Fern Definition and Fern will generate comprehensive documentation for all your webhooks!

Example:

docs.yml
1navigation:
2 - section: Introduction
3 contents:
4 - page: Getting Started
5 path: ../introduction/getting-started.md
6 - page: Authentication
7 path: ../introduction/authentication.md
8 - api: API Reference
9 api-name: api-v1
10 display-errors: true
11 - api: Webhook Reference
12 api-name: webhooks-v1

For a real-world example of webhook documentation generated from an API definition, check out Webflow’s Webhooks.

Directory Structure

Your webhooks should be defined in a dedicated folder within your Fern project:

OpenAPI
Fern Definition
$fern/
$ └── apis/
$ ├── webhooks-v1/ # Webhook definition
$ │ ├── openapi/
$ │ │ └── openapi.yml
$ │ └── generators.yml
$ └── api-v1/ # Regular API endpoints

If you’re using OpenAPI, your generators.yml file should point to your OpenAPI specification:

generators.yml
1api:
2 path: openapi/openapi.yml

You can read more about how to define webhooks in your OpenAPI specification here.

Include more than one Webhook Reference

To include multiple webhook definitions in your documentation, use the webhook-name property:

docs.yml
1navigation:
2 - api: Payment Webhooks
3 api-name: payment-webhooks
4 - api: Order Webhooks
5 api-name: order-webhooks

When using multiple webhook definitions, organize them in separate directories within your Fern project:

$fern/
$ └── apis/
$ ├── payment-webhooks/ # Payment webhook definitions
$ │ ├── openapi/
$ │ │ └── openapi.yml # Payment webhook OpenAPI spec
$ │ └── generators.yml
$ └── order-webhooks/ # Order webhook definitions
$ ├── openapi/
$ │ └── openapi.yml # Order webhook OpenAPI spec
$ └── generators.yml