
## Delete a workgroup

`DELETE /v1/workgroups/:id`

Deletes a workgroup and all data associated with it. The operation is irreversible.

## Parameters

| Parameter | Type | Req. | Default | Description |
|----------|-----|:-----:|-----------|---------|
| `id` (path) | number | ★ yes | — | Workgroup identifier. List: [`GET /v1/workgroups`](./list.md) |

## Examples

### curl — personal key

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

### curl — OAuth application

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

if (res.status === 204) {
  console.log('Workgroup deleted')
}
```

### JavaScript — OAuth application

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

if (res.status === 204) {
  console.log('Workgroup deleted')
}
```

## Response

On successful deletion the HTTP status `204 No Content` is returned with an empty body — success is checked by the status.

## Response example

```http
HTTP/1.1 204 No Content
```

## Error response example

422 — an attempt to delete a non-existent group:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Socialnetwork group not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 422 | `BITRIX_ERROR` | Bitrix24 declined the deletion. Typical reasons: the group does not exist, no permission to delete |
| 401 | `MISSING_API_KEY` | `X-Api-Key` was not passed |
| 401 | `INVALID_API_KEY` | An invalid key was passed |
| 403 | `SCOPE_DENIED` | The key is missing the `sonet_group` scope |

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

## Known specifics

- To temporarily hide a group without losing data, use [`PATCH /v1/workgroups/:id`](./update.md) with `archived: true` — the group will stop appearing in active lists but will remain available for restoration.
- The `Socialnetwork group not found` message is returned both when the group is missing and when there are no permissions to delete — the exact reason cannot be determined from the response.

## See also

- [List workgroups](./list.md)
- [Get a workgroup](./get.md)
- [Update a workgroup](./update.md)
