# Create a task comment

`POST /api/task/{taskId}/comment`

URL: https://repsona.com/api/post-task-taskid-comment

Accepts an editor doc (TipTap JSON) or a markdown string; stored as markdown.

## Parameters

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `taskId` | path | integer | required | ID of the task. |

## Request body

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `doc` | body | object |  | Comment body as a rich-text document (ProseMirror/Tiptap JSON). Send either `doc` or `markdown`. |
| `markdown` | body | string |  | Comment body as Markdown (up to 20,000 characters). Takes precedence over `doc` if both are sent. |
| `parentId` | body | integer \| null |  | ID of the comment to reply to. Omit or `null` to post a top-level comment. |

## Request

```sh
curl -X POST "https://<space>.repsona.com/api/task/{taskId}/comment" \
  -H "Authorization: Bearer $REPSONA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "markdown": "I rewrote the hero section. Could you take a look before Friday?",
    "parentId": null
  }'
```

## Responses

- 200: Created comment
- 400: Empty body or invalid parent
- 401: Authentication is required
- 403: Not a project member
- 404: Task not found

## Example response

```json
{
  "comment": {
    "id": 75,
    "parentId": null,
    "comment": "I rewrote the hero section. Could you take a look before Friday?",
    "createdAt": 1793662651194,
    "updatedAt": 1793662651194,
    "user": {
      "id": 1127,
      "name": "emma",
      "fullName": "Emma Carter",
      "avatarUrl": null,
      "color": null,
      "state": "active"
    },
    "files": [],
    "deleted": false,
    "reactions": [],
    "children": []
  }
}
```
