لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/entities/sites/group-binding/bind.md فهرس التوثيق — /llms.txt

مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.

Bind a knowledge base to a workgroup

POST /v1/sites/:id/group-binding

Binds a knowledge base site to a Bitrix24 workgroup, making the site that group's knowledge base.

For how a binding changes the site type and how to read the pages of a bound site, see Knowledge base bindings to a workgroup.

Parameters

Parameter Type Required Description
Parameterid (path) Typenumber Requiredyes DescriptionKnowledge base site ID. List: GET /v1/sites?scope=KNOWLEDGE
Parameterscope (query) Typestring Requiredno DescriptionSite scope: KNOWLEDGE, GROUP or MAINPAGE

Request fields (body)

Field Type Required Description
FieldgroupId Typenumber Requiredyes DescriptionWorkgroup ID. List: GET /v1/workgroups

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/sites/235/group-binding" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"groupId": 171}'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/sites/235/group-binding" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"groupId": 171}'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/235/group-binding', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ groupId: 171 }),
})

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', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ groupId: 171 }),
})

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

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata Typeobject DescriptionThe site and its bindings to the group, re-read after the operation
Fielddata.id Typenumber DescriptionSite ID
Fielddata.title Typestring DescriptionSite title
Fielddata.type Typestring DescriptionSite type after binding — GROUP
Fielddata.active Typeboolean DescriptionWhether the site is published
Fielddata.deleted Typeboolean DescriptionWhether the site is in the trash
Fielddata.bindings Typearray DescriptionThe site's bindings to the workgroup passed in groupId, re-read after the operation
Fielddata.bindings[].siteId Typenumber DescriptionSite ID
Fielddata.bindings[].groupId Typenumber DescriptionWorkgroup ID
Fielddata.bindings[].title Typestring DescriptionKnowledge base title. An empty string if no title was returned
Fielddata.bindings[].publicUrl Typestring DescriptionKnowledge 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": "GROUP",
    "active": false,
    "deleted": false,
    "bindings": [
      {
        "siteId": 235,
        "groupId": 171,
        "title": "VIBE-PROBE",
        "publicUrl": "https://example.bitrix24.com/knowledge/group/vibe-probe-bind/"
      }
    ]
  }
}

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
HTTP400 CodeMISSING_REQUIRED_FIELDS DescriptionThe body has no groupId field or is not an object
HTTP400 CodeINVALID_PARAMS DescriptionThe body has fields other than groupId — message Only groupId is accepted
HTTP400 CodeINVALID_PARAMS DescriptiongroupId is not a positive integer
HTTP400 CodeINVALID_PARAMS Descriptionid in the path is not a positive integer
HTTP400 CodeINVALID_SCOPE Descriptionscope is not KNOWLEDGE, GROUP or MAINPAGE
HTTP404 CodeENTITY_NOT_FOUND DescriptionNo site with this id among knowledge bases, group sites or sites in the requested scope — message Site not found or not visible
HTTP404 CodeENTITY_NOT_FOUND DescriptionThe binding was created, but the site was not found on re-read — message Site is no longer visible after the binding action
HTTP409 CodeSITE_BINDING_TYPE_MISMATCH DescriptionThe site type is neither KNOWLEDGE nor GROUP
HTTP409 CodeLANDING_MODULE_NOT_ENABLED DescriptionThe Sites module is unavailable on this Bitrix24 account. Ask a Bitrix24 account administrator to enable it — until then a retry returns the same refusal
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 refused the binding: the site is not writable, the user has no permissions on the group, the group already has a knowledge base, or the site is already bound to this group
HTTP422 CodeBITRIX_ERROR DescriptionThe binding was made, but Bitrix24 returned the list of bindings in an unexpected format
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionBitrix24 denied access to the key owner
HTTP403 CodeB24_TARIFF_RESTRICTION DescriptionThe Bitrix24 account's plan does not allow the call
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the landing scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is read-only. The request is refused before any call to the Bitrix24 account
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no configured tokens
HTTP429 CodeRATE_LIMITED DescriptionBitrix24 throttled requests to the Bitrix24 account. Retry after the delay from the Retry-After header
HTTP502 CodeBITRIX_UNAVAILABLE DescriptionBitrix24 responded with a server error or the connection dropped before a complete response. The operation may have succeeded — re-read the bindings before retrying
HTTP503 CodeBITRIX_TIMEOUT DescriptionBitrix24 did not respond in time. The operation may have succeeded — re-read the bindings before retrying

Full list of common API errors — Errors.

Known specifics

Check the list of bindings to find the cause of a 422 refusal. A 422 BITRIX_ERROR response does not distinguish a repeated binding from other refusals. The request GET /v1/sites/group-bindings?groupId=171 shows which site the group is already bound to: if your id is in the response, the binding already exists and no retry is needed.

See also