Workflow Execution Engine
Relevant source files
The following files were used as context for generating this wiki page:
- packages/frontend/editor-ui/src/constants.ts
- packages/nodes-base/nodes/Function/Function.node.json
- packages/nodes-base/nodes/HttpRequest/HttpRequest.node.json
- packages/nodes-base/nodes/Webhook/Webhook.node.json
- packages/nodes-base/nodes/Set/Set.node.json
- packages/nodes-base/nodes/ExecuteWorkflow/ExecuteWorkflow/ExecuteWorkflow.node.json
- packages/nodes-base/nodes/HtmlExtract/test/workflow.dotNotation.json
- packages/nodes-base/nodes/Wordpress/tests/workflow/page/page.workflow.json
- packages/frontend/editor-ui/src/utils/templates/samples/agents/task_management_agent_with_google_sheets.json
- packages/nodes-base/nodes/If/If.node.json
- packages/nodes-base/nodes/Cron/Cron.node.json
- packages/nodes-base/nodes/NoOp/NoOp.node.json
- packages/frontend/editor-ui/src/tests/mocks.ts
- packages/frontend/editor-ui/src/constants.workflows.ts
- packages/@n8n/db/src/entities/types-db.ts
An n8n workflow is a JSON object that defines an automated process. It consists of a series of interconnected nodes that pass data to one another. The structure of this JSON object contains all the information necessary to execute the workflow, including the nodes, their configurations, their connections, and various metadata.
This document outlines the core components of the n8n workflow JSON structure, providing a reference for developers who need to understand, manipulate, or generate workflows programmatically.
High-Level Structure
A workflow is defined by a top-level JSON object with several key properties. These properties define the workflow's identity, its components (nodes and connections), and its behavior.
This diagram shows the main properties of a workflow object.
Key Properties
| Property | Type | Description |
|---|---|---|
id | string | A unique identifier for the workflow. |
name | string | The user-defined name of the workflow. |
nodes | INode[] | An array of node objects that make up the workflow. |
connections | object | An object defining the connections between nodes, representing the flow of execution. |
active | boolean | A flag indicating if the workflow is active and can be triggered. |
settings | object | An object containing workflow-specific settings, such as timezone and execution order. |
pinData | object | Stores static or sample data for nodes, useful for development and testing. |
meta | object | Contains metadata about the workflow, often related to the UI, like template IDs or instance IDs. |
tags | ITagDb[] | An array of tags associated with the workflow for organization. |
Sources: packages/nodes-base/nodes/Wordpress/tests/workflow/page/page.workflow.json, packages/@n8n/db/src/entities/types-db.ts:46-50
Nodes
Nodes are the fundamental building blocks of a workflow. Each node represents a specific action, trigger, or logical operation. The nodes property in the workflow JSON is an array of node objects.
Node Object Structure
| Property | Type | Description |
|---|---|---|
id | string | A unique identifier for the node within the workflow. |
name | string | The display name of the node in the editor. |
type | string | The node's type identifier, e.g., n8n-nodes-base.httpRequest. |
typeVersion | number | The version of the node type being used. |
position | [number, number] | An array with two numbers representing the [x, y] coordinates of the node on the canvas. |
parameters | object | An object containing the configuration and parameters for the node's operation. |
credentials | object | An object specifying the credentials used by the node, if any. |
disabled | boolean | Optional flag to disable the node from executing. |
Sources: packages/frontend/editor-ui/src/tests/mocks.ts:31-45, packages/nodes-base/nodes/Wordpress/tests/workflow/page/page.workflow.json:17-33
Example Node
Here is an example of an n8n-nodes-base.httpRequest node from a workflow.
{
"parameters": {
"url": "https://api.example.com/data",
"method": "GET",
"options": {}
},
"id": "88a269af-c315-491c-b897-578cfb81268a",
"name": "Fetch Data",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [520, 580]
}
Source: Adapted from packages/nodes-base/nodes/HtmlExtract/test/workflow.dotNotation.json:20-40
Connections
The connections object defines the data flow between nodes. It is a dictionary where each key is the name of an output node. The value is an object that maps output connection types (e.g., main) to an array of inputs on other nodes.
This diagram illustrates how a "Manual Trigger" node is connected to four different "Page" operation nodes.
Connection Object Structure
The structure below shows how the "When clicking ‘Execute workflow’" node connects to four other nodes from its main output.
"connections": {
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Page > Create",
"type": "main",
"index": 0
},
{
"node": "Page > Get",
"type": "main",
"index": 0
},
{
"node": "Page > Get Many",
"type": "main",
"index": 0
},
{
"node": "Page > Update",
"type": "main",
"index": 0
}
]
]
}
}
Source: packages/nodes-base/nodes/Wordpress/tests/workflow/page/page.workflow.json:289-307
Node Types & Categories
n8n includes a wide variety of nodes, which are organized into categories and subcategories for easier discovery.
Common Node Types
| Node Type Identifier | Description | Category | Subcategory(ies) |
|---|---|---|---|
n8n-nodes-base.start | The default starting point for a workflow. | Core Nodes | - |
n8n-nodes-base.manualTrigger | A trigger that starts a workflow when manually executed. | Core Nodes | - |
n8n-nodes-base.cron | Triggers a workflow on a schedule using cron syntax. | Core Nodes | Flow |
n8n-nodes-base.webhook | Triggers a workflow when an HTTP request is received at a specific URL. | Development | Helpers |
n8n-nodes-base.httpRequest | Makes an HTTP request to any URL. | Development | Helpers |
n8n-nodes-base.set | Sets or modifies data fields in the workflow. | Core Nodes | Data Transformation |
n8n-nodes-base.if | Routes data based on conditional logic (true/false). | Core Nodes | Flow |
n8n-nodes-base.function | Executes custom JavaScript code. | Development | Data Transformation |
n8n-nodes-base.executeWorkflow | Calls another workflow as a sub-workflow. | Core Nodes | Helpers, Flow |
n8n-nodes-base.noOp | "No Operation" node that does nothing; useful for organizing workflows. | Core Nodes | Helpers |
Sources: packages/frontend/editor-ui/src/constants.ts:130-220, packages/nodes-base/nodes/Start/Start.node.json, packages/nodes-base/nodes/Cron/Cron.node.json, packages/nodes-base/nodes/Webhook/Webhook.node.json, packages/nodes-base/nodes/HttpRequest/HttpRequest.node.json, packages/nodes-base/nodes/Set/Set.node.json, packages/nodes-base/nodes/If/If.node.json, packages/nodes-base/nodes/Function/Function.node.json, packages/nodes-base/nodes/ExecuteWorkflow/ExecuteWorkflow/ExecuteWorkflow.node.json, packages/nodes-base/nodes/NoOp/NoOp.node.json
Executable Trigger Nodes
Certain nodes are considered "executable triggers," meaning they can initiate a workflow execution. These include manual and scheduled triggers.
n8n-nodes-base.startn8n-nodes-base.manualTriggern8n-nodes-base.scheduleTriggern8n-nodes-base.cronn8n-nodes-base.interval
Source: packages/frontend/editor-ui/src/constants.ts:252-258
Workflow Settings & Metadata
The settings and meta objects control workflow-level configurations and store UI-related information.
Settings Object
The settings object can contain various options that affect the entire workflow's execution.
"settings": {
"executionOrder": "v1",
"saveDataSuccessExecution": "all",
"callerPolicy": "workflowsFromSameOwner"
}
Meta Object
The meta object stores information that is primarily used by the frontend editor and does not affect the execution logic itself.
"meta": {
"templateCredsSetupCompleted": false,
"templateId": "task_management_agent_with_google_sheets"
}
Pinned Data
The pinData feature allows you to attach static data to a node. This is particularly useful for designing and testing workflows without needing to execute the preceding nodes. The data is stored in the pinData object at the root of the workflow, with keys corresponding to the node's name.
"pinData": {
"HTML Extract (nested)": [
{
"json": {
"title": "STARTING . . ."
}
}
],
"HTML Extract (top level)": [
{
"json": {
"title": "STARTING . . ."
}
}
]
}
Source: packages/nodes-base/nodes/HtmlExtract/test/workflow.dotNotation.json:101-117
Database Representation
When stored in the database, the workflow entity includes additional fields related to its persistence and relationships with other entities like tags and folders.
The diagram below shows the structure of the IWorkflowDb entity.
Summary
The n8n workflow structure is a comprehensive JSON format that captures all aspects of an automation process. Its core components are an array of nodes defining the operations and a connections object defining the execution flow. This structure is augmented with settings, pinData for testing, and meta information for the editor. Understanding this JSON structure is key to programmatically interacting with n8n workflows and building custom integrations.