
## Mark all as read

`POST /v1/notifications/read-all`

Marks all of the key owner's notifications as read in a single call, without listing their identifiers.

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `excludeIds` | number[] | no | Notifications to leave unread — 0 to 100 positive integer identifiers. An identifier is the `id` field of a notification in the [feed](./list.md) or `notificationId` from the [`POST /v1/notifications`](./send.md) response. An empty list is equivalent to omitting the field |

The body is optional; if you omit it, omit the `Content-Type: application/json` header as well. Any other body field and any query string parameter are rejected with `400 INVALID_PARAMS` before the Bitrix24 call.

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/notifications/read-all" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "excludeIds": [38964] }'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/notifications/read-all" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "excludeIds": [38964] }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/notifications/read-all', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ excludeIds: [38964] }),
})

const { data } = await res.json()
console.log('Unread remaining:', data.counter)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/notifications/read-all', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ excludeIds: [38964] }),
})

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

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | `true` on success |
| `data.counter` | number | Unread notification counter after the call |
| `data.excludeIds` | number[] | Notifications left unread: the ones passed in `excludeIds` and confirmations — notifications with reply buttons |

## Response example

HTTP 200:

```json
{
  "success": true,
  "data": {
    "counter": 1,
    "excludeIds": [38964]
  }
}
```

## Error response example

400 — the `ids` field instead of `excludeIds`:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Body field `ids` is not accepted by POST /v1/notifications/read-all. Accepted: excludeIds."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | `excludeIds` is not an array of 0–100 positive integer identifiers, another body field or a query string parameter was passed, or the body is not a JSON object. The field is named in the message. Checked before the Bitrix24 call |
| 400 | `FST_ERR_CTP_EMPTY_JSON_BODY` | The `Content-Type: application/json` header was sent with an empty body. Send `{}` or remove the header |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the call. The portal error code is in the `error.b24Code` field |
| 403 | `SCOPE_DENIED` | The key lacks the `im` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode |
| 401 | `TOKEN_MISSING` | The key has no configured tokens |

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

## Known specifics

- The operation does not mark confirmations (notifications with reply buttons) as read: they stay unread even if they are not listed in `excludeIds`.
- The operation marks the token owner's notifications: with a personal key, the key owner's; with an OAuth application key and the `Authorization: Bearer` header, the session user's.
- To mark only selected notifications as read, use the v2 mode of the [Mark as read](./read.md) operation with the `ids` field.

## See also

- [Mark as read](./read.md)
- [Notification feed](./list.md)
- [Delete all notifications](./delete-all.md)
- [Errors](/docs/errors)
