لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/entities/sites/menu-bindings/bind.md فهرس التوثيق — /llms.txt
مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.
Bind a knowledge base to a menu
POST /v1/sites/:id/menu-bindings
Binds a knowledge base site to a Bitrix24 menu by the menu's internal code, and that menu changes for all employees of the Bitrix24 account.
Site type restrictions and how a binding changes the employees' menu are covered in Knowledge base menu bindings.
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. A knowledge base site is found even without this parameter |
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
FieldmenuCode |
Typestring | Requiredyes | DescriptionInternal menu code, for example crm_switcher:lead. Codes already in use on the Bitrix24 account: GET /v1/sites/menu-bindings |
Examples
curl — personal key
curl -X POST "https://vibecode.bitrix24.com/v1/sites/235/menu-bindings" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"menuCode": "crm_switcher:lead"}'
curl — OAuth application
curl -X POST "https://vibecode.bitrix24.com/v1/sites/235/menu-bindings" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{"menuCode": "crm_switcher:lead"}'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/235/menu-bindings', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ menuCode: 'crm_switcher:lead' }),
})
const { success, data } = await res.json()
console.log(data[0].publicUrl)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/235/menu-bindings', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({ menuCode: 'crm_switcher:lead' }),
})
const { success, data } = await res.json()
console.log(data[0].publicUrl)
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | DescriptionAlways true on success |
Fielddata |
Typearray | DescriptionBindings of this site to the given menu code, read back after the write |
Fielddata[].siteId |
Typenumber | DescriptionSite ID |
Fielddata[].menuCode |
Typestring | DescriptionMenu code |
Fielddata[].title |
Typestring | DescriptionSite title. Empty string if the title was not returned |
Fielddata[].publicUrl |
Typestring | DescriptionPublic URL of the site. Empty string if the URL was not returned |
Response example
{
"success": true,
"data": [
{
"siteId": 235,
"menuCode": "crm_switcher:lead",
"title": "VIBE-PROBE",
"publicUrl": "https://example.bitrix24.com/knowledge/vibe-probe-bind/"
}
]
}
Error response example
404 — site not found:
{
"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 menuCode field or the body is not an object |
| HTTP400 | CodeINVALID_PARAMS |
DescriptionThe body has fields other than menuCode — message Only menuCode is accepted |
| HTTP400 | CodeINVALID_PARAMS |
DescriptionmenuCode is empty, whitespace only or not a string |
| 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 was found among knowledge bases, workgroup sites and sites in the given scope — message Site not found or not visible |
| HTTP409 | CodeSITE_BINDING_TYPE_MISMATCH |
DescriptionThe site is not a knowledge base: a regular site or a site bound to a workgroup. A workgroup binding changes the site type to GROUP |
| HTTP409 | CodeLANDING_MODULE_NOT_ENABLED |
DescriptionThe Sites module is unavailable on the portal. Ask the portal administrator to enable it — while the module is off, a retry returns the same rejection |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 rejected the binding. message lists possible causes: the site is unavailable, not a knowledge base, no write permission, the binding already exists |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionThe binding was created, but Bitrix24 returned the bindings list in an unexpected format |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionBitrix24 denied access to the key owner |
| HTTP403 | CodeB24_TARIFF_RESTRICTION |
DescriptionThe portal 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 in read-only mode, the request does not reach Bitrix24 |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe API key has no configured tokens |
| HTTP429 | CodeRATE_LIMITED |
DescriptionBitrix24 throttled requests to the portal. Retry after the delay given in the Retry-After header |
| HTTP502 | CodeBITRIX_UNAVAILABLE |
DescriptionBitrix24 returned a server error or the connection dropped before the full response. The operation may have succeeded — read the bindings back before retrying |
| HTTP503 | CodeBITRIX_TIMEOUT |
DescriptionBitrix24 did not respond in time. The operation may have succeeded — read the bindings back before retrying |
Full list of common API errors — Errors.