***

title: setSessionMetadata
slug: /reference/typescript/agents/configuration/session-manager/set-session-metadata
description: Merge metadata into a session.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

Merge metadata into a session, creating the entry if it does not exist.
Automatically triggers cleanup when the metadata map exceeds 1000 entries.

## **Parameters**

<ParamField path="sessionId" type="string" required={true} toc={true}>
  The session identifier.
</ParamField>

<ParamField path="metadata" type="Record<string, unknown>" required={true} toc={true}>
  Key-value pairs to merge into the session metadata.
</ParamField>

## **Returns**

`void`

## **Example**

```typescript {4-5}
import { SessionManager } from '@signalwire/sdk';

const sm = new SessionManager();
sm.setSessionMetadata('session-1', { caller: 'John' });
sm.setSessionMetadata('session-1', { topic: 'billing' });
// Metadata is now { caller: "John", topic: "billing" }
```