> This page is for Server SDKs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# mintHandle

> Issue a signed handle that names a conversation.

[chatgateway]: /docs/server-sdks/reference/typescript/agents/chat-gateway

[readhandle]: /docs/server-sdks/reference/typescript/agents/chat-gateway/read-handle

Issues a signed handle for a conversation. The browser never names a conversation directly: if it
could, a publishable key and a guessed id would be enough to continue someone else's chat. With
signing, a caller can only present handles this gateway issued.

A handle is valid for `handleTtl` seconds and is signed with the gateway's `secret`.
[`readHandle()`][readhandle] verifies one and returns the conversation id.

## Parameters

**`conversationId`** `string`

The conversation to name. A new random id, prefixed `chat-`, when omitted or empty.

---

## Returns

`string` -- the handle.

## Examples

```typescript
import { ChatGateway } from '@signalwire/sdk';

const gateway = new ChatGateway({
  configUrl: 'https://bayview-taxi.example.com/dispatch',
  key: '<YOUR_PUBLISHABLE_KEY>',
  secret: process.env.SIGNALWIRE_CHAT_GATEWAY_SECRET,
});

const fresh = gateway.mintHandle();
const named = gateway.mintHandle('chat-8f21');

console.log(gateway.readHandle(fresh)); // chat-<random>
console.log(gateway.readHandle(named)); // chat-8f21
```