Skip to content

Execute Workflow#

Use the Execute Workflow node to run a different workflow on the host machine that runs n8n.

Node parameters#

Source#

Select where the node should get the sub-workflow's information from:

  • Database: Select this option to load the workflow from the database by ID. You must also enter:
    • Workflow ID: Enter the ID for the workflow. The URL of the workflow contains the ID after /workflow/. For example, if the URL of a workflow is https://my-n8n-acct.app.n8n.cloud/workflow/abCDE1f6gHiJKL7, the Workflow ID is abCDE1f6gHiJKL7.
  • Local File: Select this option to load the workflow from a locally saved JSON file. You must also enter:
    • Workflow Path: Enter the path to the local JSON workflow file you want the node to execute.
  • Parameter: Select this option to load the workflow from a parameter. You must also enter:
    • Workflow JSON: Enter the JSON code you want the node to execute.
  • URL: Select this option to load the workflow from a URL. You must also enter:
    • Workflow URL: Enter the URL you want to load the workflow from.

Mode#

Use this parameter to control the execution mode for the node. Choose from these options:

  • Run once with all items: Pass all input items into a single execution of the node.
  • Run once for each item: Execute the node once for each input item in turn.

Node options#

This node includes one option: Wait for Sub-Workflow Completion. This lets you control whether the main workflow should wait for the sub-workflow's completion before moving on to the next step (turned on) or whether the main workflow should continue without waiting (turned off).

Templates and examples#

AI agent that can scrape webpages

by Eduard

View template details
Chat with a Google Sheet using AI

by David Roberts

View template details
Telegram AI bot with LangChain nodes

by n8n Team

View template details
Browse Execute Workflow integration templates, or search all templates

Set up and use a sub-workflow#

This section walks through setting up both the parent workflow and sub-workflow.

Create the sub-workflow#

  1. Create a new workflow.
  2. Optional: configure which workflows can call the sub-workflow:
    1. Select the Options Options menu menu > Settings. n8n opens the Workflow settings modal.
    2. Change the This workflow can be called by setting. Refer to Workflow settings for more information on configuring your workflows.
  3. Add the Execute Workflow Trigger node.
  4. Add other nodes as needed to build your sub-workflow functionality.
  5. Save the sub-workflow.

Sub-workflow mustn't contain errors

If there are errors in the sub-workflow, the parent workflow can't trigger it.

Load data into sub-workflow before building

This requires the ability to load data from previous executions, which is available to Pro and Enterprise users.

If you want to load data into your sub-workflow to use while building it:

  1. Create the sub-workflow and add the Execute Workflow Trigger.
  2. In the sub-workflow settings, set Save successful production executions to Save.
  3. Skip ahead to setting up the parent workflow, and run it.
  4. Follow the steps to load data from previous executions. You can now pin example data in the trigger node, enabling you to work with real data while configuring the rest of the workflow.

Call the sub-workflow#

  1. Open the workflow where you want to call the sub-workflow.
  2. Add the Execute Workflow node.
  3. In the Execute Workflow node, set the sub-workflow you want to call. You can choose to call the workflow by ID, load a workflow from a local file, add workflow JSON as a parameter in the node, or target a workflow by URL.

    Find your workflow ID

    Your sub-workflow's ID is the alphanumeric string at the end of its URL.

  4. Save your workflow.

When your workflow executes, it will send data to the sub-workflow, and run it.

How data passes between workflows#

For example, there's an Execute Workflow node in Workflow A. The Execute Workflow node calls another workflow, Workflow B:

  1. The Execute Workflow node passes the data to the Execute Workflow trigger node of Workflow B.
  2. The last node of Workflow B sends the data back to the Execute Workflow node in Workflow A.