> ## Documentation Index
> Fetch the complete documentation index at: https://superdoc-caio-pizzol-docs-ai-core-preset.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# trackChanges.decide

> Accept or reject tracked changes by ID, range, or scope: all (optionally filtered by story).

## Summary

Accept or reject tracked changes by ID, range, or scope: all (optionally filtered by story).

* Operation ID: `trackChanges.decide`
* API member path: `editor.doc.trackChanges.decide(...)`
* Mutates document: `yes`
* Idempotency: `conditional`
* Supports tracked mode: `no`
* Supports dry run: `no`
* Deterministic target resolution: `yes`

## Expected result

Returns a Receipt confirming the decision was applied; reports NO\_OP if the change was already resolved and typed failures for unsupported or denied tracked-change decisions.

## Input fields

| Field      | Type                                     | Required | Description                                  |
| ---------- | ---------------------------------------- | -------- | -------------------------------------------- |
| `decision` | enum                                     | yes      | `"accept"`, `"reject"`                       |
| `target`   | object \| object(kind="range") \| object | yes      | One of: object, object(kind="range"), object |

### Example request

```json theme={null}
{
  "decision": "accept",
  "target": {
    "id": "id-001",
    "story": {
      "kind": "story",
      "storyType": "body"
    }
  }
}
```

## Output fields

### Variant 1 (success=true)

| Field      | Type             | Required | Description      |
| ---------- | ---------------- | -------- | ---------------- |
| `inserted` | EntityAddress\[] | no       |                  |
| `removed`  | EntityAddress\[] | no       |                  |
| `success`  | `true`           | yes      | Constant: `true` |
| `updated`  | EntityAddress\[] | no       |                  |

### Variant 2 (success=false)

| Field             | Type    | Required | Description                                                                                                                                                                     |
| ----------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `failure`         | object  | yes      |                                                                                                                                                                                 |
| `failure.code`    | enum    | yes      | `"NO_OP"`, `"INVALID_INPUT"`, `"INVALID_TARGET"`, `"TARGET_NOT_FOUND"`, `"CAPABILITY_UNAVAILABLE"`, `"PERMISSION_DENIED"`, `"PRECONDITION_FAILED"`, `"COMMENT_CASCADE_PARTIAL"` |
| `failure.details` | any     | no       |                                                                                                                                                                                 |
| `failure.message` | string  | yes      |                                                                                                                                                                                 |
| `success`         | `false` | yes      | Constant: `false`                                                                                                                                                               |

### Example response

```json theme={null}
{
  "inserted": [
    {
      "entityId": "entity-789",
      "entityType": "comment",
      "kind": "entity"
    }
  ],
  "success": true,
  "updated": [
    {
      "entityId": "entity-789",
      "entityType": "comment",
      "kind": "entity"
    }
  ]
}
```

## Pre-apply throws

* `TARGET_NOT_FOUND`
* `CAPABILITY_UNAVAILABLE`
* `INVALID_INPUT`
* `INVALID_TARGET`

## Non-applied failure codes

* `NO_OP`
* `INVALID_INPUT`
* `INVALID_TARGET`
* `TARGET_NOT_FOUND`
* `CAPABILITY_UNAVAILABLE`
* `PERMISSION_DENIED`
* `PRECONDITION_FAILED`
* `COMMENT_CASCADE_PARTIAL`

## Raw schemas

<Accordion title="Raw input schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "decision": {
        "enum": [
          "accept",
          "reject"
        ]
      },
      "target": {
        "oneOf": [
          {
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string"
              },
              "range": {
                "description": "Partial-range qualifier on an id target. Rejected with INVALID_INPUT for indivisible (e.g. structural) revisions.",
                "type": "object"
              },
              "story": {
                "$ref": "#/$defs/StoryLocator"
              }
            },
            "required": [
              "id"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "kind": {
                "const": "range"
              },
              "part": {
                "description": "Optional part discriminator for the range target.",
                "type": "string"
              },
              "range": {
                "$ref": "#/$defs/TextTarget"
              },
              "story": {
                "$ref": "#/$defs/StoryLocator"
              }
            },
            "required": [
              "kind",
              "range"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "scope": {
                "enum": [
                  "all"
                ]
              },
              "story": {
                "description": "Optional explicit bulk filter. Omit or pass 'all' to target every revision-capable story, or pass a StoryLocator to scope the decision to one story.",
                "oneOf": [
                  {
                    "$ref": "#/$defs/StoryLocator"
                  },
                  {
                    "const": "all"
                  }
                ]
              }
            },
            "required": [
              "scope"
            ],
            "type": "object"
          }
        ]
      }
    },
    "required": [
      "decision",
      "target"
    ],
    "type": "object"
  }
  ```
</Accordion>

<Accordion title="Raw output schema">
  ```json theme={null}
  {
    "oneOf": [
      {
        "$ref": "#/$defs/ReceiptSuccess"
      },
      {
        "additionalProperties": false,
        "properties": {
          "failure": {
            "additionalProperties": false,
            "properties": {
              "code": {
                "enum": [
                  "NO_OP",
                  "INVALID_INPUT",
                  "INVALID_TARGET",
                  "TARGET_NOT_FOUND",
                  "CAPABILITY_UNAVAILABLE",
                  "PERMISSION_DENIED",
                  "PRECONDITION_FAILED",
                  "COMMENT_CASCADE_PARTIAL"
                ]
              },
              "details": {},
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          },
          "success": {
            "const": false
          }
        },
        "required": [
          "success",
          "failure"
        ],
        "type": "object"
      }
    ]
  }
  ```
</Accordion>

<Accordion title="Raw success schema">
  ```json theme={null}
  {
    "$ref": "#/$defs/ReceiptSuccess"
  }
  ```
</Accordion>

<Accordion title="Raw failure schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "failure": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "enum": [
              "NO_OP",
              "INVALID_INPUT",
              "INVALID_TARGET",
              "TARGET_NOT_FOUND",
              "CAPABILITY_UNAVAILABLE",
              "PERMISSION_DENIED",
              "PRECONDITION_FAILED",
              "COMMENT_CASCADE_PARTIAL"
            ]
          },
          "details": {},
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      },
      "success": {
        "const": false
      }
    },
    "required": [
      "success",
      "failure"
    ],
    "type": "object"
  }
  ```
</Accordion>
