> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superdoc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# comments.delete

> Remove a comment or reply by ID. Deleting a root cascades through every descendant reply.

## Summary

Remove a comment or reply by ID. Deleting a root cascades through every descendant reply.

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

## Expected result

Returns a Receipt with every removed commentId in `removed` and every story touched in `affectedStories`. Rejects with `TARGET_NOT_FOUND` when the comment id does not exist and reports `NO_OP` when the command layer accepts the target but removes nothing.

## Input fields

| Field       | Type   | Required | Description |
| ----------- | ------ | -------- | ----------- |
| `commentId` | string | yes      |             |

### Example request

```json theme={null}
{
  "commentId": "comment-001"
}
```

## Output fields

### Variant 1 (success=true)

| Field             | Type                    | Required | Description      |
| ----------------- | ----------------------- | -------- | ---------------- |
| `affectedStories` | StoryLocator\[]         | no       |                  |
| `id`              | string                  | no       |                  |
| `inserted`        | EntityAddress\[]        | no       |                  |
| `invalidatedRefs` | AffectedRef\[]          | no       |                  |
| `remappedRefs`    | AffectedRefRemapping\[] | no       |                  |
| `removed`         | EntityAddress\[]        | no       |                  |
| `success`         | `true`                  | yes      | Constant: `true` |
| `textRangeShifts` | TextRangeShift\[]       | no       |                  |
| `txId`            | string                  | no       |                  |
| `updated`         | EntityAddress\[]        | no       |                  |

### Variant 2 (success=false)

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

### Example response

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

## Pre-apply throws

* `TARGET_NOT_FOUND`
* `CAPABILITY_UNAVAILABLE`

## Non-applied failure codes

* `TARGET_NOT_FOUND`
* `CAPABILITY_UNAVAILABLE`
* `NO_OP`

## Raw schemas

<Accordion title="Raw input schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "commentId": {
        "type": "string"
      }
    },
    "required": [
      "commentId"
    ],
    "type": "object"
  }
  ```
</Accordion>

<Accordion title="Raw output schema">
  ```json theme={null}
  {
    "oneOf": [
      {
        "$ref": "#/$defs/ReceiptSuccess"
      },
      {
        "additionalProperties": false,
        "properties": {
          "failure": {
            "additionalProperties": false,
            "properties": {
              "code": {
                "enum": [
                  "TARGET_NOT_FOUND",
                  "CAPABILITY_UNAVAILABLE",
                  "NO_OP"
                ]
              },
              "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": [
              "TARGET_NOT_FOUND",
              "CAPABILITY_UNAVAILABLE",
              "NO_OP"
            ]
          },
          "details": {},
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      },
      "success": {
        "const": false
      }
    },
    "required": [
      "success",
      "failure"
    ],
    "type": "object"
  }
  ```
</Accordion>
