# Comments API

The Comments API: post, read, edit and delete comments on images and folders, with every endpoint's fields, who may call it, its rate limit and a curl example.

## Create a new comment

`POST /comments`

Needs a session token. Rate limit: 120 a minute, per address. An app's token or an API key needs the `comments:write` scope.

### Body

| Field | Type | Required | Notes |
|---|---|---|---|
| `referenceType` | `enum` | required | One of `Image`, `Folder`. |
| `referenceId` | `number` | required |  |
| `parentId` | `number \| null` | required | The comment this one answers, on the same image or folder, or `null` to start a thread. |
| `content` | `string` | required | At least 1 characters. |
| `shareCode` | `string` | required |  |

### Response

Returns a [Comment](https://hematite.gg/docs/developers/models/comment).

```bash
curl -X POST 'https://api.hematite.gg/v1/comments' \
  -H "Authorization: $HEMATITE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"referenceType":"Image","referenceId":1,"parentId":1,"content":"That last round","shareCode":"x7Kp2QmA"}'
```

Example `data`:

```json
{
  "id": 1,
  "userId": 1,
  "createdAt": "2026-11-10T18:24:00.000Z",
  "updatedAt": "2026-11-10T18:24:00.000Z",
  "referenceType": "Image",
  "referenceId": 1,
  "content": "That last round",
  "parentId": null,
  "offlineAt": "2026-11-10T18:24:00.000Z",
  "likeCount": 0
}
```

## Get a single comment by ID

`GET /comments/:commentId`

Needs a session token. Rate limit: 120 a minute, per address. An app's token or an API key needs the `comments:read` scope.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `commentId` | `any` | required | The comment's id. |

### Response

Returns a [Comment](https://hematite.gg/docs/developers/models/comment).

```bash
curl 'https://api.hematite.gg/v1/comments/1' \
  -H "Authorization: $HEMATITE_TOKEN"
```

Example `data`:

```json
{
  "id": 1,
  "userId": 1,
  "createdAt": "2026-11-10T18:24:00.000Z",
  "updatedAt": "2026-11-10T18:24:00.000Z",
  "referenceType": "Image",
  "referenceId": 1,
  "content": "That last round",
  "parentId": null,
  "offlineAt": "2026-11-10T18:24:00.000Z",
  "likeCount": 0
}
```

## Update a comment by ID

`PATCH /comments/:commentId`

Needs a session token. Rate limit: 120 a minute, per address. An app's token or an API key needs the `comments:write` scope.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `commentId` | `any` | required | The comment's id. |

### Body

| Field | Type | Required | Notes |
|---|---|---|---|
| `content` | `string` | required | At least 1 characters. |

### Response

Returns a [Comment](https://hematite.gg/docs/developers/models/comment).

```bash
curl -X PATCH 'https://api.hematite.gg/v1/comments/1' \
  -H "Authorization: $HEMATITE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"content":"That last round"}'
```

Example `data`:

```json
{
  "id": 1,
  "userId": 1,
  "createdAt": "2026-11-10T18:24:00.000Z",
  "updatedAt": "2026-11-10T18:24:00.000Z",
  "referenceType": "Image",
  "referenceId": 1,
  "content": "That last round",
  "parentId": null,
  "offlineAt": "2026-11-10T18:24:00.000Z",
  "likeCount": 0
}
```

## Delete a comment by ID

`DELETE /comments/:commentId`

Needs a session token. Rate limit: 120 a minute, per address. An app's token or an API key needs the `comments:write` scope.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `commentId` | `any` | required | The comment's id. |

### Response

`data` is empty.

```bash
curl -X DELETE 'https://api.hematite.gg/v1/comments/1' \
  -H "Authorization: $HEMATITE_TOKEN"
```
