# MessageId
Source: https://docs.maelstrom-ai.co/dev/reference/react/type-aliases/messageid/
Documentation revision: 89a8f5e9d10cedcf0b30376d7846113f06f26120
SDK manifests in this build: @maelstrom-co/react@0.2.1, @maelstrom-co/client@0.2.1, @maelstrom-co/connectors@0.2.1, @maelstrom-co/protocol@0.2.1, @maelstrom-co/engine@0.2.1
These docs follow this source revision. Manifest versions do not prove release compatibility; verify the installed package exports before using an API.

> **MessageId** = (`value?`) => `MessageId`

Defined in: packages/protocol/dist/lib/message.d.ts:15

Creates or brands a MessageId. Smart constructor — same pattern as SessionId.

-   Called with no arguments: generates a new unique Nano ID (no prefix).
-   Called with an existing string: brands it as a MessageId without changing its value. Use this when rehydrating from serialized data.

## Parameters

### value?

`string`

## Returns

`MessageId`

## Example

```ts
const fresh = MessageId();          // new Nano ID
const echoed = MessageId(input.id); // brands an existing id
```
