---
title: "Reference: Memory.getThreadById() | Memory"
description: "Documentation for the `Memory.getThreadById()` method in Mastra, which retrieves a specific thread by its ID."
packages:
  - "@mastra/memory"
---

# 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.",
    },
  ]}
/>

### Related

- [Memory Class Reference](/reference/v1/memory/memory-class)
- [Getting Started with Memory](/docs/v1/memory/overview) (Covers threads concept)
- [createThread](/reference/v1/memory/createThread)
- [listThreadsByResourceId](/reference/v1/memory/listThreadsByResourceId)
