> For the complete documentation index, see [llms.txt](https://docs.omics.ai/products/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.omics.ai/products/command-line-interface/reference/workbench/samples-attributes-set.md).

# samples attributes set

Replace a sample's custom attributes

## Synopsis

```shell
omics workbench samples attributes set SAMPLE_ID (JSON | @FILE | -)
  [--namespace=STRING]
```

## Description

Replace one sample's custom attributes. The attributes can be given as a JSON literal, read from a file with `@`, or read from standard input with `-`.

{% hint style="warning" %}
This replaces the whole set. Attributes the document omits are deleted, so include everything you want to keep. There is no per-key update.
{% endhint %}

### The document shape

This command takes the attributes **on their own**, because the sample is already named by `SAMPLE_ID`:

```json
{"kit_lot": "A7-2291", "passed_qc": true}
```

That is not the same shape as the bulk upload document, which is keyed by sample ID. Passing a `*.attributes.json` file here is rejected with a pointer to the bulk command, because that document would otherwise be stored nested under a single sample.

To set attributes on many samples at once, use [samples metadata upload](/products/command-line-interface/reference/workbench/samples-metadata-upload.md) with a file named `*.attributes.json`.

## Examples

Set attributes from a JSON literal:

```shell
omics workbench samples attributes set HG002 '{"kit_lot": "A7-2291", "passed_qc": true}'
```

Set attributes from a file, using the `@` prefix:

```shell
omics workbench samples attributes set HG002 @bag.json
```

Set attributes from standard input:

```shell
cat bag.json | omics workbench samples attributes set HG002 -
```

Add an attribute to a sample that already has some, by reading the current set first:

```shell
omics workbench samples attributes get HG002 \
  | jq '. + {"run_id": "R-42"}' \
  | omics workbench samples attributes set HG002 -
```

## Positional Arguments

### `SAMPLE_ID`

The ID of the sample. Sample IDs can be retrieved from the [samples list](/products/command-line-interface/reference/workbench/samples-list.md) command.

### `JSON` | `@FILE` | `-`

The attributes to store, as a JSON object. The `@` prefix is required to read from a file; a bare path is rejected. Use `-` to read the document from standard input.

## Flags

### `--namespace`=`STRING`

An optional flag to define the namespace to connect to. By default, the namespace is extracted from the user's credentials.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.omics.ai/products/command-line-interface/reference/workbench/samples-attributes-set.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
