# uip tm objectlabel

> Syntax and options for `uip tm objectlabel`, which manages labels attached to Test Manager objects such as test cases and requirements.

`uip tm objectlabel` manages labels attached to Test Manager objects (requirements, test cases, test sets, test executions, and test case logs). Labels are free-form strings used to tag and group objects for filtering and search.

:::important
Every verb in this group needs a project (`--project-id` or `--project-key`) and `--object-type`, including `get`. `list`, `add`, and `remove` take the plural, space-separated `--object-ids`; `get` takes a single `--object-id`. `--labels` is plural; there is no `--label` flag.
:::

## Synopsis

```text
uip tm objectlabel list (--project-id <id> | --project-key <key>) --object-type <type> [--object-ids <uuid...>] [--label-types <types...>] [--filter <text>] [--sort-by <expr>] [--limit <n>] [--offset <n>]
uip tm objectlabel get (--project-id <id> | --project-key <key>) --object-type <type> --object-id <uuid>
uip tm objectlabel add (--project-id <id> | --project-key <key>) --object-type <type> --object-ids <uuid...> --labels <name...> [--label-type <type>] [--remove-other-labels]
uip tm objectlabel remove (--project-id <id> | --project-key <key>) --object-type <type> --object-ids <uuid...> (--labels <name...> | --remove-all-labels) --yes
```

All verbs honor the [global options](./global-options.md) and the standard [exit codes](./exit-codes.md). Every verb also accepts `-t, --tenant <name>` to run against a tenant other than the one your [`uip login`](./uip-login.md) session selected. It defaults to the session's tenant.

When you pass both `--project-id` and `--project-key`, `--project-id` wins. If you pass neither, the command fails with `ErrorCode: invalid_argument`.

`--object-type` accepts `Requirement`, `TestCase`, `TestSet`, `TestExecution`, or `TestCaseLog`. `--label-types` on `list` accepts the wire-form values `userLabel`, `systemLabel`, `internalLabel`, and `generatedLabel`; `--label-type` on `add` accepts only `userLabel`. The values match in any letter case, so `UserLabel`, as the output prints it, is also accepted.

## uip tm objectlabel list

List distinct label names in use for one object type (paginated). This does not return label assignment rows — use `get` for the labels on one object.

### Arguments

None.

### Options

- `--project-id <id>` — Test Manager project ID. Wins if `--project-key` is also given.
- `--project-key <key>` — Test Manager project key (for example, `DEMO`). Ignored if `--project-id` is also given.
- `--object-type <type>` *(required)* — object type to list labels for.
- `--object-ids <uuid...>` — restrict to labels assigned to these objects (space-separated). Omit to search across the whole object type.
- `--label-types <type...>` — label types to include (`userLabel`, `systemLabel`, `internalLabel`, `generatedLabel`, space-separated). The server always returns `systemLabel`, `userLabel`, and `generatedLabel` names and adds the types passed here, so this flag widens the result rather than narrowing it.
- `--filter <text>` — prefix to match label names against (server-side `StartsWith`, not a general substring search).
- `--sort-by <expr>` — sort expression, for example `name asc`.
- `--limit <n>` — page size. Defaults to `50`.
- `--offset <n>` — results to skip. Defaults to `0`.

### Example

```bash
uip tm objectlabel list \
  --project-key DEMO \
  --object-type TestCase \
  --filter smo \
  --limit 50
```

### Data shape

```json
{
  "Code": "ObjectLabelsList",
  "Data": [
    { "Name": "smoke" },
    { "Name": "smoke-test" }
  ]
}
```

Each row is only `{ "Name": "<label>" }` — `list` returns no `Id`, `ObjectId`, or `LabelType`. To see the labels on one object with their ids and label types, use `objectlabel get`.

## uip tm objectlabel get

Get the visible labels on one object — user, system, and generated labels — including label ids and label types. Internal labels are not returned. `list` returns distinct label names for an object type; `get` returns the full assignment rows for a single object.

### Arguments

None.

### Options

- `--project-id <id>` — Test Manager project ID. Wins if `--project-key` is also given.
- `--project-key <key>` — Test Manager project key (for example, `DEMO`). Ignored if `--project-id` is also given.
- `--object-type <type>` *(required)* — object type the label belongs to.
- `--object-id <uuid>` *(required)* — object UUID, for example the `Id` from [`uip tm testcases list`](./uip-test-manager-testcases.md) (or the list verb matching `--object-type`).

### Example

```bash
uip tm objectlabel get \
  --project-key DEMO \
  --object-type TestCase \
  --object-id f9e8d7c6-0000-0000-0000-000000000001
```

### Data shape

```json
{
  "Code": "ObjectLabelGet",
  "Data": [
    {
      "Id": "a1b2c3d4-0000-0000-0000-000000000001",
      "ProjectId": "a1b2c3d4-0000-0000-0000-000000000009",
      "ObjectId": "f9e8d7c6-0000-0000-0000-000000000001",
      "ObjectType": "TestCase",
      "Name": "smoke",
      "Description": "",
      "LabelType": "UserLabel"
    }
  ]
}
```

`Data` is an array with one row per label on the object, and an empty array when the object has no visible labels. `LabelType` is PascalCase (`UserLabel`, `SystemLabel`, `GeneratedLabel`); the `--label-type` and `--label-types` input flags accept either spelling.

## uip tm objectlabel add

Add labels to one or more objects. Two distinct behaviors depending on whether `--label-type` is passed:

- Without `--label-type` (default): a single bulk-add call across all objects and labels. Pass `--remove-other-labels` to make this an authoritative set — after adding, any non-system labels on these objects that are not in `--labels` are deleted.
- With `--label-type userLabel`: each label is assigned individually (one call per object × label pair). `--remove-other-labels` is ignored in this mode.

### Arguments

None.

### Options

- `--project-id <id>` — Test Manager project ID. Wins if `--project-key` is also given.
- `--project-key <key>` — Test Manager project key (for example, `DEMO`). Ignored if `--project-id` is also given.
- `--object-type <type>` *(required)* — object type.
- `--object-ids <uuid...>` *(required)* — space-separated object UUIDs to apply the labels to.
- `--labels <name...>` *(required)* — space-separated label names to add.
- `--label-type <type>` — label type. Only `userLabel` is accepted: `objectlabel remove` cannot detach a system label, so the CLI writes user labels only. When set, switches to the per-pair assign path described above.
- `--remove-other-labels` — after adding, delete any non-system labels on these objects not present in `--labels`. Ignored when `--label-type` is set.

### Examples

```bash
# Bulk add — multiple labels to multiple objects in one call
uip tm objectlabel add \
  --project-key DEMO \
  --object-type TestCase \
  --object-ids a1b2c3d4-0000-0000-0000-000000000001 a1b2c3d4-0000-0000-0000-000000000002 \
  --labels smoke regression

# With an explicit label type — assigns each label individually
uip tm objectlabel add \
  --project-key DEMO \
  --object-type TestCase \
  --object-ids a1b2c3d4-0000-0000-0000-000000000001 a1b2c3d4-0000-0000-0000-000000000002 \
  --labels smoke \
  --label-type userLabel
```

### Data shape

```json
{
  "Code": "ObjectLabelsAdd",
  "Data": {
    "ObjectCount": 2,
    "LabelCount": 2,
    "Result": "Added"
  }
}
```

`LabelCount` counts distinct label names, case-insensitively. When `--label-type` is passed, the response includes it:

```json
{
  "Code": "ObjectLabelsAdd",
  "Data": {
    "ObjectCount": 2,
    "LabelCount": 1,
    "LabelType": "userLabel",
    "Result": "Added"
  }
}
```

## uip tm objectlabel remove

Remove user and generated labels from up to 100 objects. Pass `--labels` to remove specific labels, or `--remove-all-labels` to remove every user and generated label on the listed objects; the two are mutually exclusive, and one is required. Names match case-insensitively. The removal is irreversible and requires `-y, --yes`.

- System labels are never removed. Matching system label names are reported in `SkippedSystemLabels`.
- Internal label names, and names of label types the CLI doesn't recognize, are never sent. With `--labels`, requested internal names are reported in `SkippedInternalLabels`; with `--remove-all-labels`, user or generated labels that share a name with an internal label are kept and reported there.
- `remove` reads the objects' labels before writing — at least two read requests per object, five objects at a time — so it needs read access to the listed objects. If the labels can't be read, or an object carries 500 or more label names, nothing is removed.
- If a removal request fails partway through, the error message lists the labels already removed.

### Arguments

None.

### Options

- `--project-id <id>` — Test Manager project ID. Wins if `--project-key` is also given.
- `--project-key <key>` — Test Manager project key (for example, `DEMO`). Ignored if `--project-id` is also given.
- `--object-type <type>` *(required)* — object type.
- `--object-ids <uuid...>` *(required)* — space-separated object UUIDs. At most 100 distinct ids per call; duplicates are ignored.
- `--labels <name...>` — space-separated label names to remove. Required unless `--remove-all-labels` is set.
- `--remove-all-labels` — remove the user and generated labels on the listed objects, except any that share a name with an internal label. System and internal labels are kept, unlike clear-all in the Test Manager UI. Mutually exclusive with `--labels`.
- `-y, --yes` *(required)* — confirms the irreversible operation. The CLI never prompts; without `--yes` the command returns `Result: "Failure"` and exits `1`.

### Examples

```bash
# remove specific labels
uip tm objectlabel remove \
  --project-key DEMO \
  --object-type TestCase \
  --object-ids a1b2c3d4-0000-0000-0000-000000000001 a1b2c3d4-0000-0000-0000-000000000002 \
  --labels regression \
  --yes

# remove every user and generated label
uip tm objectlabel remove \
  --project-key DEMO \
  --object-type TestCase \
  --object-ids a1b2c3d4-0000-0000-0000-000000000001 a1b2c3d4-0000-0000-0000-000000000002 \
  --remove-all-labels \
  --yes
```

### Data shape

```json
{
  "Code": "ObjectLabelsRemove",
  "Data": {
    "ObjectCount": 2,
    "LabelCount": 1,
    "RemovedLabels": ["regression"],
    "Result": "Removed"
  }
}
```

With `--remove-all-labels`:

```json
{
  "Code": "ObjectLabelsRemove",
  "Data": {
    "ObjectCount": 2,
    "RemoveAllLabels": true,
    "RemovedLabels": ["regression", "smoke"],
    "SkippedSystemLabels": ["automated"],
    "Result": "AllRemoved"
  }
}
```

| Field | Description |
|---|---|
| `ObjectCount` | Number of distinct object ids processed. |
| `LabelCount` | With `--labels`, the number of distinct requested names (case-insensitive). Replaced by `RemoveAllLabels: true` with `--remove-all-labels`. |
| `RemovedLabels` | Label names removed, sorted. |
| `SkippedSystemLabels` | System label names that matched and were kept. Omitted when empty. |
| `SkippedInternalLabels` | Names kept because they are, or share a name with, an internal label. Omitted when empty. |
| `Result` | `Removed`, `AllRemoved` (with `--remove-all-labels`), or `Skipped` when nothing was removed. |

## Related

- [requirements](./uip-test-manager-requirements.md) — requirements can carry object labels.
- [customfield](./uip-test-manager-customfield.md) — a separate label mechanism (`customfield label`) for Label-type custom field values; distinct from `objectlabel`'s free-form tags.

## See also

- [Test Manager overview](./uip-test-manager.md)
