Visualize and Auto-Tag n8n Subworkflow Dependencies

This n8n workflow automatically maps and tags subworkflows called by other workflows, solving the problem of tracking complex dependencies in large n8n instances. It generates a visual dependency graph, making workflow management clear and efficient.
httpRequest
code
n8n
+13
Workflow Identifier: 2244
NODES in Use: httpRequest, n8n, code, filter, scheduleTrigger, n8nTrigger, set, splitInBatches, if, splitOut, merge, quickChart, webhook, respondToWebhook, aggregate, stickyNote
Automate dependency graph with n8n and code

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Automation Does

This workflow finds subworkflow dependencies inside your n8n instance automatically.
It detects which workflows call other subworkflows, then builds a clear graph showing these connections.
You get tagged subworkflows labeled with their calling workflows and two types of visuals: a pie chart and an interactive MermaidJS graph.
This saves you time checking who uses what and stops accidental breaking of shared subworkflows.


How This Workflow Works

Inputs: The workflow calls the n8n API to get all workflows and tags data.

Processing: It scans each workflow’s nodes for execution nodes that call subworkflows.
Then it builds a map between subworkflows and their callers.
It removes workflows that have no callers and excludes any that are missing or deleted.
For each subworkflow, it fetches full data to check tags.
It finds which caller tags are missing and creates those tags first if needed.
Finally, it updates each workflow’s tags, matching them to actual callers.

Outputs: Updated workflow tags that accurately reflect real dependencies.
Two visual charts: a pie chart summarizing most called subworkflows, and a MermaidJS graph displaying dependency lines interactively in a browser via webhook.


Who Should Use This Workflow

If managing many complex workflows and subworkflows causes confusion about who calls what, this helps.
If manual tagging is too slow or error-prone, this automation keeps tags synced automatically.
If you want a clear, easy-to-understand visual of subworkflow usage, this fits well.
Beginner or advanced users in n8n benefit, including teams wanting to avoid costly mistakes due to hidden dependencies.


Tools and Services Used

  • n8n API: To list workflows, get workflow details, and manage tags.
  • HTTP Request nodes: For API calls within n8n.
  • Code nodes: To parse workflows and build dependency mappings.
  • Schedule Trigger: To run this workflow regularly.
  • Webhook node: To expose the MermaidJS dependency graph for browser viewing.

Beginner Step-by-Step: How to Use This Workflow in n8n

Step 1: Download and Import

  1. Click the Download button on this page to get the workflow JSON file.
  2. Inside your n8n editor, select “Import from File” and pick the downloaded JSON.

Step 2: Configure Credentials and URLs

  1. Provide your n8n API credentials in the credentials section.
  2. Open the SET instance_url node and update the URL to your actual n8n instance API base URL.
  3. If the workflow uses other IDs, emails, or paths, replace those with your own values.

Step 3: Test the Workflow

  1. Run the workflow manually once to check that the API calls work and dependency graph data appear.

Step 4: Activate for Production

  1. Turn on the workflow or enable the Schedule Trigger node to run it automatically on a timer.
  2. Check outputs regularly and share the webhook URL for the MermaidJS graph with your team.

Using these steps, a beginner can quickly set up this solution without building from zero.
Follow simple edits and imports to keep subworkflow tagging and visualizations current.


How Inputs Flow to Outputs

  • Inputs: The full list of workflows and existing tags retrieved by API.
  • Processing: Detection of execution nodes referencing subworkflows, building mapping of dependencies.
    Filtering out unused or missing workflows.
    Comparing current tags vs required tags and creating missing tags.
    Updating workflows with new tags.
    Generating visual graph data.
  • Outputs: Corrected and updated workflow tags.
    Visual charts (pie chart and MermaidJS dependency graph).

Edge Cases and Failures

If the instance URL is wrong, API calls fail with 404 errors.

Tags not updating can happen if API keys lack write permission.

Some workflows might have stale or deleted subworkflow references, which are filtered out in processing.

The MermaidJS graph can fail if webhook code or scripts are broken or incomplete.


Customization Ideas

  • Change the Schedule Trigger timing to daily or monthly.
  • Filter workflows by name or tag inside the workflow retrieval node to narrow analysis.
  • Modify pie chart colors or type in the QuickChart node.
  • Add notification nodes after tag creation to alert team members.
  • Expand the code node to find nested or parameter-based subworkflow calls.
  • Use the provided link for self-host n8n if advanced hosting or control is needed.

Summary of Benefits

✓ Automatically finds and maps subworkflow dependencies.
✓ Keeps workflow tags up to date with real caller information.
✓ Produces easy-to-understand visual graphs with pie and interactive MermaidJS charts.
✓ Saves hours of manual checking and fixes workflow breakage risks.
✓ Suitable for beginners to advanced users managing many workflows.



// Example snippet from "List callers of subworkflows" Code node:
const workflows = items[0].json.workflows;
const graph = {};

workflows.forEach(workflow => {
  if (workflow.nodes) {
    workflow.nodes.forEach(node => {
      if (node.type === "n8n-nodes-base.executeWorkflow" || node.type === "@n8n/n8n-nodes-langchain.toolWorkflow") {
        const calledId = node.parameters.workflowId;
        if (calledId) {
          if (!graph[calledId]) {
            graph[calledId] = { callers: [] };
          }
          graph[calledId].callers.push(workflow.id);
        }
      }
    });
  }
});

return [{json: graph}];

This code looks through all workflows, checks each workflow’s nodes for those running other workflows, then builds a list of which workflows call which subworkflows by their IDs.
This allows the rest of the automation to tag and visualize this relationship.


Automate dependency graph with n8n and code

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

It scans every workflow’s nodes for execution nodes that specify a subworkflow ID, then lists those IDs and their callers.
API requests will fail with errors like 404, stopping updates. Check and correct the URL and credentials before running.
Yes, the MermaidJS graph is served via a webhook URL that can be shared with your team for interactive viewing.
It works on both. For advanced control on self hosting n8n, use proper API URLs and credentials.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.