---
title: "Comment on a task"
method: POST
path: "/public-api/v1/tasks/{task_id}/comments"
tags: ["Comments"]
---

# Comment on a task

`POST /public-api/v1/tasks/{task_id}/comments`

## Request

- Base URL: `https://app.hellobonsai.com`
- URL: `https://app.hellobonsai.com/public-api/v1/tasks/{task_id}/comments`
- Auth: one of:
  - OAuth 2
    - Authorization code: `https://app.hellobonsai.com/oauth/authorize`
    - Token URL: `https://app.hellobonsai.com/oauth/token`
  - HTTP bearer

Posts a comment on one task, attributed to whoever the
token belongs to. `body` is the only field, and unsafe HTML is stripped
before it is stored. A task you cannot see returns
`404`.

Posting a comment notifies the people already following that task — its assignee and anyone subscribed to it. Who gets notified
is decided entirely by the task, never by what the
comment says.

**@-mentions do not work here.** Writing `@Alex` in `body` stores those
characters and nothing more: it does not link to Alex, does not notify
Alex, and there is no parameter that would. If you need to reach a
specific person, this is not the endpoint for it.

Attachments are not supported either.

## Path parameters

- `task_id` string, required

## Request body

- object
  - `comment` object, required
    - `body` string, required: What the comment says. Required. Unsafe HTML is stripped, and `@Name` is stored as plain text without mentioning or notifying anyone.

## Response `201`

The comment was posted.

- object
  - `data` Comment, required: An entry on a task or deal thread: either something a person wrote, or activity Bonsai recorded on its own.
    - `id` integer, required: Unique identifier for the comment.
    - `kind` 'user_created' | 'event', required: `user_created` for a comment someone wrote, `event` for an entry Bonsai recorded automatically, such as a status change or a reassignment.
    - `commentable_type` string, nullable, required: Type of record the comment is attached to — `Task` or `Deal`.
    - `created_at` string, date-time, required: When the comment was posted.
    - `body_plain_text` string, nullable, required: The comment body with all HTML removed.
    - `commentable_id` string, nullable, required: Identifier of the record the comment is attached to, always serialized as a string: the task's `uuid` for a task comment, the numeric id for a deal comment.
    - `author_member_id` integer, nullable, required: Team member id of the author, or `null` when the author is no longer a member of your account.
  - `meta` Meta, required: Metadata returned alongside every single-resource response.
    - `request_id` string, required: Identifier for this request. Quote it when contacting support about a specific call.

## Other responses

- `400`: The request body is missing its `comment` wrapper.
- `401`: The access token is missing, expired or invalid.
- `403`: This token is not allowed to comment on this task.
- `404`: No such task in your account, or this token cannot see it.
- `422`: The comment could not be saved — usually an empty `body`.
- `429`: Rate limit exceeded. Wait at least `Retry-After` seconds before trying again.

---

[API](https://skmtc.dev/hellobonsai/apis/bonsai-api.md) - [All operations](https://skmtc.dev/hellobonsai/apis/bonsai-api/llms.txt) - [OpenAPI document](https://skmtc.dev/hellobonsai/apis/bonsai-api/revisions/abf12ed6a8d3?raw)
