Back to Mastra

Reference: Memory.getThreadById() | Memory

docs/src/content/en/reference/memory/getThreadById.mdx

2025-12-18855 B
Original Source

Memory.getThreadById()

The .getThreadById() method retrieves a specific thread by its ID.

Usage example

typescript
await memory?.getThreadById({ threadId: 'thread-123' })

Parameters

<PropertiesTable content={[ { name: 'threadId', type: 'string', description: 'The ID of the thread to be retrieved.', isOptional: false, }, ]} />

Returns

<PropertiesTable content={[ { name: 'thread', type: 'Promise<StorageThreadType | null>', description: 'A promise that resolves to the thread associated with the given ID, or null if not found.', }, ]} />