> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galtea.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Dataset

> Update the name, metadata or specifications of an existing dataset

> [!WARNING]
>
> You are reading the docs of Galtea 5.13. [Read this page in the latest version](https://docs.galtea.ai/sdk/api/dataset/update.md).

## Overview

The `update()` method allows you to modify an existing dataset after it has been created.

> [!WARNING]
>
> Only `name`, `metadata` and `specification_ids` are mutable post-creation. All other fields
> (`type`, `variants`, `strategies`, `uri`, `ground_truth_uri`,
> `data_catalog_uri`, `source_test_id`, `max_test_cases`, etc.) are fixed
> for the lifetime of the dataset because they drive generation, credit
> accounting, and the stored test-case shape. Sending any of them in an
> update returns a `400`.

## Parameters

**dataset\_id** `string` *required*

The ID of the dataset to update.

> [!NOTE]
>
> Deprecated alias: `test_id`.

**name** `string`

New dataset name. Must be a non-empty string; leading and trailing whitespace are trimmed server-side.

**metadata** `Any`

Arbitrary JSON-serializable metadata for tracking purposes. Replaces the existing metadata wholesale. Pass `None` to clear.

**specification\_ids** `list[string]`

The full list of [Specifications](https://docs.galtea.ai/v5.13/concepts/product/specification.md) the dataset links to. It replaces the current links: a specification left out of the list is unlinked, and `[]` removes every link. Each specification must belong to the dataset's product and generate the dataset's type. To add or remove links without sending the full list, use [Link Datasets](https://docs.galtea.ai/v5.13/sdk/api/specification/link-datasets.md) and [Unlink Datasets](https://docs.galtea.ai/v5.13/sdk/api/specification/unlink-datasets.md).

## Returns

Returns the updated `Dataset` object.

## Example

```python theme={"system"}
renamed = galtea.datasets.update(
    dataset_id=dataset.id,
    name=f"renamed-test-{run_identifier}",
)
```

## Use Cases

### Replacing Metadata

Overwrite the metadata object on an existing dataset:

```python theme={"system"}
with_new_metadata = galtea.datasets.update(
    dataset_id=dataset.id,
    metadata={"owner": "platform-team", "ticket": "QA-200", "priority": "high"},
)
```

### Updating Name and Metadata Together

```python theme={"system"}
updated = galtea.datasets.update(
    dataset_id=dataset.id,
    name=f"final-test-{run_identifier}",
    metadata={"owner": "platform-team", "archived": True},
)
```

### Replacing the Linked Specifications

```python theme={"system"}
# The list replaces the dataset's links: pass every specification it should keep.
linked = galtea.datasets.update(
    dataset_id=dataset.id,
    specification_ids=[toxicity_policy.id, misuse_policy.id],
)
```

## Notes

> [!NOTE]
>
> All fields except `dataset_id` default to `PydanticUndefined` (from `pydantic_core`).
> Omit a field (or pass `PydanticUndefined`) to leave it unchanged.
> Pass `None` to explicitly clear an optional field (`specification_ids` takes `[]` instead).
> Pass a value to update it.

## Related Methods

* [Create Dataset](https://docs.galtea.ai/v5.13/sdk/api/dataset/create.md) - Create a new dataset
* [Get Dataset](https://docs.galtea.ai/v5.13/sdk/api/dataset/get.md) - Retrieve a dataset by ID
* [List Datasets](https://docs.galtea.ai/v5.13/sdk/api/dataset/list.md) - List datasets for a product
* [Delete Dataset](https://docs.galtea.ai/v5.13/sdk/api/dataset/delete.md) - Soft-delete a dataset
* [Link Datasets](https://docs.galtea.ai/v5.13/sdk/api/specification/link-datasets.md) - Attach an existing dataset to a specification
* [Unlink Datasets](https://docs.galtea.ai/v5.13/sdk/api/specification/unlink-datasets.md) - Detach a dataset from a specification


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.