## Remove chat anchors

`POST /v1/chats/:dialogId/anchors/read`

Removes all your anchors in the chat. An anchor is a mark the Bitrix24 messenger places for you on an unread mention or on a reaction to your message: the client uses it to show the mention counter and to jump to the right message. To remove anchors only on selected messages, use [`POST /v1/chats/anchors/read`](/docs/chats/messages/anchors-messages).

## Parameters

| Parameter | Type | Required | Default | Description |
|----------|-----|:-----:|-----------|---------|
| `dialogId` (path) | string | yes | — | Dialog ID: a numeric user ID for direct messages, `chatXXX` for group chats — the `dialogId` field of a [recent dialogs](/docs/chats/discovery/recent) row; a user ID comes from the [user list](/docs/entities/users/list). `me` — the current user's personal dialog |

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/chat42/anchors/read" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

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

const { success } = await res.json()
console.log('Anchors removed:', success)
```

### JavaScript — OAuth application

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

const { success } = await res.json()
console.log('Anchors removed:', success)
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | boolean | `true`, even when there was nothing to remove |

## Response example

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

## Error response example

400 — a query parameter was passed:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Query parameter `foo` is not accepted by POST /v1/chats/:dialogId/anchors/read. It takes no query parameters."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | A query parameter or a body field was passed. Checked before any call to Bitrix24 |
| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned "not found"; the portal code is in `error.b24Code` |
| 422 | `BITRIX_ERROR` | Bitrix24 returned an error; the portal code is in `error.b24Code` |
| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only — 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

**This is a write operation, even though the method is called `read`.** The call deletes marks, so a read-only key gets `403 WRITE_BLOCKED_READONLY_KEY` before any call to Bitrix24.

**List of anchors.** To retrieve all your mention and reaction marks, [list unread anchors](/docs/chats/messages/anchors-list).

**Messages do not become read.** Removing anchors does not move the read marker — to do that, [mark the dialog as read](/docs/chats/messages/read).

## See also

- [Remove message anchors](/docs/chats/messages/anchors-messages)
- [Mark as read](/docs/chats/messages/read)
- [Messages around a message](/docs/chats/messages/context)
