# Add a Comment

> Reply to the requester on their channel or add an internal note to a LemuTickets ticket

URL: https://docs.lemuai.com/tickets-api/tickets/add-comment

Adds a comment to a ticket. A comment is either:

- a **public reply**, sent to the requester on the ticket's channel (email, WhatsApp, the portal), or
- an **internal note**, seen only by your team.

**Endpoint:** `POST /v1/tickets/{ref}/comments`

A public reply needs the `tickets.write` scope. An internal note needs `comments.internal`.

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `ref` | string | Yes | The ticket key (`SUP-1042`) or id. |

## Headers

| Name | Required | Description |
|---|---|---|
| `Idempotency-Key` | No, but recommended | A unique value for this comment. Sending the same request again returns the first comment instead of posting twice. See [idempotency keys](https://docs.lemuai.com/tickets-api/conventions#idempotency-keys). |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `body` | string | Yes | The text. Plain text or simple HTML. |
| `visibility` | string | No | `internal` (default) or `public`. |
| `channel` | string | No | For public replies: `email`, `whatsapp`, `portal`, `slack` or `voice`. Defaults to the channel the ticket came in on. |
| `mentions` | array of UUIDs | No | Users to mention. They are notified and become watchers. |
| `attachment_ids` | array of UUIDs | No | Files from [Upload an attachment](https://docs.lemuai.com/tickets-api/attachments/upload) to attach to this comment. |
| `whatsapp_template` | object | No | An approved WhatsApp template (`name`, `language`, `variables`) to send instead of free text. WhatsApp only allows free text within 24 hours of the customer's last message. |

**Note:** Public replies on WhatsApp go out through Lemu AI, so your organization needs the Lemu AI connection set up in LemuTickets. A ticket that came from a phone call has no channel to reply on: the reply is saved on the ticket but not sent.

**Example request:**
```bash
curl -X POST https://api.tickets.lemuai.com/v1/tickets/SUP-1042/comments \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: erp-note-77812" \
  -d '{
    "body": "Finance confirmed the refund was approved. Reference RF-99120.",
    "visibility": "internal",
    "mentions": ["0e2a4c6b-8d1f-4a3e-9b5c-7d9f1a3c5e7b"]
  }'
```

## Response

**`201`**
```json
{
  "id": "c5e7a9b1-d3f2-4c6e-8a0b-2e4c6a8b0d1f",
  "ticket_id": "2f9c7e1a-5b3d-4c8e-9a6f-1d0e2b4c6a8f",
  "visibility": "internal",
  "body": "Finance confirmed the refund was approved. Reference RF-99120.",
  "body_text": "Finance confirmed the refund was approved. Reference RF-99120.",
  "author_type": "user",
  "author": {
    "type": "user",
    "id": "d1f3b5a7-c9e2-4b4d-8f6a-0c2e4a6b8d0f",
    "name": "API: ERP sync",
    "avatar_url": null
  },
  "channel": "none",
  "delivery_status": null,
  "delivery_error": null,
  "mentions": ["0e2a4c6b-8d1f-4a3e-9b5c-7d9f1a3c5e7b"],
  "meta": {},
  "attachments": [],
  "created_at": "2026-11-25T09:52:11.018000+00:00",
  "edited_at": null
}
```

| Field | Type | Description |
|---|---|---|
| `id` | string | The comment's id. |
| `ticket_id` | string | The ticket. |
| `visibility` | string | `public` or `internal`. |
| `body` | string | The text as sent. |
| `body_text` | string | The text without HTML. |
| `author_type` | string | `user`, `requester`, `ai` or `system`. |
| `author` | object | `type`, `id` and `name` of the author (`avatar_url` for users). |
| `channel` | string | Where a public reply was sent: `email`, `whatsapp`, `portal`, `slack`, `voice`, or `none` for internal notes and replies with no channel. |
| `delivery_status` | string or null | For public replies sent on a channel: `queued` at first, then for example `sent`, `delivered`, `read` or `failed`. `null` when nothing is sent. |
| `delivery_error` | string or null | Why delivery failed. |
| `mentions` | array of strings | Mentioned user ids. |
| `meta` | object | Extra details, such as the WhatsApp template used. |
| `attachments` | array | Files on the comment: `id`, `filename`, `content_type`, `size_bytes`. |
| `created_at` | string | When it was added. |
| `edited_at` | string or null | When it was last edited. |

Delivery happens after the response. Listen for the `comment.delivery_updated` [webhook](https://docs.lemuai.com/tickets-api/webhooks), or read the comment again with [List comments](https://docs.lemuai.com/tickets-api/tickets/list-comments), to see whether it arrived.

The first public reply on a ticket sets its `first_response_at`, which meets the first response SLA.

## Errors

| Status | `code` | When |
|---|---|---|
| `403` | `missing_capability` | The key cannot write internal notes, or cannot reply to requesters |
| `404` | `ticket_not_found` | No ticket with this key or id, or you cannot see it |
| `409` | `idempotency_mismatch` | The `Idempotency-Key` was used before with a different body |
| `422` | `invalid_fields` | `body` is missing or `visibility` is not `public` or `internal` |
| `422` | `empty_comment` | `body` only has spaces |
