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

# Tags

> Track and organize resources with key-value pairs

Tags are `key=value` pairs that help you track and organize resources on SF Compute.

## Create tags

Set tags when you create a resource with the `--tag` flag.

```bash theme={null}
sf pools create --name root --tag model=cuda-crunch
```

## Edit tags

The `set` command replaces all existing tags on a resource. Pass every tag you want to keep.

```bash theme={null}
sf instances set prod --tag model=cuda-crunch --tag env=prod
```

## Delete tags

To delete all tags on a resource, set `--tag null`. You cannot recover deleted tags.

```bash theme={null}
sf pools set dev --tag null
```

To remove a single tag, re-run `set` with only the tags you want to keep.

## List resources by tags

Filter resources by tag with the `--tag` flag.

```bash theme={null}
sf instances list --tag model=cuda-crunch
```

```text theme={null}
-----------------------------------------------------------------------------
NAME  STATUS   POOL  INSTANCE SKU  CREATED        TAGS
prod  running  root  -             Mar 1, 9:00am  model=cuda-crunch, env=prod
```

To match any value for a key, filter with the `--tag-key` flag.

```bash theme={null}
sf instances list --tag-key env
```

```text theme={null}
-----------------------------------------------------------------------------
NAME  STATUS   POOL  INSTANCE SKU  CREATED        TAGS
prod  running  root  -             Mar 1, 9:00am  env=prod, model=cuda-crunch
```

## Constraints

Tag keys must not contain spaces, commas, or equals signs, and must not begin with an underscore
(`_`). Keys can be up to 128 characters.

Tag values must not contain commas or equals signs. Values may contain spaces and can be up to 256
characters.

Tags are case sensitive. You can add up to 50 tags to each resource.
