# TAG.EXISTS

> Check whether a key carries a tag.

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

```
TAG.EXISTS key tag
```

- Group: Tags
- Complexity: O(1)
- HotKV Cloud: all plans
- On-Premise: no license needed

`TAG.EXISTS` tells you whether `tag` is attached to `key`.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Key has the tag | Integer `1` | Integer `1` |
| Key lacks the tag, or no such key | Integer `0` | Integer `0` |

## 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.EXISTS article:1 news
(integer) 1
127.0.0.1:6379> TAG.EXISTS article:1 sports
(integer) 0
```

## Compatibility

HotKV-only command.

## See also

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