> ## 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.create

> Create a new comment thread (or reply when parentCommentId is given). Accepts TextAddress / TextTarget anchors, or a TrackedChangeCommentTarget that names a logical tracked-change id. The tracked-change target accepts both the explicit kind form and the Labs-compatible trackedChangeId-only form; the adapter normalizes it to a Word-compatible content anchor on the requested revision side.

## Summary

Create a new comment thread (or reply when parentCommentId is given). Accepts TextAddress / TextTarget anchors, or a TrackedChangeCommentTarget that names a logical tracked-change id. The tracked-change target accepts both the explicit kind form and the Labs-compatible trackedChangeId-only form; the adapter normalizes it to a Word-compatible content anchor on the requested revision side.

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

## Expected result

Returns a Receipt with the new commentId in `id` and `inserted` on success; rejects whitespace-only bodies, unsupported anchor contexts, and cross-story targets. Tracked-change comment targets support insertion, deletion, replacement, and paired-move revisions; they fail with `TARGET_NOT_FOUND` for stale ids, `CAPABILITY_UNAVAILABLE` for formatting / structural revisions and unpaired move sides, and `INVALID_TARGET` for incompatible side requests or ambiguous replacement targets that omit a required `side`.

## Input fields

| Field | Type | Required | Description |
| - | - | - | - |
| `parentCommentId` | string | no | |
| `side` | enum | no | `"inserted"`, `"deleted"`, `"source"`, `"destination"` |
| `story` | StoryLocator | no | StoryLocator |
| `target` | TextAddress \| TextTarget \| SelectionTarget \| CommentTrackedChangeTarget \| object | no | One of: TextAddress, TextTarget, SelectionTarget, CommentTrackedChangeTarget, object |
| `text` | string | yes | |
| `trackedChangeId` | string | no | |

### Example request

```json theme={null}
{
  "target": {
    "blockId": "block-abc123",
    "kind": "text",
    "range": {
      "end": 10,
      "start": 0
    },
    "story": {
      "kind": "story",
      "storyType": "body"
    }
  },
  "text": "Hello, world.",
  "trackedChangeId": "example"
}
```

## Output fields

### Variant 1 (success=true)

| Field | Type | Required | Description |
| - | - | - | - |
| `id` | string | yes | |
| `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 | `"INVALID_INPUT"`, `"INVALID_TARGET"`, `"INVALID_CONTEXT"`, `"TARGET_NOT_FOUND"`, `"CAPABILITY_UNAVAILABLE"` |
| `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,
  "updated": [
    {
      "entityId": "entity-789",
      "entityType": "comment",
      "kind": "entity"
    }
  ]
}
```

## Pre-apply throws

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

## Non-applied failure codes

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

## Raw schemas

> [accordion] Raw input schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "parentCommentId": {
>       "description": "Parent comment ID for creating a threaded reply.",
>       "type": "string"
>     },
>     "side": {
>       "description": "Optional side for the top-level trackedChangeId shorthand.",
>       "enum": [
>         "inserted",
>         "deleted",
>         "source",
>         "destination"
>       ]
>     },
>     "story": {
>       "$ref": "#/$defs/StoryLocator",
>       "description": "Optional story for the top-level trackedChangeId shorthand."
>     },
>     "target": {
>       "description": "Text range to anchor the comment. Accepts either a single-block TextAddress {kind:'text', blockId, range}, a multi-segment TextTarget {kind:'text', segments:[{blockId, range}, ...]} for selections that span blocks, a SelectionTarget {kind:'selection', start, end} returned by query.match, a TextSearchCommentTarget {text, story?}, or a TrackedChangeCommentTarget ({kind:'trackedChange', trackedChangeId, side?} or {trackedChangeId, side?}) that names a logical tracked-change id as a convenience anchor .",
>       "oneOf": [
>         {
>           "$ref": "#/$defs/TextAddress"
>         },
>         {
>           "$ref": "#/$defs/TextTarget"
>         },
>         {
>           "$ref": "#/$defs/SelectionTarget"
>         },
>         {
>           "$ref": "#/$defs/CommentTrackedChangeTarget"
>         },
>         {
>           "additionalProperties": false,
>           "properties": {
>             "story": {
>               "$ref": "#/$defs/StoryLocator"
>             },
>             "text": {
>               "description": "Text to find and anchor the comment to. The adapter resolves the first body/story match.",
>               "type": "string"
>             }
>           },
>           "required": [
>             "text"
>           ],
>           "type": "object"
>         }
>       ]
>     },
>     "text": {
>       "description": "Comment text content.",
>       "type": "string"
>     },
>     "trackedChangeId": {
>       "description": "Compatibility shorthand for target: { trackedChangeId }. Used only when target is omitted.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "text"
>   ],
>   "type": "object"
> }
> ```

> [accordion] Raw output schema
>
> ```json theme={null}
> {
>   "oneOf": [
>     {
>       "$ref": "#/$defs/CommentsCreateSuccess"
>     },
>     {
>       "additionalProperties": false,
>       "properties": {
>         "failure": {
>           "additionalProperties": false,
>           "properties": {
>             "code": {
>               "enum": [
>                 "INVALID_INPUT",
>                 "INVALID_TARGET",
>                 "INVALID_CONTEXT",
>                 "TARGET_NOT_FOUND",
>                 "CAPABILITY_UNAVAILABLE"
>               ]
>             },
>             "details": {},
>             "message": {
>               "type": "string"
>             }
>           },
>           "required": [
>             "code",
>             "message"
>           ],
>           "type": "object"
>         },
>         "success": {
>           "const": false
>         }
>       },
>       "required": [
>         "success",
>         "failure"
>       ],
>       "type": "object"
>     }
>   ]
> }
> ```

> [accordion] Raw success schema
>
> ```json theme={null}
> {
>   "$ref": "#/$defs/CommentsCreateSuccess"
> }
> ```

> [accordion] Raw failure schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "failure": {
>       "additionalProperties": false,
>       "properties": {
>         "code": {
>           "enum": [
>             "INVALID_INPUT",
>             "INVALID_TARGET",
>             "INVALID_CONTEXT",
>             "TARGET_NOT_FOUND",
>             "CAPABILITY_UNAVAILABLE"
>           ]
>         },
>         "details": {},
>         "message": {
>           "type": "string"
>         }
>       },
>       "required": [
>         "code",
>         "message"
>       ],
>       "type": "object"
>     },
>     "success": {
>       "const": false
>     }
>   },
>   "required": [
>     "success",
>     "failure"
>   ],
>   "type": "object"
> }
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.