# TAG.GET

> Return all tags attached to a key.

URL: https://docs.hotkv.com/commands/tag-get/

```
TAG.GET key
```

- Group: Tags
- Complexity: O(n), n being the key's tags
- HotKV Cloud: all plans
- On-Premise: no license needed

`TAG.GET` returns the tags attached to `key` with
[TAG.SET](https://docs.hotkv.com/commands/tag-set/index.md). The order is not defined.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Key has tags | Array of bulk strings | Array of bulk strings |
| No tags, or no such key | Empty array | Empty array |

## Examples

```
127.0.0.1:6379> SET article:1 "..."
OK
127.0.0.1:6379> TAG.SET article:1 news
(integer) 1
127.0.0.1:6379> TAG.GET article:1
1) "news"
127.0.0.1:6379> TAG.GET article:2
(empty array)
```

## Compatibility

HotKV-only command.

## See also

[TAG.SET](https://docs.hotkv.com/commands/tag-set/index.md), [TAG.COUNT](https://docs.hotkv.com/commands/tag-count/index.md), [TAG.EXISTS](https://docs.hotkv.com/commands/tag-exists/index.md)