## Unbind a knowledge base from a workgroup

`DELETE /v1/sites/:id/group-binding/:groupId`

Removes the binding of a knowledge base site to a Bitrix24 workgroup, after which the knowledge base no longer belongs to the group.

For the site type after unbinding, see [Knowledge base bindings to a workgroup](/docs/entities/sites/group-binding).

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Site ID. List of bound sites: `GET /v1/sites/group-bindings` |
| `groupId` (path) | number | yes | ID of the workgroup the site is unbound from. List: `GET /v1/sites/group-bindings` |
| `scope` (query) | string | no | Site scope: `KNOWLEDGE`, `GROUP` or `MAINPAGE` |

No request body is sent.

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/sites/235/group-binding/171" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

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

const { data } = await res.json()
console.log(data.type, data.bindings)
```

### JavaScript — OAuth application

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

const { data } = await res.json()
console.log(data.type, data.bindings)
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | object | The site and its bindings to the group, re-read after the operation |
| `data.id` | number | Site ID |
| `data.title` | string | Site title |
| `data.type` | string | Site type after the binding is removed — `KNOWLEDGE` |
| `data.active` | boolean | Whether the site is published |
| `data.deleted` | boolean | Whether the site is in the trash |
| `data.bindings` | array | The site's bindings to the `groupId` group from the path, re-read after the operation. After a successful unbind — an empty array |
| `data.bindings[].siteId` | number | Site ID |
| `data.bindings[].groupId` | number | Workgroup ID |
| `data.bindings[].title` | string | Knowledge base title. An empty string if no title was returned |
| `data.bindings[].publicUrl` | string | Knowledge base URL inside the group. An empty string if no URL was returned |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 235,
    "title": "VIBE-PROBE",
    "type": "KNOWLEDGE",
    "active": false,
    "deleted": false,
    "bindings": []
  }
}
```

## Error response example

404 — site not found:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Site not found or not visible"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | `groupId` in the path is not a positive integer |
| 400 | `INVALID_PARAMS` | `id` in the path is not a positive integer |
| 400 | `INVALID_PARAMS` | A non-empty body was passed — message `DELETE takes no body` |
| 400 | `INVALID_SCOPE` | `scope` is not `KNOWLEDGE`, `GROUP` or `MAINPAGE` |
| 404 | `ENTITY_NOT_FOUND` | No site with this `id` among knowledge bases, group sites and sites in the requested `scope` — message `Site not found or not visible` |
| 404 | `ENTITY_NOT_FOUND` | The binding was removed, but the site was not found on re-read — message `Site is no longer visible after the binding action` |
| 409 | `SITE_BINDING_TYPE_MISMATCH` | The site type is neither `KNOWLEDGE` nor `GROUP` |
| 409 | `LANDING_MODULE_NOT_ENABLED` | The Sites module is unavailable on this Bitrix24 account. Ask a Bitrix24 account administrator to enable it — until then a retry returns the same refusal |
| 422 | `BITRIX_ERROR` | Bitrix24 refused to unbind: the site is not bound to this group, the site is not writable, or the user has no permissions on the group |
| 422 | `BITRIX_ERROR` | The binding was removed, but Bitrix24 returned the list of bindings in an unexpected format |
| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied access to the key owner |
| 403 | `B24_TARIFF_RESTRICTION` | The Bitrix24 account's plan does not allow the call |
| 403 | `SCOPE_DENIED` | The API key does not have the `landing` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only. The request is refused before any call to the Bitrix24 account |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |
| 429 | `RATE_LIMITED` | Bitrix24 throttled requests to the Bitrix24 account. Retry after the delay from the `Retry-After` header |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 responded with a server error or the connection dropped before a complete response. The operation may have succeeded — re-read the bindings before retrying |
| 503 | `BITRIX_TIMEOUT` | Bitrix24 did not respond in time. The operation may have succeeded — re-read the bindings before retrying |

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

## Known specifics

**Retry after a dropped connection.** If the response to the first call is lost and the binding is already removed, a repeated call returns `422 BITRIX_ERROR`. Before retrying, check the state with `GET /v1/sites/group-bindings?groupId=171`: if your `id` is not in the response, the binding is already removed.

## See also

- [Knowledge base bindings to a workgroup](/docs/entities/sites/group-binding)
- [List knowledge base bindings to workgroups](/docs/entities/sites/group-binding/list)
- [Bind a knowledge base to a workgroup](/docs/entities/sites/group-binding/bind)
- [Knowledge base menu bindings](/docs/entities/sites/menu-bindings)
- [List sites](/docs/entities/sites/list)
- [List workgroups](/docs/entities/workgroups/list)
- [Errors](/docs/errors)
