# DUMP

> Serialize the value stored at a key so it can be restored with RESTORE.

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

```
DUMP key
```

- Group: Keys
- Complexity: O(N) where N is the size of the value
- HotKV Cloud: all plans
- On-Premise: no license needed

`DUMP` returns the value at `key` as an opaque binary payload that
[RESTORE](https://docs.hotkv.com/commands/restore/index.md) turns back into a key, on this server or
another one. The payload carries a version and a checksum, so a damaged
payload is refused on restore. The time to live is not part of the payload:
pass it to `RESTORE` separately.

Strings, lists, sets, hashes (including hash field expiry), sorted sets and
streams are written in the same serialization format Redis uses, so their
payloads can also be restored on Redis and Valkey. Bloom filters, count-min
sketches and Top-K values use a HotKV format that only HotKV can restore.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| The key exists | Bulk string: the payload | Bulk string |
| The key does not exist | Nil bulk string | Null |

## Examples

```
127.0.0.1:6379> SET greeting "hello"
OK
127.0.0.1:6379> DUMP greeting
"\x00\x05hello\t\x00\xb3\x80\x8e\xba1\xb2C\xbb"
127.0.0.1:6379> DUMP missing
(nil)
```

## Compatibility

Same as Redis 7 and Valkey 8 for the core data types. Payloads of hashes with
field expiry need Redis 7.4 or later to restore on Redis.

## See also

[RESTORE](https://docs.hotkv.com/commands/restore/index.md), [COPY](https://docs.hotkv.com/commands/copy/index.md),
[MIGRATE](https://docs.hotkv.com/commands/migrate/index.md)