**Language / Язык:** [English](tagging.md) | [Русский](../ru/domains/tagging.md)

# Tagging

CIS tagging service (categories, tags, object associations):
[`app/vsphere/rest/tagging_rest.py`](../../app/vsphere/rest/tagging_rest.py),
[`app/vsphere/domain/tagging.py`](../../app/vsphere/domain/tagging.py).

## Endpoints

| Method | Path | Notes |
|---|---|---|
| GET/POST | `/api/cis/tagging/category` | List / create (`cardinality`, `associable_types`) |
| GET/DELETE | `/api/cis/tagging/category/{category_id}` | |
| GET/POST | `/api/cis/tagging/tag` | List / create under a category |
| GET/DELETE | `/api/cis/tagging/tag/{tag_id}` | |
| POST | `/api/cis/tagging/tag-association` | Attach/detach a tag to/from an object |

## Highlights

- Category and tag ids follow the real `urn:vmomi:InventoryServiceCategory:…`
  / `urn:vmomi:InventoryServiceTag:…:GLOBAL` shape.
- Rows persist in `vsphere_tag_categories`, `vsphere_tags`,
  `vsphere_tag_associations` — durable across restarts, replaced on reseed.
- The seed creates two categories (`Environment`, `Owner`) with `prod`/
  `staging`/`platform` tags and attaches `prod` to two seeded VMs
  (`seed_platform_extras` in
  [`app/vsphere/domain/content.py`](../../app/vsphere/domain/content.py)).
- Attaching/creating a tag requires
  `InventoryService.Tagging.CreateCategory` / `.CreateTag` / `.AttachTag`
  privileges — see [Authorization](authz.md).
