## Mark all channel comments as read

`POST /v1/chats/:dialogId/comments/read-all`

Marks all comments on all posts in the channel as read for you.

## Parameters

| Parameter | Type | Required | Default | Description |
|----------|-----|:-----:|-----------|---------|
| `dialogId` (path) | string | yes | — | Dialog ID of the channel, `chatXXX` — the `dialogId` field of a [recent dialogs](/docs/chats/discovery/recent) row. The `me` alias addresses your personal dialog, not a channel, and results in `422 WRONG_MESSAGE_TYPE` |

No body is needed. Query parameters and body fields are rejected with `400 INVALID_PARAMS`.

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/chats/chat2000/comments/read-all" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/chats/chat2000/comments/read-all" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat2000/comments/read-all', {
  method: 'POST',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { data } = await res.json()
console.log('Comments read:', data.result)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat2000/comments/read-all', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { data } = await res.json()
console.log('Comments read:', data.result)
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.result` | boolean | `true` — the channel comments were marked as read |

## Response example

```json
{
  "success": true,
  "data": { "result": true }
}
```

## Error response example

422 — the chat is not a channel:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "WRONG_MESSAGE_TYPE",
    "b24Code": "WRONG_MESSAGE_TYPE"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | The body is not a JSON object, or a query parameter or body field was passed. Checked before any call to Bitrix24 |
| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned a generic "not found" code or an error with the text "not found". The portal code is in `error.b24Code` |
| 422 | `BITRIX_ERROR` | Bitrix24 returned an error, the portal code is in `error.b24Code`. `CHAT_NOT_FOUND` — there is no chat with this `dialogId`, `WRONG_MESSAGE_TYPE` — the chat is not a channel |
| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only: marking comments as read changes data — see [access rights](/docs/access-rights) |
| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |
| 502 | `ME_ALIAS_RESOLUTION_FAILED` | Could not resolve the current user for `dialogId` = `me` |

The full list of common API errors — [Errors](/docs/errors).

## Known specifics

**A repeated call is not an error.** The response is `true` even when the channel has no unread comments.

## See also

- [Comment summary for posts](/docs/chats/messages/comments)
- [Follow the comments of a post](/docs/chats/messages/comments-subscription-create)
- [Stop following the comments of a post](/docs/chats/messages/comments-subscription-delete)
- [Recent dialogs](/docs/chats/discovery/recent)
