## Remove managers

`DELETE /v1/chats/:dialogId/managers`

Takes the manager role away from the given users. They stay in the chat as members. Only a new [assignment](/docs/chats/members/managers-add) gives the role back.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `dialogId` (path) | string | yes | Group chat identifier `chatXXX`. A personal dialog is refused |
| `userIds` (query) | string | yes | From 1 to 50 user IDs separated by commas, for example `5,7`. Each is a positive integer without spaces or leading zeros. A repeated ID is allowed and counts toward the 50 |

The request takes no body: a body field, another parameter or a repeated parameter is rejected with `400 INVALID_PARAMS`.

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/chats/chat42/managers?userIds=7" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/chats/chat42/managers?userIds=7" \
  -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/managers?userIds=7', {
  method: 'DELETE',
  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/chat42/managers?userIds=7', {
  method: 'DELETE',
  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` — the request was carried out. It does not confirm that each of the given users was a manager |

## Response example

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

## Error response example

400 — IDs in the wrong format:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "`userIds` must be 1-50 Bitrix24 user ids separated by commas (4,7), each a positive integer without spaces or leading zeros."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | `userIds` is absent, holds more than 50 IDs or an ID that is not a positive integer; another parameter, a repeated parameter or a body field. Checked before any call to Bitrix24 |
| 403 | `BITRIX_ACCESS_DENIED` | No right to change the managers, or `dialogId` is a personal dialog |
| 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 |
| 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`. A missing chat lands here with the code `CHAT_NOT_FOUND` |
| 502 | `ME_ALIAS_RESOLUTION_FAILED` | The user could not be resolved for the `me` alias |

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

## Known specifics

**The IDs go in the query.** A `DELETE` body does not pass through every proxy, so the list is passed in the query string, and a body field is rejected.

**A user without the role is skipped** without an error, and the response stays the same. The [membership records](/docs/chats/members/relations) show the result.

## See also

- [Add managers](/docs/chats/members/managers-add)
- [Replace managers](/docs/chats/members/managers-set)
- [Membership records](/docs/chats/members/relations)
- [Chat members](/docs/chats/members)
