# RENAME

> Rename a key

Renames a key and overwrites the new key if it already exists.

Throws an exception if the key does not exist.

## Arguments

<ParamField body="source" type="str" required>
  The original key.
</ParamField>

<ParamField body="destination" type="str" required>
  A new name for the key.
</ParamField>

## Response

<ResponseField type="bool" required>
 `True` if key was renamed
</ResponseField>

<RequestExample>
```py Example
redis.set("key1", "Hello")
redis.rename("key1", "key2")

assert redis.get("key1") is None
assert redis.get("key2") == "Hello"

# Renaming a nonexistent key throws an exception
redis.rename("nonexistent", "key3")
```
</RequestExample>
