Create a Workflow by n8n public REST API

I’m trying to create a workflow using the n8n public REST API. I followed the steps in the documentation (API reference | n8n Docs). The request succeeds, but the workflow appears empty—no nodes are visible. Is there a command or setting to make the nodes show up (or to activate them)?

Hey @Denis_Ramon_Peixoto hope all is well and welcome to the community.

Could it be that the nodes are just off the screen? Have you tried to zoom out and see if anything is just hiding from you? Alternatively some of the content on the screen is blocked by some extension, maybe? Try in a different browser, or in the incognito mode (in case your extensions do not run in the incognito mode).

Hi jabbson

I tried other browsers but the same thing happens. Looking more closely at the screen, I noticed that the zoom buttons don’t appear in the workflow created via the n8n public REST API, while workflows created directly in n8n look normal. Could this be a bug? When creating a workflow through the n8n public REST API, do we need to send some additional setting to enable node visualization?

This is exactly why I mentioned that there could be an issue with an extension blocking a part of the up, I’ve noticed that too.

So this only happens to the workflows which were created with an api, but those created manually look ok?

Did you try to import a workflow which was just exported (meaning same version, same everything)?

Could you share one such workflow, so that I could try to create it with an api and see if that process works for me?

Hi Jabbson,

When exporting and importing a normal workflow using the standard method, it works fine. However, when I try to import a .json file of any workflow into a workflow that was created via the API, I get the following error:

Problem importing workflow

number 0 is not iterable (cannot read property Symbol(Symbol.iterator))

The workflow that does not appear is exactly the example from the documentation: //docs.n8n.io/api/api-reference/#tag/Workflow.

{
“name”: “Workflow 1”,
“nodes”: [
{
“id”: “0f5532f9-36ba-4bef-86c7-30d607400b15”,
“name”: “Jira”,
“webhookId”: “string”,
“disabled”: true,
“notesInFlow”: true,
“notes”: “string”,
“type”: “n8n-nodes-base.Jira”,
“typeVersion”: 1,
“executeOnce”: false,
“alwaysOutputData”: false,
“retryOnFail”: false,
“maxTries”: 0,
“waitBetweenTries”: 0,
“continueOnFail”: false,
“onError”: “stopWorkflow”,
“position”: [
-100,
80
],
“parameters”: {
“additionalProperties”: {}
},
“credentials”: {
“jiraSoftwareCloudApi”: {
“id”: “35”,
“name”: “jiraApi”
}
}
}
],
“connections”: {
“main”: [
{
“node”: “Jira”,
“type”: “main”,
“index”: 0
}
]
},
“settings”: {
“saveExecutionProgress”: true,
“saveManualExecutions”: true,
“saveDataErrorExecution”: “all”,
“saveDataSuccessExecution”: “all”,
“executionTimeout”: 3600,
“errorWorkflow”: “VzqKEW0ShTXA5vPj”,
“timezone”: “America/New_York”,
“executionOrder”: “v1”
},
“staticData”: {
“lastId”: 1
}
}

Hi Jabbson,

When exporting and importing a normal workflow using the standard method, it works fine. However, when I try to import a .json file of any workflow into a workflow that was created via the API, I get the following error:

Problem importing workflow

number 0 is not iterable (cannot read property Symbol(Symbol.iterator))

The workflow that does not appear is exactly the example from the documentation

{
“name”: “Workflow 1”,
“nodes”: [
{
“id”: “0f5532f9-36ba-4bef-86c7-30d607400b15”,
“name”: “Jira”,
“webhookId”: “string”,
“disabled”: true,
“notesInFlow”: true,
“notes”: “string”,
“type”: “n8n-nodes-base.Jira”,
“typeVersion”: 1,
“executeOnce”: false,
“alwaysOutputData”: false,
“retryOnFail”: false,
“maxTries”: 0,
“waitBetweenTries”: 0,
“continueOnFail”: false,
“onError”: “stopWorkflow”,
“position”: [
-100,
80
],
“parameters”: {
“additionalProperties”: {}
},
“credentials”: {
“jiraSoftwareCloudApi”: {
“id”: “35”,
“name”: “jiraApi”
}
}
}
],
“connections”: {
“main”: [
{
“node”: “Jira”,
“type”: “main”,
“index”: 0
}
]
},
“settings”: {
“saveExecutionProgress”: true,
“saveManualExecutions”: true,
“saveDataErrorExecution”: “all”,
“saveDataSuccessExecution”: “all”,
“executionTimeout”: 3600,
“errorWorkflow”: “VzqKEW0ShTXA5vPj”,
“timezone”: “America/New_York”,
“executionOrder”: “v1”
},
“staticData”: {
“lastId”: 1
}
}

I have had issues importing a workflow that was created by AI. It seemed valid and imported OK, but the nodes were not valid.

Try creating the same workflow manually, export that, and compare to an export of the ‘problem’ workflow. I suspect something in the api request isn’t correct, and it is making elements of the workflow invalid. It only takes one misplaced character to make things go wrong.

In this specific case what appears to be the problem is this portion of the workflow json:

There is only a single node in the workflow, so there cannot be any connections, if you take this part out, the workflow starts to import and paste just fine.

When I look at a workflow template I have, it seems like that block is different. The ‘main’ should be enclosed in a parent json block that describes the output node, and main looks like it should contain a nested array. When I create a simple workflow with only one node, it looks the same. I suspect the json payload you are using isn’t valid.

This is with a single node and no connections:

“pinData”: {},
“connections”: {},
“active”: false,

You seem to be creating a connection without a source. A single node without a trigger can’t run, so whether it is valid or not, it’s not a useful workflow without some kind of trigger and connection between the trigger and a node.

Hi jabbson,

I take off this part of code and now is showing de canvas

rhyswynn,

Do you have any documentation that have the syntax to create any node by API? I found just this code exemple with Jira node…

Is this what you expect to see?

Yes!

Now I know that I’m in the right way.

I would like to create a complete workflow. but I dont kow the node syntax/framework to create a complete workflow like this.

Do you know where can I find a documentation for all nodes?

I mean the documentation with correct syntax to create each node by API rest using JSON framework. Like this:

{
“name”: “Workflow 1”,
“nodes”: [
{
“id”: “0f5532f9-36ba-4bef-86c7-30d607400b15”,
“name”: “Jira”,
“webhookId”: “string”,
“disabled”: true,
“notesInFlow”: true,
“notes”: “string”,
“type”: “n8n-nodes-base.Jira”,
“typeVersion”: 1,
“executeOnce”: false,
“alwaysOutputData”: false,
“retryOnFail”: false,
“maxTries”: 0,
“waitBetweenTries”: 0,
“continueOnFail”: false,
“onError”: “stopWorkflow”,
“position”: [
-100,
80
],
“parameters”: {
“additionalProperties”: {}
},
“credentials”: {
“jiraSoftwareCloudApi”: {
“id”: “35”,
“name”: “jiraApi”
}
}
}
],
“connections”: {
“main”: [
{
“node”: “Jira”,
“type”: “main”,
“index”: 0
}
]
},
“settings”: {
“saveExecutionProgress”: true,
“saveManualExecutions”: true,
“saveDataErrorExecution”: “all”,
“saveDataSuccessExecution”: “all”,
“executionTimeout”: 3600,
“errorWorkflow”: “VzqKEW0ShTXA5vPj”,
“timezone”: “America/New_York”,
“executionOrder”: “v1”
},
“staticData”: {
“lastId”: 1
}
}

Thats the only resource i can find that seems to have a way to generate the node schema

Thank you!

I have n8n running in a k3s cluster. I added the n8n mcp and it looks very comprehensive. Be aware that the way the tool-enabled AI nodes work, they will duplicate context details when making multiple calls to tools. And, some of the output of these mcp tools can be large. Be cautious when using this one in n8n to avoid unexpected token throttling.