> ## Documentation Index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# SETRANGE

> Writes the value of key at offset.

The SETRANGE command in Redis is used to modify a portion of the value of a key by replacing a substring within the key's existing value. It allows you to update part of the string value associated with a specific key at a specified offset.

## Arguments

<ParamField body="key" type="string" required>
  The name of the Redis key for which you want to modify the value.
</ParamField>

<ParamField body="offset" type="integer" required>
  The zero-based index in the value where you want to start replacing characters.
</ParamField>

<ParamField body="value" type="string" required>
  The new string that you want to insert at the specified offset in the existing value.
</ParamField>

## Response

<ResponseField type="integer" required>
  The length of the value after it was modified.
</ResponseField>

<RequestExample>
  ```ts Example theme={"system"}
  await redis.set("key", "helloworld")
  const length = await redis.setrange("key", 5, "redis");
  console.log(length); // 10

  // The value of "key" is now "helloredis"
  ```
</RequestExample>
