# Comment on a change

`POST /api/v1/changelog-entries/{entry}/comments`

Write a comment under a change, for everybody or for the administrators only.

Markup is stripped from the comment. Every comment waits for an administrator to review it, and a public one is shown to everybody in the meantime. An administrator may hide a public comment, after which only its author reads it.

A comment that is missing or longer than 2,000 characters answers 422 on body.

## Parameters

- `entry` (string, required): The identifier of the change, the 26 characters it reports as id. A change that does not exist or is not published yet answers 404.
- `body` (string, required): The comment, up to 2,000 characters.
- `is_private` (boolean, optional): Whether only the administrators of the instance read it. False when left out.
- `is_anonymous` (boolean, optional): Whether to show it without your name. False when left out, and ignored on a private comment.

## Returns

The new comment object. A change that does not exist answers 404.

- `data` (object): The comment.
- `data.type` (string): Always changelog_comment. It names the kind of record, so a caller holding several kinds can tell them apart without looking at where they came from.
- `data.id` (string): The id of this record, as a string even when it reads as a number. It is what every endpoint naming this record takes.
- `data.attributes` (object): Everything the record holds.
- `data.attributes.author_name` (string): The name of the person who wrote it, or Anonymous, in your language, when they chose not to show it. An anonymous comment shows Anonymous to everybody, its author included.
- `data.attributes.is_mine` (boolean): Whether you wrote it.
- `data.attributes.is_private` (boolean): Whether only the administrators of the instance read it. Only its author sees a private comment in this list.
- `data.attributes.is_anonymous` (boolean): Whether it is shown without the name of its author. A private comment is never anonymous.
- `data.attributes.body` (string): The comment, as plain text.
- `data.attributes.replies` (array): The public answers of the administrators, which is an empty list for a new comment.
- `data.attributes.created_at` (timestamp): When the comment was written, as a count of seconds since 1970.
- `data.attributes.updated_at` (timestamp): When the comment last changed, as a count of seconds since 1970.

## Rate limit

Ten requests per minute, per user, shared by every key and device. Every answer carries the budget left in `X-RateLimit-Remaining`.

## Request

```sh
curl https://my.monicahq.com/api/v1/changelog-entries/01M7NBFWK5XNH908RFDGEAJXKN/comments \
  -X POST \
  -H "Authorization: Bearer $MONICA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
      "body": "Can we book it for the Dundies?",
      "is_anonymous": true
  }'
```

```javascript
const response = await fetch('https://my.monicahq.com/api/v1/changelog-entries/01M7NBFWK5XNH908RFDGEAJXKN/comments', {
  method: 'POST',
  headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    body: 'Can we book it for the Dundies?',
    is_anonymous: true,
  }),
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->post('https://my.monicahq.com/api/v1/changelog-entries/01M7NBFWK5XNH908RFDGEAJXKN/comments', [
    'body' => 'Can we book it for the Dundies?',
    'is_anonymous' => true,
]);
```

## Response

`201`

```json
{
    "data": {
        "type": "changelog_comment",
        "id": "e1a7c3d9-4b52-4f86-9c0e-7d3a5f1b8e26",
        "attributes": {
            "author_name": "Anonymous",
            "is_mine": true,
            "is_private": false,
            "is_anonymous": true,
            "body": "Can we book it for the Dundies?",
            "replies": [],
            "created_at": 1794826800,
            "updated_at": 1794826800
        }
    }
}
```
