# Set

### Overview

The **Set Storage Component** stores a key-value pair in a specified storage location, enabling structured data persistence within workflows.

### Usage

This component allows users to store data dynamically by assigning a value to a key in a designated storage space.

#### Input Ports

| Port | Description                               |
| ---- | ----------------------------------------- |
| `in` | Receives the key-value pair to be stored. |

#### Output Ports

| Port  | Description                                                          |
| ----- | -------------------------------------------------------------------- |
| `out` | Emits the stored key, old value (if any), new value, and timestamps. |

#### Properties

| Property  | Type     | Description                                                          |
| --------- | -------- | -------------------------------------------------------------------- |
| `storeId` | `string` | The ID of the storage space where the key-value pair will be stored. |

#### Processing Logic

1. **Receives Key-Value Pair**: Accepts an input with a key and its corresponding value.
2. **Stores Data**: Saves the key-value pair in the specified `storeId`.
3. **Handles Updates**:
   * If the key already exists, updates its value and retains the previous value.
   * If the key is new, creates a fresh entry.
4. **Emits Output**: Sends the key, old value, new value, and timestamps to the `out` port.

#### Output Data Schema

| Property    | Type     | Description                                              |
| ----------- | -------- | -------------------------------------------------------- |
| `key`       | `string` | The key associated with the stored value.                |
| `oldValue`  | `string` | The previous value (if the key existed).                 |
| `newValue`  | `string` | The newly stored value.                                  |
| `createdAt` | `string` | Timestamp when the key-value pair was initially created. |
| `updatedAt` | `string` | Timestamp when the key-value pair was last updated.      |

### Notes

* **Dynamic Data Storage**: Supports both new entries and updates to existing keys.
* **Efficient Workflow Integration**: Allows seamless data persistence for automation.
* **Timestamp Tracking**: Keeps track of creation and update times for data integrity.

This component is essential for workflows that require structured data storage and retrieval within automated processes.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.appmixer.com/connector-configuration/utils/storage/set.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
