# XGROUP SETID

> Set the last delivered ID of a consumer group.

URL: https://docs.hotkv.com/commands/xgroup-setid/

```
XGROUP SETID key group <id | $> [ENTRIESREAD entries-read]
```

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

`XGROUP SETID` moves the consumer group's last delivered ID. The next
[XREADGROUP](https://docs.hotkv.com/commands/xreadgroup/index.md) with `>` delivers entries after it. Set it
to `0` to have the group read the whole stream again, or to `$` to skip
everything already in the stream.

The pending entries list is not changed.

## Options

| Option | Effect |
| --- | --- |
| `ENTRIESREAD entries-read` | Set the group's count of entries read, used for its lag in XINFO GROUPS. `-1` means unknown. |

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| ID set | Simple string `OK` | Simple string `OK` |

Error replies:

- `NOGROUP No such consumer group 'group' for key name 'key'`
- `ERR The XGROUP subcommand requires the key to exist. ...` when the stream does not exist.
- `ERR Invalid stream ID specified as stream command argument`
- `ERR value for ENTRIESREAD must be positive or -1`
- `ERR unknown subcommand or wrong number of arguments for 'SETID'. Try XGROUP HELP.`
- `WRONGTYPE` if the key holds another type.

## Examples

```
127.0.0.1:6379> XADD orders 1700000000000-0 item book
"1700000000000-0"
127.0.0.1:6379> XGROUP CREATE orders billing $
OK
127.0.0.1:6379> XREADGROUP GROUP billing w1 STREAMS orders >
(nil)
127.0.0.1:6379> XGROUP SETID orders billing 0
OK
127.0.0.1:6379> XREADGROUP GROUP billing w1 STREAMS orders >
1) 1) "orders"
   2) 1) 1) "1700000000000-0"
         2) 1) "item"
            2) "book"
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[XGROUP CREATE](https://docs.hotkv.com/commands/xgroup-create/index.md), [XGROUP](https://docs.hotkv.com/commands/xgroup/index.md), [XINFO GROUPS](https://docs.hotkv.com/commands/xinfo-groups/index.md)