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

# Returns all comments of the task with the specified id.

GET https://api.awork.com/api/v1/tasks/{taskId}/comments

Returns all comments of the task with the specified id. The user needs read permissions on the task.Any authenticated user.

Reference: https://developers.awork.com/apiv1/task-comments/get-comments-by-task-name-and-task-id

## Authentication

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

## Request

### Path parameters

- `taskId` (string, required) — The id of the task.

### Query parameters

- `page` (integer, optional, default: 1) — Page number for pagination
- `pageSize` (integer, optional, default: 10) — Number of items per page
- `orderby` (string, optional) — The properties to order by
- `filterby` (string, optional) — The filter expression to filter by

## Response

### 200

OK

- `list of Comment`

## Errors

### 400 Bad Request Error

Bad Request

- `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.

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

## Types

### Comment

The comment model.

- `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.

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

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

## Examples

**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/tasks/taskId/comments"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.awork.com/api/v1/tasks/taskId/comments';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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"
	"net/http"
	"io"
)

func main() {

	url := "https://api.awork.com/api/v1/tasks/taskId/comments"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	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/tasks/taskId/comments")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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.get("https://api.awork.com/api/v1/tasks/taskId/comments")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.awork.com/api/v1/tasks/taskId/comments', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.awork.com/api/v1/tasks/taskId/comments");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.awork.com/api/v1/tasks/taskId/comments")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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()
```