Globals

Read and update persistent globals across workflows

Overview

This node manages persistent global data storage across workflows in n8n. It allows users to store, retrieve, increment, delete, and list key-value pairs in a persistent manner. The data can be stored either in a JSON file on disk or within the static data of the current workflow or node.

Common scenarios where this node is beneficial include:

  • Keeping counters or stateful values that persist between workflow executions.
  • Sharing configuration or state information across multiple workflow runs.
  • Storing flags or toggles that influence workflow behavior over time.
  • Maintaining simple caches or temporary data without external databases.

Practical examples:

  • Incrementing a usage counter each time a workflow runs.
  • Saving an API token or session ID for reuse in subsequent workflow executions.
  • Deleting obsolete keys from persistent storage when no longer needed.
  • Listing all stored keys and values for debugging or monitoring purposes.

Properties

Name Meaning
Storage Where to keep persistent data. Options: File (JSON file on disk), Node (node static data), Workflow (workflow static data).
Key The key name used to identify the stored value. Required for operations except list.
Value Type The type of the value to set. Options: String, Number, Boolean, JSON. Used only with the set operation.
Value The actual value to store, as a string. Can represent JSON, number, boolean, or string depending on Value Type. Used only with the set operation.
Store File Path Optional path to the JSON file used to persist globals when Storage is set to File. Defaults to the user’s n8n folder path.

Output

The node outputs an array of items, each containing a json object with the following structure depending on the operation:

  • For get:
    {
      "key": "<requested_key>",
      "value": <stored_value_or_null>
    }
    
  • For set:
    {
      "key": "<set_key>",
      "value": <stored_value>
    }
    
  • For increment:
    {
      "key": "<incremented_key>",
      "value": <new_numeric_value>
    }
    
  • For delete:
    {
      "key": "<deleted_key>",
      "deleted": <true_if_deleted_else_false>
    }
    
  • For list:
    Outputs the entire stored data object as JSON.

The node does not output binary data.

Dependencies

  • Requires access to the filesystem if using File storage mode, with appropriate read/write permissions.
  • Uses the n8n workflow or node static data stores if Workflow or Node storage modes are selected; these require an active workflow context (not manual runs).
  • No external APIs or services are required.
  • Environment variable N8N_USER_FOLDER can override the default storage path for the JSON file.

Troubleshooting

  • Missing Key Error: If the Key property is empty for operations that require it (get, set, increment, delete), the node will throw an error indicating the key is required.
  • Invalid Value Type: When setting a value, if the input cannot be parsed into the specified Value Type (e.g., invalid JSON, non-numeric string for number type), an error will be thrown.
  • Increment on Non-number: Attempting to increment a key whose current value is not a number results in an error.
  • File Permission Issues: Using File storage requires write access to the specified file path. Lack of permission or invalid paths may cause failures.
  • Static Data Usage: Using Node or Workflow storage requires an active workflow execution context; running manually may not work as expected.
  • Data Persistence Delay: When using static data storage, changes are flagged internally and persisted by n8n; immediate file writes happen only in File mode.

To resolve errors:

  • Ensure the Key is provided.
  • Validate the Value matches the chosen Value Type.
  • Check file system permissions and paths.
  • Use the node within an active workflow run when using static data storage.

Links and References

Discussion