# history.endGroup

> Finish the matching editor-local group. Call in finally after awaiting each write. A stale handle returns closed false when no group is active; a mismatched handle cannot close another active group. Successful writes become one Undo and one Redo without rolling back failed writes.



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

## Expected result

Returns the supplied groupId and closed, indicating whether this call closed an active group.

## Input schema

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

## Output schema

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

## Pre-apply throws

- `INVALID_INPUT`
- `CAPABILITY_UNAVAILABLE`
- `PRECONDITION_FAILED`

## Non-applied receipt codes

- None

