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

# Update Comments

Use this API to update comments within a specific CommentAnnotation.

# Endpoint

`POST https://api.velt.dev/v2/commentannotations/comments/update`

# Headers

**x-velt-api-key** `string` *required*

Your API key.

**x-velt-auth-token** `string` *required*

Your [Auth Token](https://velt.dev/docs/security/auth-tokens.md).

# Body

#### Params

**data** `object` *required*

**properties**

**organizationId** `string` *required*

Organization ID

**documentId** `string` *required*

Document ID

**annotationId** `string` *required*

Comment Annotation ID

**commentIds** `number[]` *required*

Comment IDs

**triggerNotification** `boolean`

When enabled, this update triggers exactly one notification through the same funnel as a new comment, useful for notifying once when a progress comment finishes. Defaults to `false`, is never persisted onto the comment, and must be sent at this root level, not inside `updatedData`.

**updatedData** `object` *required*

Comment data

**properties**

**commentText** `string`

Comment content in plain text string

**commentHtml** `string`

Comment content in HTML string

**context** `object`

Custom key/value metadata object. This is used to store any additional information about the comment.

**isCommentResolverUsed** `boolean`

Use this for self-hosting comments data. Set this as true if you are comments resolver data provider in the SDK.

**isCommentTextAvailable** `boolean`

Use this for self-hosting comments data. Set this as true if this comment will have text content. Sometimes, comments might only have attachments and in that case, set this as false.

**progress** `CommentProgress`

Replaces the stored `progress` object outright; it is not deep-merged, so send the full object you want stored. See [CommentProgress](https://velt.dev/docs/api-reference/sdk/models/data-models.md#commentprogress) for the full shape. `steps` is capped at 100 entries.

**actions** `CommentAction[]`

Replaces the stored `actions` array outright. Capped at 20 entries. See [CommentAction](https://velt.dev/docs/api-reference/sdk/models/data-models.md#commentaction) for the full shape.

**from** `User` *required*

User object from whom the comment is added

**taggedUserContacts** `object[]`

Array of tagged user contacts

**properties**

**text** `string` *required*

Display text of the tagged user (e.g. "@Username")

**userId** `string` *required*

User ID of the tagged user

**contact** `object` *required*

**properties**

**email** `string` *required*

Email of the tagged user

**name** `string` *required*

Name of the tagged user

**userId** `string` *required*

User ID of the tagged user

**attachments** `object[]`

Array of attachments to include with the comment. See [Attachment](https://velt.dev/docs/api-reference/sdk/models/data-models.md#attachment) for full schema details.

**properties**

**attachmentId** `number` *required*

Unique identifier for the attachment

**name** `string`

File name of the attachment

**bucketPath** `string`

Path to the file in storage bucket

**size** `number`

File size in bytes

**type** `string`

File type (e.g., "image", "video", "document")

**url** `string`

Download URL of the attachment

**thumbnail** `string`

Thumbnail URL of the attachment

**mimeType** `string`

MIME type of the attachment (e.g., "image/png", "video/mp4")

**metadata** `object`

Custom metadata for the attachment (e.g., dimensions, timestamps, etc.)

> [!NOTE]
>
> Every update rewrites the entire annotation document, so keep `progress` updates to roughly one write per second per comment. Send a step's final label rather than every intermediate token.

## **Example Requests**

#### 1. Update comment in a CommentAnnotation by organizationId, documentId, annotationId and commentId

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "annotationId": "yourAnnotationId",
    "commentIds": [
      153783,
      607395
    ],
    "updatedData": {
      "commentText": "Sample Updated Comment",
      "commentHtml": "<div>Hello Updated</div>"
    }
  }
}
```

#### 2. Update comment with attachments

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "annotationId": "yourAnnotationId",
    "commentIds": [
      123456
    ],
    "updatedData": {
      "commentText": "Updated comment text with new attachments",
      "commentHtml": "<p>Updated comment text with <em>new attachments</em></p>",
      "attachments": [
        {
          "attachmentId": 100001,
          "name": "updated-screenshot.png",
          "bucketPath": "attachments/org-123/doc-456/updated-screenshot.png",
          "size": 1536000,
          "type": "image",
          "url": "https://storage.googleapis.com/bucket/updated-screenshot.png",
          "thumbnail": "https://storage.googleapis.com/bucket/updated-screenshot_thumb.png",
          "mimeType": "image/png",
          "metadata": {
            "width": 1920,
            "height": 1080,
            "updatedAt": 1696122000000
          }
        }
      ]
    }
  }
}
```

#### 3. Complete a progress comment and trigger a notification

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "annotationId": "yourAnnotationId",
    "commentIds": [
      153783
    ],
    "triggerNotification": true,
    "updatedData": {
      "commentText": "Here is the answer.",
      "progress": { "state": "completed" },
      "actions": [
        { "id": "approve", "label": "Approve" }
      ]
    }
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Comment updated successfully.",
    "data": {
      "607395": {
        "success": true,
        "id": 607395,
        "message": "Updated successfully"
      }
    }
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

```js theme={null}
{
  "result": {
    "status": "success",
    "message": "Comment updated successfully.",
    "data": {
      "607395": {
        "success": true,
        "id": 607395,
        "message": "Updated successfully"
      }
    }
  }
}
```


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