## List knowledge base bindings to workgroups

`GET /v1/sites/group-bindings`

Returns knowledge base bindings to the Bitrix24 account's workgroups, all at once or for one group.

How a binding affects the site type is described in [Knowledge base bindings to a workgroup](/docs/entities/sites/group-binding).

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `groupId` (query) | number | no | Workgroup ID. List: `GET /v1/workgroups`. A positive integer. An empty value, zero or a non-numeric string returns `400 INVALID_PARAMS`. Without the parameter, bindings of all groups are returned |
| `scope` (query) | string | no | Site scope: `KNOWLEDGE`, `GROUP` or `MAINPAGE`. Any other value returns `400 INVALID_SCOPE` |

There is no pagination: the response contains all bindings matching the filter in a single array. The `limit` and `offset` parameters are ignored.

## Examples

### curl — personal key

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

### curl — OAuth application

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

const { success, data } = await res.json()
console.log(`Bindings: ${data.length}`)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/group-bindings', {
  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` | array | Array of bindings. An empty array if no bindings match the filter |
| `data[].siteId` | number | Knowledge base site ID. Get the site: `GET /v1/sites/:id?scope=GROUP` |
| `data[].groupId` | number | Workgroup ID. Get the group: `GET /v1/workgroups/:id` |
| `data[].title` | string | Site title. An empty string if no title was returned |
| `data[].publicUrl` | string | Public URL of the knowledge base site. An empty string if no URL was returned |

## Response example

```json
{
  "success": true,
  "data": [
    {
      "siteId": 125,
      "groupId": 51,
      "title": "Knowledge base",
      "publicUrl": "https://example.bitrix24.com/knowledge/group/knowledge_base/"
    },
    {
      "siteId": 95,
      "groupId": 7,
      "title": "Support knowledge base",
      "publicUrl": "https://example.bitrix24.com/knowledge/group/support_knowledge_base/"
    }
  ]
}
```

## Error response example

400 — empty `groupId` value:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "groupId must be a positive safe integer"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | `groupId` is passed but is not a positive integer, including an empty value |
| 400 | `INVALID_SCOPE` | `scope` is not `KNOWLEDGE`, `GROUP` or `MAINPAGE` |
| 422 | `BITRIX_ERROR` | 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 portal plan does not allow the call |
| 403 | `SCOPE_DENIED` | The API key does not have the `landing` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |
| 429 | `RATE_LIMITED` | Bitrix24 throttled requests to the portal. 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 request only reads data, so a retry is safe |
| 503 | `BITRIX_TIMEOUT` | Bitrix24 did not respond in time. The request only reads data, so a retry is safe |

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

## Known specifics

**The list contains only site bindings.** Bindings of individual knowledge base pages to a group are not included in the response, so `siteId` always points to a site, not a page.

## See also

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