Active Webhook API Documentation Generator - n8n Workflow

Use this n8n workflow to automatically generate real-time Swagger API documentation for all active webhooks across your n8n instance, enhancing visibility and integration efforts. This n8n template uses custom scripting.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Developers managing multiple API integrations through n8n.

  • Teams needing a centralized, auto-updating directory of their n8n webhook endpoints.

  • Users who want to simplify sharing API specifications for their n8n workflow designs.

  • Automation specialists looking for advanced examples of using the n8n node for introspection.

Overview

Managing numerous n8n workflow webhooks can become complex. This powerful n8n workflow solves the visibility problem by automatically introspecting the entire n8n instance. It uses the internal n8n API to gather details on all active workflows and their embedded webhook nodes, transforming this data into a standard Swagger 2.0 specification.

The resulting documentation is presented via an interactive Swagger UI rendered directly in the browser when the n8n trigger webhook is called. This eliminates the need for manual updates to documentation whenever a new n8n workflow or endpoint is deployed, providing significant value for DevOps and integration teams. Furthermore, it supports custom annotations in webhook notes to correctly document query and body parameters, making this n8n template exceptionally useful for building robust API layers.

How it Works


  1. The process begins with the Get Swagger n8n trigger, which is an HTTP Webhook configured to respond using a downstream node.

  2. The n8n n8n node then executes a request against the internal n8n API, specifically retrieving details for all currently active n8n workflow configurations in the instance.

  3. The core logic resides in the Code n8n node. This node processes the raw workflow JSON data. It identifies all Webhook nodes and their corresponding Respond to Webhook nodes, analyzing the connections to determine the response type (JSON, text, or redirect).

  4. Crucially, the Code node constructs a Swagger 2.0 YAML string, extracting path, method, response codes, and dynamically adding parameter documentation if the original Webhook n8n node has relevant annotations in its notes (e.g., @query or @body).

  5. Finally, the Respond to Webhook n8n node takes the generated Swagger YAML text and embeds it within an HTML template that initializes the Swagger UI bundle. This delivers an interactive documentation page directly back to the requester, offering a complete, dynamic documentation source generated by the n8n workflow itself.

Installation Guide


  1. Import the provided n8n workflow JSON into your n8n instance.

  2. Credentials Setup: This n8n workflow requires credentials for the n8n node (Step 2). You must configure an 'n8n API' credential, typically by generating a Personal Access Token (PAT) within your n8n settings.

  3. Configure Annotations (Optional but Recommended): To ensure your API documentation includes parameters, open the Webhook n8n node in any of your active workflows and use the 'Notes' field to add parameter definitions, following the syntax detailed in the workflow's sticky note (e.g., // @query my_id string The resource identifier).

  4. Activate: Save and activate the new n8n workflow.

  5. Access: Access your live documentation by hitting the defined webhook URL (e.g., https://your-n8n-instance/webhook/swagger).

Node Details

Get Swagger (Webhook Trigger): The starting n8n trigger. It listens on the /swagger path and uses the responseNode configuration to wait for the final output.
n8n (n8n Node): Fetches all active n8n workflow data using the internal n8n API. This ensures the documentation is always up-to-date with currently deployed endpoints.
Code (Custom Code Node): This is the automation engine of this n8n template. It parses the workflow structure, determines webhook-response connections, extracts optional parameter notes, and meticulously formats the data into a valid Swagger 2.0 YAML string. It includes complex logic (findValidTargets) for tracing connections between a Webhook n8n node and a Respond to Webhook n8n node.
Respond to Webhook (Final Action Node): The final n8n node that packages the generated Swagger YAML data into an HTML wrapper. This wrapper loads the Swagger UI frontend assets, rendering the interactive API documentation preview based on the live data generated by the n8n workflow.

Related n8n Workflows

Free

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by
Danger
Danger

he/him 🎲 Boardgames and role-play addicted 📸 Love snapping pictures 🪴 Plant dad 👨‍💻 Software Engineer made in Italy

Featured*