# CLIENT GETNAME

> Return the name of the current connection.

URL: https://docs.hotkv.com/commands/client-getname/

```
CLIENT GETNAME
```

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

`CLIENT GETNAME` returns the name set with
[CLIENT SETNAME](https://docs.hotkv.com/commands/client-setname/index.md) or the `SETNAME` option of
[HELLO](https://docs.hotkv.com/commands/hello/index.md).

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Name set | Bulk string | Bulk string |
| No name | Nil bulk string | Null |

## Examples

```
127.0.0.1:6379> CLIENT GETNAME
(nil)
127.0.0.1:6379> CLIENT SETNAME api-1
OK
127.0.0.1:6379> CLIENT GETNAME
"api-1"
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[CLIENT SETNAME](https://docs.hotkv.com/commands/client-setname/index.md), [CLIENT INFO](https://docs.hotkv.com/commands/client-info/index.md)