In-Memory KVS icon

In-Memory KVS

Store and retrieve data in memory with different scopes

Overview

This node provides an in-memory key-value store (KVS) with configurable scopes and operations to set, get, delete, or clear data. It is useful for temporarily storing data during workflow executions, sharing data across workflows within the same n8n instance, or persisting data across multiple executions of a single workflow.

Common scenarios include:

  • Caching API responses or intermediate results to avoid redundant calls.
  • Sharing state or flags between different parts of a workflow or between workflows.
  • Storing temporary data that only needs to exist during one execution.

For example, you could use this node to store a token retrieved from an authentication service and reuse it in subsequent nodes without fetching it again until it expires.

Properties

Name Meaning
Operation The action to perform: Set, Get, Delete, or Clear values in the key-value store.
Scope Where the data is stored:
- Workflow: persists across executions of the current workflow.
- Instance: shared across all workflows in the n8n instance.
- Execution: only available during the current workflow execution.
Key The identifier string for the value to set, get, or delete.
Value The value to assign to the key when setting. Supports JSON if enabled.
Parse Value as JSON Whether to parse the "Value" field as JSON before storing it.
TTL (Seconds) Time to live for the key in seconds; 0 means no expiration.
Default Value When getting a key, the value to return if the key does not exist. Supports JSON if enabled.
Parse Default Value as JSON Whether to parse the "Default Value" as JSON when getting a key.

Output

The node outputs the original input data merged with a kvsResult object containing the result of the operation:

  • For Set: { success: true, key: <key>, operation: "set" }
  • For Get: The value associated with the key or the default value if the key does not exist.
  • For Delete: { success: <boolean>, key: <key>, operation: "delete" }
  • For Clear: { success: true, operation: "clear", scope: <scope> }

The output is always under the json property of each item, appended alongside the original input data.

This node does not output binary data.

Dependencies

  • No external services or APIs are required.
  • Data is stored in memory using an internal singleton engine.
  • No special credentials or environment variables are needed.

Troubleshooting

  • Could not determine workflow ID / execution ID: This error occurs if the node cannot identify the current workflow or execution context, which is necessary for scoping data. Ensure the node is used within a valid workflow execution.
  • Invalid JSON: If "Parse Value as JSON" or "Parse Default Value as JSON" is enabled but the provided string is not valid JSON, the node will throw an error. Verify the JSON syntax in these fields.
  • Unsupported operation: If an operation other than set, get, delete, or clear is specified, the node will error out.
  • Data loss on restart: Since data is stored in memory, all stored values will be lost if the n8n instance restarts. Use persistent storage solutions if long-term data retention is needed.

Links and References

Discussion