N8n API workflow creation - how to specify paths

Describe the problem/error/question

How can I specify the paths for “Loop over items” and “filter” nodes in the workflow payload using the n8n API to create a workflow? Here is a specific video of my question

Please share your workflow

The payload I am using in the workflow creation API call looks like this:

Information on your n8n setup

  • n8n version: 1.39.1
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hello @simo

you can see the sample payload if you create the workflow manually and copy the desired nodes to the notepad.

About the Loop node:
first array element in the connection - is the Done branch, and the second one - The Loop branch

{
"connections": {
    "Loop Over Items": {
      "main": [  // it always will be main
        [ // first element is for the Done branch
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ],
        [  // second element is for the Loop branch
          {
            "node": "get campaign analytics1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

About the IF node: it’s the same, but the first element is for the true branch, and the next one is for the false branch

{
  "connections": {
    "campaign exists in Notion1": {
      "main": [  // it always will be main
        [  // true branch
          {
            "node": "update campaign analytics",
            "type": "main",
            "index": 0
          }
        ],
        [  // false branch
          {
            "node": "create campaign analytics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
}
1 Like

Thank you very much once again @barn4k - I really appreciate it

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.