# APPEND

> Append a value to the end of a string, creating the key if needed.

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

```
APPEND key value
```

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

`APPEND` adds `value` to the end of the string at `key`. When the key does not
exist it is created with `value` as its content, as [SET](https://docs.hotkv.com/commands/set/index.md)
would. The key keeps its time to live.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Always | Integer: the length of the string after the append | Integer |

Errors:

- `WRONGTYPE` when the key holds a value that is not a string.
- `ERR string exceeds maximum allowed size (proto-max-bulk-len)` when the
  result would be longer than `proto-max-bulk-len` (512 MB by default).

## Examples

```
127.0.0.1:6379> APPEND log "boot;"
(integer) 5
127.0.0.1:6379> APPEND log "ready;"
(integer) 11
127.0.0.1:6379> GET log
"boot;ready;"
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[SETRANGE](https://docs.hotkv.com/commands/setrange/index.md), [STRLEN](https://docs.hotkv.com/commands/strlen/index.md),
[GETRANGE](https://docs.hotkv.com/commands/getrange/index.md), [SET](https://docs.hotkv.com/commands/set/index.md)