---
title: "HKEYS"
url: "https://docs.yugabyte.com/stable/yedis/api/hkeys/"
---

# HKEYS

## Synopsis

**`HKEYS key`**

This command fetches all fields of the hash that is associated with the given `key`.

- If the `key` does not exist, an empty list is returned.
- If the `key` is associated with non-hash data, an error is raised.

## Return value

Returns list of fields in the specified hash.

## Examples

```sh
$ HSET yugahash area1 "Africa"
```

```
1
```

```sh
$ HSET yugahash area2 "America"
```

```
1
```

```sh
$ HKEYS yugahash
```

```
1) "area1"
2) "area2"
```

## See also

[`hdel`](/stable/yedis/api/hdel/ "hdel"), [`hexists`](/stable/yedis/api/hexists/ "hexists"), [`hget`](/stable/yedis/api/hget/ "hget"), [`hgetall`](/stable/yedis/api/hgetall/ "hgetall"), [`hlen`](/stable/yedis/api/hlen/ "hlen"), [`hmget`](/stable/yedis/api/hmget/ "hmget"), [`hmset`](/stable/yedis/api/hmset/ "hmset"), [`hset`](/stable/yedis/api/hset/ "hset"), [`hincrby`](/stable/yedis/api/hincrby/ "hincrby"), [`hstrlen`](/stable/yedis/api/hstrlen/ "hstrlen"), [`hvals`](/stable/yedis/api/hvals/ "hvals")
