# dataset.getItemHistory()

**Added in:** `@mastra/core@1.4.0`

Retrieves the full SCD-2 (Slowly Changing Dimension Type 2) history of a specific item across all dataset versions.

## Usage example

```typescript
import { Mastra } from '@mastra/core'

const mastra = new Mastra({
  /* storage config */
})

const dataset = await mastra.datasets.get({ id: 'dataset-id' })

const history = await dataset.getItemHistory({ itemId: 'item-id' })

for (const row of history) {
  console.log(`Version ${row.datasetVersion}: ${row.isDeleted ? 'deleted' : 'active'}`)
}
```

## Parameters

**itemId** (`string`): ID of the item to retrieve history for.

## Returns

**result** (`Promise<DatasetItemRow[]>`): Array of versioned item rows, ordered by version.

**result.id** (`string`): Unique row identifier.

**result.datasetId** (`string`): ID of the parent dataset.

**result.datasetVersion** (`number`): Dataset version for this row.

**result.validTo** (`number | null`): Version at which this row was superseded, or \`null\` if still current.

**result.isDeleted** (`boolean`): Whether this row represents a deletion.

**result.input** (`unknown`): Input data at this version.

**result.groundTruth** (`unknown`): Ground truth at this version.

**result.metadata** (`Record<string, unknown>`): Metadata at this version.

**result.createdAt** (`Date`): When this row was created.

**result.updatedAt** (`Date`): When this row was last updated.