Dynamic API Documentation Portal for Webhooks - n8n Workflow

Generate dynamic, self-documenting API portals for your webhooks instantly. This advanced n8n workflow uses the n8n API to scan active configurations and render professional Bootstrap documentation.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Automation Architects: Users looking to standardize and automatically document their microservices built on n8n.
Technical Writers: Teams needing a live, self-updating documentation system tied directly to their deployed n8n workflow logic.
Developers: Those who need easy access to cURL commands and schema definitions for endpoints served by an n8n trigger.
n8n Power Users: Anyone leveraging the n8n API for advanced instance management and meta-automation capabilities.

Overview

Maintaining up-to-date documentation for numerous webhook endpoints can be tedious. This powerful n8n workflow solves this by operating as a meta-automation engine. It utilizes the dedicated n8n node for the n8n API to inspect all active workflows within your instance.

The core logic relies on a crucial convention: any n8n workflow intended for documentation must include a special Set n8n node named APIDOCS. This node holds standardized metadata (summary, request/response bodies, method). The generator scans for this APIDOCS n8n node, extracts the data, and dynamically constructs a beautiful, interactive Bootstrap-themed documentation page.

This system allows you to manage documentation directly alongside your n8n workflow, ensuring that your API portal is always synchronized with the deployed logic. It is one of the most complex and useful n8n templates for self-hosting environments.

How it Works

This automation operates in two stages: the public access stage and the generation stage.

Public Access (Serving the Documentation):


  1. The primary entry point is the Webhook n8n trigger, configured at /api-doc. A request to this URL initiates the flow.

  2. The Configs n8n node defines global variables, such as the portal's title, version, and the base URL of your n8n instance.

  3. The flow then executes a sub-workflow via the ExecuteSubWorkflow n8n node, passing the necessary configuration data.

  4. The MakeFullHTML n8n node receives the raw HTML documentation content generated by the sub-workflow and wraps it in a complete HTML page using dark-mode Bootstrap styling.

  5. Finally, the RespondHTML n8n node sends the complete page back to the browser that triggered the initial webhook.

Generation Stage (Building the Content):


  1. The generation process starts with an Execute n8n trigger, feeding inputs to the GetWorkflows n8n node.

  2. The GetWorkflows n8n node uses n8n API credentials to fetch metadata for all active n8n workflows on the instance.

  3. The Aggregate n8n node collects the full list of workflows.

  4. The central piece is the FilterWorkflows custom Code n8n node. It iterates through the workflows, filtering for those that contain both a Webhook n8n trigger and the API_DOCS n8n node. It parses the metadata, constructs cURL commands, and generates the necessary HTML accordion markup for each documented endpoint, ensuring the output is ready for display in the main n8n workflow.

Installation Guide

To deploy this comprehensive documentation n8n workflow, follow these steps:


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

  2. API Credentials: Configure the GetWorkflows n8n node. You must set up an n8n API credential that has permissions to read all workflows in your instance.

  3. Global Configuration: Customize the Configs n8n node. Update namedoc, version, and especially urlbase to match the public URL of your n8n host (e.g., https://my.n8n.app/).

  4. Document Your Webhooks: In every n8n workflow you wish to appear in the portal, add a Set n8n node and name it APIDOCS (case-sensitive).

  5. Metadata JSON: Inside the APIDOCS n8n node, use the 'Raw' JSON mode to define your endpoint metadata, including the target webhook name, summary, method, requestBody, and sample successResponse.

  6. Activate: Save and activate both the generator n8n workflow and all target webhooks. The documentation will be available at the URL defined by the main Webhook n8n trigger (e.g., [YourN8NURL]/webhook/api-doc).

Node Details

Webhook (Trigger): The main public access n8n trigger. Function: Initiates the documentation generation and serving process when accessed at /api-doc. Key Configuration: Response Mode set to 'Response Node'.
GetWorkflows (n8n node): Function: Fetches a JSON array of all active n8n workflows using the n8n API. Key Configuration: Requires specific n8n API credentials for read access.
Configs (Set n8n node): Function: Stores global settings for the documentation page (Title, Version, Base URL).
FilterWorkflows (Code n8n node): Function: Contains the complex custom code logic to filter the workflow list, parse the API_DOCS JSON metadata, generate cURL examples, and construct the final Bootstrap HTML documentation structure.
ExecuteSubWorkflow (Execute Workflow n8n node): Function: Calls the generation logic path (GetWorkflows -> FilterWorkflows) asynchronously to create the HTML content. Key Configuration: Waits for the sub-workflow completion.
MakeFullHTML (HTML n8n node): Function: Takes the htmlContent output from the generation step and embeds it into a full HTML page template, ensuring a consistent dark-mode look using Bootstrap 5.


  • RespondHTML (Respond to Webhook n8n node): Function: Final action that sends the resulting generated HTML back to the user who invoked the initial n8n trigger.

Related n8n Workflows

Free

Nodes: 10 Nodes
Updated: December 26 2025
View all
Created by

I am a software engineer specializing in automations, with extensive experience on the N8N platform. With solid skills in JavaScript, Go, .NET, and C#, I am equipped to develop efficient and scalable solutions.

Featured*