## Delete all notifications

`DELETE /v1/notifications`

Irreversible: deletes all notifications of the key owner, and they cannot be restored. Call it only when the feed has to be cleared completely.

## Parameters

There are no parameters and no body — only the URL. Any query string parameter and any body field are rejected with `400 INVALID_PARAMS` before the Bitrix24 call, and nothing is deleted: an identifier passed outside the path does not result in deleting the whole feed. An empty `{}` object in the body is allowed.

[`DELETE /v1/notifications/:id`](./delete.md) deletes a single notification, and [`DELETE /v1/notifications/by-tag/:tag`](./delete-by-tag.md) deletes notifications with a given tag.

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/notifications" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

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

const { success } = await res.json()
if (success) {
  console.log('All notifications deleted')
}
```

### JavaScript — OAuth application

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

const { success } = await res.json()
if (success) {
  console.log('All notifications deleted')
}
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | `true` on successful deletion |
| `data` | boolean | Always `true`. The success indicator is the HTTP code `200`, not the value |

## Response example

HTTP 200:

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

## Error response example

400 — a body field was passed, nothing was deleted:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Body field `id` is not accepted by DELETE /v1/notifications. It takes no body fields."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | A query string parameter or a body field was passed, or the body is not a JSON object. The parameter is named in the message. Checked before the Bitrix24 call — nothing is deleted |
| 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 call deletes the token owner's notifications: with a personal key, those of the key owner; with an OAuth application key and the `Authorization: Bearer` header, those of the user who owns the session.
- The whole feed is deleted, not only the notifications of your application: system notifications and notifications of other applications on the Bitrix24 account are deleted too. To remove only your own, send them with a `tag` and delete them [by tag](./delete-by-tag.md).
- Verify success with the `200` status code and `success: true`. Deleting by id and by tag both return `204` with no body; this operation does not.
- The response does not say how many notifications were deleted. The result is visible in the [notification feed](./list.md): after the call the `notifications` array is empty, and `totalCount` and `totalUnreadCount` equal `0`.

## See also

- [Delete by id](./delete.md)
- [Delete by tag](./delete-by-tag.md)
- [Notification feed](./list.md)
- [Errors](/docs/errors)
