Skip to main content

Overview

The Code node runs your JavaScript on the server in an isolated sandbox. Use it for deterministic transformations that would be awkward or unreliable with an LLM: parsing, filtering, math, reshaping JSON.

How it works

Your code is the body of a function:
  • Inputs arrive on a params object.
  • return a value to produce the node’s output. It must be JSON-serializable.

Params

Under Params, add keys and set each value to a literal or a / reference to an earlier node’s output. Inside your code, read them as params.<key>.

Result schema

Optionally describe the returned value’s shape under Result Schema so later nodes can reference its individual fields. Leave it as-is to keep the output an untyped object.

Example

With params orders (referencing an HTTP node’s response) and minTotal set to 100:

Limits

Debugging tips

  • Click Run in the workflow editor, enter test inputs, and open each node’s result to inspect what it received and returned.
  • Throw an Error with a clear message when input isn’t what you expect; the workflow stops and shows it.