# history.beginGroup

> Begin one editor-local undo group across awaited public writes. Nesting and temporary mutation overlap are rejected. Finish with endGroup in finally; failed writes leave the successful prefix undoable. Native input and undo/redo finish the group; remote peer edits retain their own ownership.



- Member path: `doc.history.beginGroup(…)`
- Mutates document: no
- Idempotency: `non-idempotent`
- Supports tracked mode: no
- Supports dry run: no

## Expected result

Returns a session-local groupId. Empty groups create no history entry. The handle does not survive document replacement or reopen.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {},
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {},
  "type": "object",
  "properties": {
    "groupId": {
      "type": "string",
      "minLength": 1
    }
  },
  "additionalProperties": false,
  "required": [
    "groupId"
  ]
}
```

## Pre-apply throws

- `CAPABILITY_UNAVAILABLE`
- `PRECONDITION_FAILED`

## Non-applied receipt codes

- None

