Skip to content
MoveWorkflows

n8n workflow JSON: a full example, explained

Updated 2026-10-21 · 6 min read

Check n8n workflow JSON before import
Runs in your browser. Nothing is uploaded.
In short
  • An n8n workflow is JSON. The API requires name, nodes, connections and settings.
  • Connections are keyed by node name. Rename a node and you must rename its references.
  • Nodes point to credentials by name and ID only. The secrets stay in the instance.
On this page · 10 sections
  1. What to do now
  2. A complete example
  3. Top-level keys
  4. Node objects
  5. Connections
  6. Credentials
  7. Settings
  8. pinData
  9. Validate before importing
  10. Generated JSON from Pipedream

Every n8n workflow is a JSON document. You see it when you Download a workflow, paste nodes between instances, call the public API or generate workflows with a script. A converter from another platform does exactly that last thing.

n8n doesn't publish a written spec of the format. The authoritative description is the workflow schema in the public API reference. This page walks through a real example and explains each part.

What to do now

  1. Build one node in the editor and copy its JSON. That gives you the right parameter names for its typeVersion.
  2. For the API, send only name, nodes, connections and settings. Strip read-only fields such as id and active.
  3. Check the table under "Validate before importing". It covers unknown node types, names in connections that don't match, and expressions without =.
  4. Re-create the credentials on the target instance. The JSON holds only their names and IDs.

A complete example

This workflow receives a webhook, checks an amount and responds:

{
  "name": "Order check",
  "nodes": [
    {
      "id": "3f1c0b8e-1a2b-4c3d-9e8f-000000000001",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [0, 0],
      "webhookId": "3f1c0b8e-1a2b-4c3d-9e8f-0000000000aa",
      "parameters": {
        "httpMethod": "POST",
        "path": "orders",
        "responseMode": "responseNode",
        "options": {}
      }
    },
    {
      "id": "3f1c0b8e-1a2b-4c3d-9e8f-000000000002",
      "name": "Big order?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [220, 0],
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": true, "typeValidation": "strict" },
          "conditions": [
            {
              "leftValue": "={{ $json.body.total }}",
              "rightValue": 1000,
              "operator": { "type": "number", "operation": "gt" }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "3f1c0b8e-1a2b-4c3d-9e8f-000000000003",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [440, 0],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { \"received\": true, \"total\": $('Webhook').first().json.body.total } }}",
        "options": {}
      }
    }
  ],
  "connections": {
    "Webhook": { "main": [[{ "node": "Big order?", "type": "main", "index": 0 }]] },
    "Big order?": {
      "main": [
        [{ "node": "Respond", "type": "main", "index": 0 }],
        [{ "node": "Respond", "type": "main", "index": 0 }]
      ]
    }
  },
  "settings": { "executionOrder": "v1" }
}

The parameter names inside each node depend on the node and its typeVersion. The easiest way to get them right: build the node once in the editor and copy its JSON. Select the node, press Ctrl/Cmd+C and paste into a text editor.

Top-level keys

From the API's workflow schema:

Key Required on create Meaning
name Yes Workflow name
nodes Yes Array of node objects
connections Yes How nodes are wired, keyed by the source node's name
settings Yes Execution settings (in practice can be {} for files)
id, versionId, active, createdAt, updatedAt No Read-only, set by n8n. Sending them to the API returns a 400
staticData No Workflow static data
pinData No Pinned test data per node
projectId, parentFolderId, description No Organization (writable on create)
tags, meta No Read-only on create. Tags are set through a separate endpoint
nodeGroups No Visual frames on the canvas

When you post to POST /api/v1/workflows, send only name, nodes, connections and settings, plus optional fields the schema accepts. A downloaded file has read-only fields. They can make the API reject the request, so strip them in your script.

Node objects

Field Meaning
id Unique ID (UUID) of the node within the workflow
name Display name, unique within the workflow. Used in connections and in $('Name')
type Node type, e.g. n8n-nodes-base.httpRequest, n8n-nodes-base.code, n8n-nodes-base.splitInBatches
typeVersion Version of that node's implementation. Parameters differ between versions
position [x, y] on the canvas
parameters The node's configuration. Expressions are strings that start with =
credentials { "<credentialType>": { "id": "…", "name": "…" } }
webhookId For nodes based on webhooks
disabled, notes, notesInFlow Editor flags and notes
retryOnFail, maxTries, waitBetweenTries, onError, alwaysOutputData, executeOnce The node's Settings tab

Two details people miss:

  • Expressions are stored with a leading =: "={{ $json.email }}". An expression is a value n8n computes at run time. Without the =, the value is a plain string with curly braces in it.
  • Node type names are camelCase in JSON (n8n-nodes-base.httpRequest, n8n-nodes-base.splitInBatches). The docs URLs use lowercase.

Connections

connections maps each source node name to its outputs:

"Big order?": {
  "main": [
    [ { "node": "Notify sales", "type": "main", "index": 0 } ],
    [ { "node": "Log", "type": "main", "index": 0 } ]
  ]
}
  • main is an array with one entry per output. For an If node, index 0 is true and index 1 is false. For a Switch node, there is one entry per route.
  • Each entry is an array of targets. One output can feed several nodes.
  • index on the target is the input number. A Merge node has inputs 0, 1, 2…
  • AI sub-nodes use other connection types instead of main, for example ai_languageModel.

Connections are keyed by name. So if you rename a node in the JSON, rename it in connections too, and in every expression that refers to it.

Credentials

A node that uses a credential stores only a reference:

"credentials": {
  "httpHeaderAuth": { "id": "12", "name": "Acme API key" }
}

Exported files include credential names and IDs, never secrets (export and import). On another instance the ID won't exist. Open the node and pick or create the credential. See n8n credentials.

Settings

These keys are common:

  • executionOrder: v1 for the current behavior;
  • timezone;
  • errorWorkflow: the ID of the error workflow;
  • saveDataErrorExecution and saveDataSuccessExecution: all, none or DEFAULT;
  • saveManualExecutions, saveExecutionProgress, executionTimeout;
  • callerPolicy: who may call this workflow as a sub-workflow.

They match the Workflow Settings dialog.

pinData

pinData is pinned test data, stored per node name:

"pinData": {
  "Webhook": [ { "json": { "body": { "total": 1200 } } } ]
}

It is useful in shared templates. During manual runs, n8n shows pinned data in place of the real output. Remove it if you don't want collaborators testing with old data.

Validate before importing

Problem Symptom Fix
Unknown type "Unrecognized node type" / a node with a question mark Use a type that exists on the target, or install the community node
Unsupported typeVersion The node opens with missing fields Use a version the target supports
A name in connections doesn't match a node Nodes are not connected after import Keep the names in sync
Duplicate node names The import fails or the wiring is wrong Make the names unique
Expression without = Literal {{ }} text in the output Add = in front
Read-only fields sent to the API 400 from POST /workflows Send only accepted fields

The import itself (editor, API and CLI) is covered in import workflow JSON into n8n.

Generated JSON from Pipedream

A Pipedream export is also JSON, but it has a different shape: triggers, steps and deployments instead of nodes and connections (Pipedream export; details in Pipedream export format).

A converter maps one shape onto the other:

  • each trigger becomes a trigger node;
  • each step becomes a node;
  • the step order becomes connections;
  • steps.x.$return_value references must resolve to the right node. You can rewrite them as $('x'), or provide a steps object in the code. Our converter does the second.

Our converter produces n8n workflow JSON in exactly the structure above. It keeps step names as node names, so references survive. It lists what it couldn't map. Steps inside branches are rebuilt where possible and always flagged for review. The Code node compatibility check shows how a single code step will look. The report and 1 workflow are free. Full export: $3 per workflow, $1 each after 50, $19 minimum, one-off.

Not affiliated with Pipedream or n8n.

FAQ

What fields does an n8n workflow JSON need?

To create a workflow through the n8n API, name, nodes, connections and settings are required. The editor's Import from File is more forgiving. But a file with those four keys imports everywhere.

How are connections stored in n8n workflow JSON?

As an object keyed by the source node's name. Each entry has a main array with one inner array per output. It lists the target node name, the type main and the input index.

Does n8n workflow JSON contain my credentials?

No. Nodes point to credentials by name and ID only. The secrets stay in the instance's credential store.

Can I generate n8n workflow JSON with a script?

Yes. Build the nodes and connections objects and POST them to /api/v1/workflows, or save them to a file and import it. The node type names and typeVersion must exist on the target instance.