{
  "name": "Validate JSON and CSV import data via webhook with configurable rules",
  "nodes": [
    {
      "id": "450b896a-7d82-45d9-9a11-4b1e67a8e497",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -128
      ],
      "parameters": {
        "width": 800,
        "height": 588,
        "content": "## Validate CSV/JSON Import Data with Configurable Rules\n\nThis workflow provides a **reusable data validation API endpoint** for your import pipelines. Send any JSON array of records along with valida"
      }
    },
    {
      "id": "0143af87-c46e-4707-8318-fed250e86739",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        480
      ],
      "parameters": {
        "width": 280,
        "height": 328,
        "content": "### Step 1: Receive Data\nPOST request with JSON body:\n```json\n{\n  \"data\": [{...}, {...}],\n  \"rules\": {\n    \"fieldName\": {\n      \"required\": true,\n      \"type\": \"email\"\n    }\n  }\n}\n```\nRules in the req"
      }
    },
    {
      "id": "6b3086af-a198-426b-bafc-421d8ac13068",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        480
      ],
      "parameters": {
        "width": 280,
        "height": 328,
        "content": "### Step 2: Default Rules\nConfigure fallback validation rules here. These are used when the request body does not include a `rules` object.\n\nEdit the JSON in the **Set Default Rules** node to match yo"
      }
    },
    {
      "id": "ba474ce4-e4da-47e4-a912-5a320dc60eb5",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        480
      ],
      "parameters": {
        "width": 300,
        "height": 328,
        "content": "### Step 3: Validate\nThe Code node checks every row against the rules and collects all errors.\n\nSupported checks:\n- `required`\n- `type`: string, number, email, date, url, boolean\n- `min` / `max` (numb"
      }
    },
    {
      "id": "761e962f-7e78-4418-8bcf-814c0e67c8cc",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        416
      ],
      "parameters": {
        "width": 296,
        "height": 392,
        "content": "### Step 4: Response\nReturns a JSON report:\n```json\n{\n  \"valid\": false,\n  \"summary\": {\n    \"totalRows\": 3,\n    \"validRows\": 1,\n    \"invalidRows\": 2,\n    \"totalErrors\": 4\n  },\n  \"errors\": [\n    {\n     "
      }
    },
    {
      "id": "9cba0c0c-f991-4113-b267-3577c6a77698",
      "name": "Receive Data",
      "type": "n8n-nodes-base.webhook",
      "position": [
        112,
        848
      ]
    },
    {
      "id": "29a55404-f6ac-47e3-870c-e9d4edde4b9a",
      "name": "Set Default Rules",
      "type": "n8n-nodes-base.set",
      "position": [
        432,
        848
      ]
    },
    {
      "id": "38d23008-b445-4885-be49-c76b0478e877",
      "name": "Validate Data",
      "type": "n8n-nodes-base.code",
      "position": [
        752,
        848
      ]
    },
    {
      "id": "3506f389-3a17-43ad-aa6f-7a2b0774943e",
      "name": "Respond with Report",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1072,
        848
      ]
    }
  ],
  "connections": {
    "Receive Data": {
      "main": [
        [
          {
            "node": "Set Default Rules",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Data": {
      "main": [
        [
          {
            "node": "Respond with Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Default Rules": {
      "main": [
        [
          {
            "node": "Validate Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}