# Notification groups

A notification group selects a user's notifications by the module and the event they came from. This page covers listing groups, creating a group with its first condition, renaming and deleting.

## List notification groups

`GET /v1/notifications/groups`

Returns the user's notification groups: system ones and the ones the user created. Call it before changing a group to learn its identifier and current conditions.

## Examples

### curl — personal key

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

### curl — OAuth application

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

const { data } = await res.json()
const ownGroups = data.items.filter((group) => group.isEditable)
console.log('Own groups:', ownGroups.length)
```

### JavaScript — OAuth application

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

const { data } = await res.json()
const ownGroups = data.items.filter((group) => group.isEditable)
console.log('Own groups:', ownGroups.length)
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.items` | array | Notification groups: system ones first, followed by the ones the user created |
| `data.items[].tag` | string | Group identifier. For a system group it is a tag: `confirm`, `mention` or `admin`. For a user group it is a numeric identifier as a string, for example `"12"`. It is passed as a number in the `:groupId` path parameter of the operations below and of the [group conditions](./group-conditions.md) operations |
| `data.items[].title` | string | Group name |
| `data.items[].isEditable` | boolean | `false` for a system group — it cannot be renamed or deleted, and its conditions cannot be changed. `true` for a user group |
| `data.items[].conditions` | object | Conditions by which the group selects notifications |
| `data.items[].conditions.notifyType` | number | Present only on the `confirm` group. The value `1` means the group selects confirmation requests — notifications with reply buttons |
| `data.items[].conditions.moduleConditions` | object | Conditions by module. The key is the module identifier as is, for example `tasks` or `vendor.my_module`. The `all` key is a condition without a module |
| `data.items[].conditions.moduleConditions.<module>.isWhole` | boolean | `true` — the group selects all events of the module, and the `events` list does not restrict the selection. `false` — only the events listed in `events` |
| `data.items[].conditions.moduleConditions.<module>.events` | array | Identifiers of the module events the group selects |

## Response example

HTTP 200:

```json
{
  "success": true,
  "data": {
    "items": [
      {
        "tag": "confirm",
        "title": "Require action",
        "conditions": { "notifyType": 1 },
        "isEditable": false
      },
      {
        "tag": "mention",
        "title": "I was mentioned",
        "conditions": {
          "moduleConditions": {
            "all": { "isWhole": false, "events": ["mention", "mention_comment"] }
          }
        },
        "isEditable": false
      },
      {
        "tag": "12",
        "title": "Tasks and calendar",
        "conditions": {
          "moduleConditions": {
            "tasks": { "isWhole": false, "events": ["comment"] },
            "calendar": { "isWhole": false, "events": ["invite"] }
          }
        },
        "isEditable": true
      }
    ]
  }
}
```

## Error response example

400 — a query parameter was passed:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Query parameter `limit` is not accepted by GET /v1/notifications/groups. It takes no query parameters."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | A query parameter was passed — the operation does not accept query parameters. The parameter name is in `message` |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the request; the portal code is in the `error.b24Code` field |
| 403 | `SCOPE_DENIED` | The key lacks the `im` scope |
| 401 | `TOKEN_MISSING` | The key has no configured tokens |

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

## Known specifics

- Groups belong to the user on whose behalf the call is made. With a personal key, this is the key owner; with an OAuth application key, it is the session user from the `Authorization: Bearer` header. All operations on this page and on [group conditions](./group-conditions.md) work with the groups of the same user.

## Create a notification group

`POST /v1/notifications/groups`

Creates a notification group together with its first condition — a module and event pair. Further conditions are added to an existing group with the [Add a condition to a group](./group-conditions.md) operation.

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `title` | string | yes | Group name, 1 to 255 characters |
| `module` | string | yes | Module identifier of the first condition, 1 to 255 characters. Modules are listed in the `data[].id` field of [`GET /v1/notifications/settings`](./settings.md); the module of a specific notification is in the `notifyModule` field of the [notification feed](./list.md) |
| `event` | string | yes | Identifier of an event of this module, 1 to 255 characters. The module's events are listed in the `data[].notices[].id` field of [`GET /v1/notifications/settings`](./settings.md); the event of a specific notification is in the `notifyEvent` field of the [notification feed](./list.md) |

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/notifications/groups" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "title": "Tasks and calendar", "module": "tasks", "event": "comment" }'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/notifications/groups" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "title": "Tasks and calendar", "module": "tasks", "event": "comment" }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/notifications/groups', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ title: 'Tasks and calendar', module: 'tasks', event: 'comment' }),
})

const { data } = await res.json()
console.log('Group ID:', data.id)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/notifications/groups', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ title: 'Tasks and calendar', module: 'tasks', event: 'comment' }),
})

const { data } = await res.json()
console.log('Group ID:', data.id)
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.id` | number | Identifier of the new group. In the group list it arrives as a string in the `tag` field |

## Response example

HTTP 200:

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

## Error response example

400 — `title` was not passed:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Body field `title` must be a non-empty string of up to 255 characters."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | `title`, `module` or `event` was not passed, is not a string, is an empty string or is longer than 255 characters. The field name is in `message` |
| 400 | `INVALID_PARAMS` | A body field not listed in the table above or a query parameter was passed, or the body is not a JSON object |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the creation; the portal 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).

## Rename a notification group

`PATCH /v1/notifications/groups/:groupId`

Changes the name of a group the user created. The group's conditions do not change — they are edited with the [group conditions](./group-conditions.md) operations.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `groupId` (path) | number | yes | Group identifier — the `tag` value of a group with `isEditable: true` from the [group list](#list-notification-groups), passed as a number. The system groups `confirm`, `mention` and `admin` have no numeric identifier |

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `title` | string | yes | New group name, 1 to 255 characters |

## Examples

### curl — personal key

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/notifications/groups/12" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "title": "Work notifications" }'
```

### curl — OAuth application

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/notifications/groups/12" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "title": "Work notifications" }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/notifications/groups/12', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ title: 'Work notifications' }),
})

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

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/notifications/groups/12', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ title: 'Work notifications' }),
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `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

404 — the group does not exist:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Notification group was not found.",
    "b24Code": "GROUP_NOT_FOUND"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | `groupId` is not a positive integer, including a system group tag such as `mention` |
| 400 | `INVALID_PARAMS` | `title` was not passed, is not a string, is an empty string or is longer than 255 characters |
| 400 | `INVALID_PARAMS` | A body field not listed in the table above or a query parameter was passed, or the body is not a JSON object. The field name is in `message` |
| 404 | `ENTITY_NOT_FOUND` | The group does not exist — it was deleted or belongs to another user. The portal code `GROUP_NOT_FOUND` is in the `error.b24Code` field. On a portal whose interface language is neither Russian nor English, the same refusal arrives as `422 BITRIX_ERROR` — rely on `error.b24Code` |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the change; the portal 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).

## Delete a notification group

`DELETE /v1/notifications/groups/:groupId`

Deletes a group the user created, together with all its conditions; the notifications themselves stay in the feed. A deleted group cannot be restored via the API — create a new one if needed.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `groupId` (path) | number | yes | Group identifier — the `tag` value of a group with `isEditable: true` from the [group list](#list-notification-groups), passed as a number. The system groups `confirm`, `mention` and `admin` have no numeric identifier |

## Examples

### curl — personal key

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

### curl — OAuth application

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

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

### JavaScript — OAuth application

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

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `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

404 — the group does not exist:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Notification group was not found.",
    "b24Code": "GROUP_NOT_FOUND"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | `groupId` is not a positive integer, including a system group tag such as `mention` |
| 400 | `INVALID_PARAMS` | A body field or a query parameter was passed — the operation does not accept them — or the body is not a JSON object. The field name is in `message` |
| 404 | `ENTITY_NOT_FOUND` | The group does not exist — it was already deleted (including automatically, when its last [condition](./group-conditions.md) was removed) or belongs to another user. The portal code `GROUP_NOT_FOUND` is in the `error.b24Code` field. On a portal whose interface language is neither Russian nor English, the same refusal arrives as `422 BITRIX_ERROR` — rely on `error.b24Code` |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the deletion; the portal 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).

## See also

- [Notification group conditions](./group-conditions.md)
- [Notification settings](./settings.md)
- [Notification feed](./list.md)
- [Notifications](/docs/notifications)
- [Errors](/docs/errors)
