## Read all chats

`POST /v1/chats/read-all`

Marks every message in every chat of the current user as read and resets the user's unread counters. Use it for a "Read all" button in the dialog list.

**Important:** the call cannot be undone. The "unread" marks and counters of all the user's chats are reset at once, and there is no way to restore them. To read part of the list, use [Read a list section](/docs/chats/management/read-section); for one dialog, use [Mark as read](/docs/chats/messages/read).

## Parameters

There are no parameters. No request body is sent. Any query parameter or body field is rejected with `400 INVALID_PARAMS`.

## Examples

### curl — personal key

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

### curl — OAuth application

```bash
curl -X POST https://vibecode.bitrix24.com/v1/chats/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/read-all', {
  method: 'POST',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { success, data } = await res.json()
```

### JavaScript — OAuth application

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

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.result` | boolean | `true` — all of the user's chats are read |

## Response example

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

## Error response example

400 — a request body was passed:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Body field `all` is not accepted by POST /v1/chats/read-all. It takes no body fields."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | A query parameter or a body field was passed. Checked before the Bitrix24 call |
| 422 | `BITRIX_ERROR` | Bitrix24 returned an error; the Bitrix24 code is in `error.b24Code` |
| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | Read-only key: marking as read counts as a write, see [access rights](/docs/access-rights) |
| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |

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

## Known specifics

**Marking as read is personal.** Only the counters of the user the call is made on behalf of are reset. With a personal key, that is the key owner; with an application key and a `vibe_session_*` session, it is the employee who opened the application.

## See also

- [Read a list section](/docs/chats/management/read-section)
- [Mark as read](/docs/chats/messages/read)
- [Unread counters](/docs/chats/discovery/counters)
- [Chat management](/docs/chats/management)
