# GET

> Return the string value stored at a key.

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

```
GET key
```

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

`GET` returns the string stored at `key`. Integers stored with
[SET](https://docs.hotkv.com/commands/set/index.md) or [INCR](https://docs.hotkv.com/commands/incr/index.md) come back as their decimal
text. A missing key is not an error: the reply is nil.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| The key holds a string | Bulk string | Bulk string |
| The key does not exist | Nil bulk string | Null |

`GET` replies with a `WRONGTYPE` error when the key holds a value that is not a
string.

## Examples

```
127.0.0.1:6379> SET greeting "hello"
OK
127.0.0.1:6379> GET greeting
"hello"
127.0.0.1:6379> GET missing
(nil)
127.0.0.1:6379> RPUSH queue job1
(integer) 1
127.0.0.1:6379> GET queue
(error) WRONGTYPE Operation against a key holding the wrong kind of value
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[SET](https://docs.hotkv.com/commands/set/index.md), [MGET](https://docs.hotkv.com/commands/mget/index.md), [GETEX](https://docs.hotkv.com/commands/getex/index.md),
[GETDEL](https://docs.hotkv.com/commands/getdel/index.md), [GETRANGE](https://docs.hotkv.com/commands/getrange/index.md)