> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.awork.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.awork.com/_mcp/server.

# Updates the comment with the specified id on the document with the specified id.

PUT https://api.awork.com/api/v1/documents/{documentId}/comments/{commentId}
Content-Type: application/json

To update a comment the user must either have at least `read` permissions on the specified document, be the creator of the comment or be admin.

Reference: https://developers.awork.com/apiv1/document-comments/put-comment-by-document-name-and-document-id-and-comment-id

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `documentId` (string, required) — The id of the document.
- `commentId` (string, required) — The id of the comment.

### Body (application/json)

This endpoint expects a CommentPutForm.

- `message` (string, required) — The message of the comment.
- `userId` (string, optional, nullable) — The id of the user who created the comment. Optional. If not set, defaults to the current user.
- `previews` (list of string, optional, nullable) — The preview URLs to show a preview for.
- `isHiddenForConnectUsers` (boolean, optional, nullable) — (optional) Whether the comment is hidden for connect users. Providing a null value will not change the current state. By default, comments are not hidden for connect users.
- `isResolved` (boolean, optional, nullable, deprecated) — Whether the comment has been resolved. Only available for comments on documents.

## Response

### 200

OK

- `id` (string, optional) — The id of the comment.
- `entityId` (string, optional) — The id of the entity of the comment. Required.
- `entityType` (string, optional, nullable) — The type of the entity of the comment. Can be "projects", "tasks". Required.
- `entity` (IDefaultNameModel, optional)
- `project` (IDefaultNameModel, optional)
- `task` (IDefaultNameModel, optional)
- `document` (IDefaultNameModel, optional)
- `createdOn` (string, optional) — The date this object was created.
- `createdBy` (string, optional) — The id of the user who created this object.
- `user` (ConnectedUserModel, optional)
- `agentId` (string, optional, nullable) — The agent that visibly authored this comment, when it was created by an agent run.
- `agentNameSnapshot` (string, optional, nullable) — The agent name captured when the comment was created.
- `updatedOn` (string, optional) — The date this object was last modified.
- `updatedBy` (string, optional) — The id of the user who last modified this object.
- `mentions` (Mentions, optional) — A mention is the tag of a user on a specific comment, so the user is notified.
- `reactions` (list of Reaction, optional, nullable) — The reactions on a comment.
- `formattedMessage` (string, optional, nullable) — The formatted and proccessed version of the comment message. E.g. mentions are in a human readable format. The formatted comment message is styled with html.
- `plainFormattedMessage` (string, optional, nullable) — The formatted and proccessed version of the comment message. E.g. mentions are in a human readable format. The formatted comment message is not styled.
- `resourceVersion` (long, optional) — The version of the entity, updated on every modification, to the ticks in UTC. Not identical to UpdatedOn.
- `message` (string, optional, nullable) — The message of the comment.
- `userId` (string, optional, nullable) — The id of the user who created the comment. Optional. If not set, defaults to the current user.
- `previews` (list of string, optional, nullable) — The preview URLs to show a preview for.
- `isHiddenForConnectUsers` (boolean, optional) — True if the comment should be hidden to connect users.
- `isResolved` (boolean, optional, nullable) — Whether the comment has been resolved. Only available for comments on documents.
- `inReplyToCommentId` (string, optional, nullable) — The parent comment this comment is a reply to.

## Errors

### 401 Unauthorized Error

Unauthorized

- `code` (string, required) — The error code.
- `description` (string, required) — The description of the error.
- `link` (string, required) — The link to the API documentation page.
- `details` (list of string, optional, nullable) — A list of details describing the error.
- `validationErrors` (list of ValidationErrorResponse, optional, nullable) — If a validation error occurred, this contains the validation errors for each property.
- `traceId` (string, optional, nullable) — The request trace id for tracking the request.

### 404 Not Found Error

Not Found

- `code` (string, required) — The error code.
- `description` (string, required) — The description of the error.
- `link` (string, required) — The link to the API documentation page.
- `details` (list of string, optional, nullable) — A list of details describing the error.
- `validationErrors` (list of ValidationErrorResponse, optional, nullable) — If a validation error occurred, this contains the validation errors for each property.
- `traceId` (string, optional, nullable) — The request trace id for tracking the request.

## Types

### IDefaultNameModel

- `id` (string, optional) — The id of the entity.
- `name` (string, optional, nullable) — The name of the entity.

### ConnectedUserModel

- `id` (string, optional) — The identifier of the nested model.
- `firstName` (string, optional, nullable) — The first name of the user.
- `lastName` (string, optional, nullable) — The last name of the user.
- `hasImage` (boolean, optional, nullable) — Whether this user has a profile image.
- `isExternal` (boolean, optional) — True if the model is coming from an external workspace (awork Connect). False otherwise.

### Mentions

A mention is the tag of a user on a specific comment, so the user is notified.

- `isMentioningPersonalAgent` (boolean, optional) — Gets or sets whether the comment mentions the awork Agent.
- `users` (list of ConnectedUserModel, optional, nullable) — All users which have been mentioned in the comment.
- `agentIds` (list of string, optional, nullable) — Stable ids of agents mentioned directly in the comment.
- `everyUserHadPermissions` (boolean, optional) — If every user was able to receive the mention notification. If not, one of the users had no permissions to.

### Reaction

The users reactions to a comment.

- `userId` (string, optional) — All users ids that reacted with the emoji.
- `emoji` (string, optional, nullable) — The emoji used as a reaction.

### ValidationErrorResponse

The validation error response.

- `property` (string, optional, nullable) — The name of the property that failed validation.
- `message` (string, optional, nullable) — The reason why this property failed validation.

## Examples

**Request**

```json
{
  "message": "Hey team, the customer loved the latest designs!"
}
```

**Response**

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "entityId": "123e4567-e89b-12d3-a456-426614174000",
  "entityType": "tasks",
  "entity": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "string"
  },
  "project": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "string"
  },
  "task": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "string"
  },
  "document": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "string"
  },
  "createdOn": "2024-01-15T09:30:00Z",
  "createdBy": "123e4567-e89b-12d3-a456-426614174000",
  "user": {
    "id": "80a2b26b-9fb3-42b5-b6dc-126c437cad5d",
    "firstName": "Carla",
    "lastName": "Creative",
    "hasImage": true,
    "isExternal": true
  },
  "agentId": "123e4567-e89b-12d3-a456-426614174000",
  "agentNameSnapshot": "string",
  "updatedOn": "2024-01-15T09:30:00Z",
  "updatedBy": "123e4567-e89b-12d3-a456-426614174000",
  "mentions": {
    "isMentioningPersonalAgent": true,
    "users": [
      {
        "id": "80a2b26b-9fb3-42b5-b6dc-126c437cad5d",
        "firstName": "Carla",
        "lastName": "Creative",
        "hasImage": true,
        "isExternal": true
      }
    ],
    "agentIds": [
      "string"
    ],
    "everyUserHadPermissions": true
  },
  "reactions": [
    {
      "userId": "123e4567-e89b-12d3-a456-426614174000",
      "emoji": "👍"
    }
  ],
  "formattedMessage": "Hey team, the customer loved the latest designs!",
  "plainFormattedMessage": "Hey team, the customer loved the latest designs!",
  "resourceVersion": 637825154598057900,
  "message": "Hey team, the customer loved the latest designs!",
  "userId": "123e4567-e89b-12d3-a456-426614174000",
  "previews": [
    "https://www.awork.com/en/blog/automatic-project-management/"
  ],
  "isHiddenForConnectUsers": true,
  "isResolved": true,
  "inReplyToCommentId": "123e4567-e89b-12d3-a456-426614174000"
}
```

**SDK Code**

```python
import requests

url = "https://api.awork.com/api/v1/documents/documentId/comments/commentId"

payload = { "message": "Hey team, the customer loved the latest designs!" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.awork.com/api/v1/documents/documentId/comments/commentId';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"message":"Hey team, the customer loved the latest designs!"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.awork.com/api/v1/documents/documentId/comments/commentId"

	payload := strings.NewReader("{\n  \"message\": \"Hey team, the customer loved the latest designs!\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.awork.com/api/v1/documents/documentId/comments/commentId")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"message\": \"Hey team, the customer loved the latest designs!\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.awork.com/api/v1/documents/documentId/comments/commentId")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"message\": \"Hey team, the customer loved the latest designs!\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.awork.com/api/v1/documents/documentId/comments/commentId', [
  'body' => '{
  "message": "Hey team, the customer loved the latest designs!"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.awork.com/api/v1/documents/documentId/comments/commentId");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"message\": \"Hey team, the customer loved the latest designs!\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["message": "Hey team, the customer loved the latest designs!"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.awork.com/api/v1/documents/documentId/comments/commentId")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```