***

title: createSession
slug: /reference/typescript/agents/configuration/session-manager/create-session
description: Return the given call ID or generate a new random session identifier.
max-toc-depth: 3
---------------------

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

Return the given `callId` if provided, or generate a new random session
identifier using `base64url`-encoded random bytes.

## **Parameters**

<ParamField path="callId" type="string" toc={true}>
  Existing call ID to reuse. If omitted, a new random ID is generated.
</ParamField>

## **Returns**

`string` -- The call ID string.

## **Example**

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

const sm = new SessionManager();
const id1 = sm.createSession('call-abc123'); // "call-abc123"
const id2 = sm.createSession();              // random base64url ID
```