> ## Documentation Index
> Fetch the complete documentation index at: https://intunedhq.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# persistentStore

```typescript theme={null}
import { persistentStore } from '@intuned/runtime';

persistentStore: PersistentStore
```

A persistent key-value store that maintains data across different API executions. This allows you to share data between different runs of your Projects.

**Constraints:**

* Keys must be at least 1 character long.
* Keys cannot contain `:` (colon) or `#` (hash) characters.
* Data stored must be JSON-serializable.

## `PersistentStore`

```typescript theme={null}
interface PersistentStore {
  get(key: string): Promise<any>;
  set(key: string, value: any): Promise<void>;
}
```

## Method reference

### get

```typescript theme={null}
get(key: string): Promise<any>
```

Retrieve a value from the persistent store.

**Parameters**

<ParamField body="key" type="string" required>
  The key to retrieve the value for. Must be at least 1 character long and cannot contain `:` or `#` characters.
</ParamField>

**Returns**

Returns a Promise that resolves to the value associated with the key, or `undefined` if not found.

**Throws**

* `ZodError` — Thrown if the key is invalid (empty or contains forbidden characters).

### set

```typescript theme={null}
set(key: string, value: any): Promise<void>
```

Store a value in the persistent store.

**Parameters**

<ParamField body="key" type="string" required>
  The key to set the value for. Must be at least 1 character long and cannot contain `:` or `#` characters.
</ParamField>

<ParamField body="value" type="any" required>
  The value to store. Can be any JSON-serializable type (object, array, string, number, boolean, null).
</ParamField>

**Returns**

Returns a Promise that resolves when the value is successfully stored.

**Throws**

* `ZodError` — Thrown if the key is invalid (empty or contains forbidden characters).

## Related

* [KV cache recipe](/main/01-learn/recipes/kv-cache) — Examples and patterns for using key-value stores.
* [attemptStore](/main/05-references/runtime-sdk-typescript/attempt-store) — Store data scoped to the current attempt.
