Code Node¶
The Code Node runs custom Python or JavaScript on workflow data. Use it for transformations or integrations that the built-in nodes do not cover, and pass its result to later nodes through output.
- Category: Processing
- Purpose: Runs custom Python or JavaScript. The escape hatch for work no built-in node covers
- Inputs:
input- Available inside the code asnode_data - Outputs:
output- Result of the execution - Configuration:
- Programming Language:
pythonorjavascript. Defaultpython - Code: Monaco editor, up to 50000 characters. Reach other nodes with
${{node_name}}; use${{node_name|tojson}}when the value may contain quotes or line breaks - Timeout (seconds): 1–300, default 30. Stops runaway code from blocking the workflow
- Continue on Error: Default off. Enable only when the code is non-critical, since downstream nodes will otherwise receive empty data
- Enable Code Validation: Default on. Screens the code for dangerous operations before running it
- Sandbox: Code runs inside a restricted sandbox. Only whitelisted modules can be imported.
- Python:
json,math,random,re,datetime,time,itertools,collections,functools,operator,string,decimal,fractions,statistics,base64,hashlib,hmac,secrets,uuid,urllib.parse,html,xml.etree.ElementTree,csv - JavaScript:
crypto,util,url,querystring,path,os - Relative imports are rejected. Importing anything outside the list raises
Import of 'x' is not allowed - Standard exceptions, OS errors, and warnings are available, so code can raise and handle errors normally
- Usage: Running the default
print(node_data)first shows the exact shape of the incoming data, which makes the real code much easier to write.