Skip to main content

Overview

Performs comprehensive validation of n8n workflows including structure, node configurations, connections, and expressions. This is a three-layer validation system that catches errors before deployment. Performance: Moderate (100-500ms depending on workflow size)

Validation Layers

Structure Validation

Validates workflow structure, node definitions, and metadata

Node Validation

Validates individual node configurations with multiple profiles

Connection Validation

Validates node connections and data flow

Expression Validation

Validates n8n expression syntax and references

AI Tool Validation

Validates AI Agent tool connections and configurations

Operator Structure

Validates filter operators (binary vs unary, singleValue requirements)

Parameters

workflow
object
required
The complete workflow JSON to validate.Must include:
  • nodes: Array of node objects
  • connections: Object mapping node connections
Example:
{
  "nodes": [
    {
      "id": "node-1",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [250, 300],
      "parameters": {...}
    }
  ],
  "connections": {
    "Webhook": {
      "main": [[{"node": "HTTP Request", "type": "main", "index": 0}]]
    }
  }
}
options
object
Optional validation settings.

Response

valid
boolean
Whether the workflow is valid (no errors)
summary
object
Validation summary statistics
errors
array
Array of error objects
warnings
array
Array of warning objects
suggestions
array
Array of improvement suggestions (strings)

Examples

{
  "workflow": {
    "nodes": [
      {
        "id": "webhook-1",
        "name": "Webhook",
        "type": "n8n-nodes-base.webhook",
        "typeVersion": 1,
        "position": [250, 300],
        "parameters": {
          "httpMethod": "POST",
          "path": "test"
        }
      },
      {
        "id": "http-1",
        "name": "HTTP Request",
        "type": "n8n-nodes-base.httpRequest",
        "typeVersion": 4,
        "position": [450, 300],
        "parameters": {
          "url": "https://api.example.com",
          "method": "POST"
        }
      }
    ],
    "connections": {
      "Webhook": {
        "main": [[{"node": "HTTP Request", "type": "main", "index": 0}]]
      }
    }
  }
}

Response Example (Valid Workflow)

{
  "valid": true,
  "summary": {
    "totalNodes": 2,
    "enabledNodes": 2,
    "triggerNodes": 1,
    "validConnections": 1,
    "invalidConnections": 0,
    "expressionsValidated": 0,
    "errorCount": 0,
    "warningCount": 0
  },
  "errors": [],
  "warnings": [],
  "suggestions": [
    "Consider adding error handling for HTTP Request node"
  ]
}

Response Example (Invalid Workflow)

{
  "valid": false,
  "summary": {
    "totalNodes": 3,
    "enabledNodes": 3,
    "triggerNodes": 1,
    "validConnections": 1,
    "invalidConnections": 1,
    "expressionsValidated": 2,
    "errorCount": 2,
    "warningCount": 1
  },
  "errors": [
    {
      "node": "HTTP Request",
      "message": "Missing required field 'url'",
      "details": "The 'url' parameter is required for HTTP Request nodes"
    },
    {
      "node": "Slack",
      "message": "Invalid connection",
      "details": "Node 'Slack' references non-existent node 'NonExistent'"
    }
  ],
  "warnings": [
    {
      "node": "Set",
      "message": "No output connections",
      "details": "Node 'Set' has no output connections and may not have any effect"
    }
  ],
  "suggestions": [
    "Fix connection from Slack to ensure proper workflow flow",
    "Add required 'url' parameter to HTTP Request node"
  ]
}

Validation Checks

Structure Validation

  • Validates nodes array exists and is not empty
  • Validates connections object exists
  • Checks for at least one trigger node
  • Validates workflow settings if present
  • Each node has required fields: id, name, type, typeVersion, position, parameters
  • Node IDs are unique
  • Node names are unique
  • Position is valid [x, y] array
  • Parameters is an object

Node Configuration Validation

  • Node type exists in database
  • Node version is supported
  • Required fields are present
  • Field values are valid
  • Filter operators (binary vs unary)
  • Resource mapper configurations
  • Assignment collections
  • Resource locators

Connection Validation

  • Source nodes exist
  • Target nodes exist
  • Connection types are valid
  • No circular dependencies
  • All nodes are reachable from triggers

Expression Validation

  • Expression syntax is valid (={{ ... }})
  • Referenced nodes exist
  • Referenced fields are accessible
  • No syntax errors in JavaScript expressions

Use Cases

  • Pre-deployment validation: Catch all workflow issues before creating in n8n
  • Development validation: Quick validation during workflow development
  • AI Agent workflows: Validate workflows with AI Agent nodes and tool connections
  • Expression validation: Check expression syntax before workflow execution
  • Post-modification checks: Ensure workflow integrity after modifications

Best Practices

Validation catches errors early and saves API calls.
// 1. Validate workflow
validate_workflow({"workflow": myWorkflow})

// 2. Only create if valid
n8n_create_workflow({"name": "My Workflow", ...})
For rapid iteration, use minimal profile for faster validation.
{"workflow": myWorkflow, "options": {"profile": "minimal"}}
Before deploying to production, validate with strict profile.
{"workflow": myWorkflow, "options": {"profile": "strict"}}
Warnings often indicate potential runtime issues, even if not errors.
Always validate after changing connections or node configurations.
Operator structures and missing metadata are automatically fixed when workflows are created or updated via n8n_create_workflow or n8n_update_partial_workflow. Validation helps catch issues before they reach n8n.

Common Pitfalls

Large workflows take longer: Workflows with 100+ nodes may take 500ms+ to validate.
Expression validation requires node references: Expression validation needs proper node references to exist in the workflow.
Some warnings may be acceptable: Depending on your use case, some warnings may be intentional (e.g., disabled nodes).
Cannot catch all runtime errors: Validation cannot predict API failures, network issues, or credential problems that occur at runtime.
Profile only affects node validation: The profile setting only affects node configuration validation, not connection or expression checks.

Performance Characteristics

Workflow SizeValidation TimeNotes
Small (1-10 nodes)50-100msFast validation
Medium (10-50 nodes)100-300msModerate validation
Large (50-100 nodes)300-500msSlower validation
Very Large (100+ nodes)500ms+Consider disabling some checks
Expression validation adds approximately 50-100ms regardless of workflow size.

Validation Profile Comparison

ProfileSpeedThoroughnessBest For
minimalFastestBasic checksDevelopment/editing
runtimeFastStandard checksDefault use
ai-friendlyModerateBalancedAI agent workflows
strictSlowestComprehensiveProduction deployment

validate_node

Validate individual nodes

n8n_create_workflow

Create validated workflow

n8n_autofix_workflow

Auto-fix workflow issues

Build docs developers (and LLMs) love