[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Fsites\u002Fmenu-bindings\u002Fbind":3,"docs-tabs-entities\u002Fsites\u002Fmenu-bindings\u002Fbind":6},{"content":4,"lastmod":5},"## Bind a knowledge base to a menu\n\n`POST \u002Fv1\u002Fsites\u002F:id\u002Fmenu-bindings`\n\nBinds 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.\n\nSite type restrictions and how a binding changes the employees' menu are covered in [Knowledge base menu bindings](\u002Fdocs\u002Fentities\u002Fsites\u002Fmenu-bindings).\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `id` (path) | number | yes | Knowledge base site ID. List: `GET \u002Fv1\u002Fsites?scope=KNOWLEDGE` |\n| `scope` (query) | string | no | Site scope: `KNOWLEDGE`, `GROUP` or `MAINPAGE`. A knowledge base site is found even without this parameter |\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `menuCode` | string | yes | Internal menu code, for example `crm_switcher:lead`. Codes already in use on the Bitrix24 account: `GET \u002Fv1\u002Fsites\u002Fmenu-bindings` |\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fsites\u002F235\u002Fmenu-bindings\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"menuCode\": \"crm_switcher:lead\"}'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fsites\u002F235\u002Fmenu-bindings\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"menuCode\": \"crm_switcher:lead\"}'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fsites\u002F235\u002Fmenu-bindings', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ menuCode: 'crm_switcher:lead' }),\n})\n\nconst { success, data } = await res.json()\nconsole.log(data[0].publicUrl)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fsites\u002F235\u002Fmenu-bindings', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ menuCode: 'crm_switcher:lead' }),\n})\n\nconst { success, data } = await res.json()\nconsole.log(data[0].publicUrl)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data` | array | Bindings of this site to the given menu code, read back after the write |\n| `data[].siteId` | number | Site ID |\n| `data[].menuCode` | string | Menu code |\n| `data[].title` | string | Site title. Empty string if the title was not returned |\n| `data[].publicUrl` | string | Public URL of the site. Empty string if the URL was not returned |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": [\n    {\n      \"siteId\": 235,\n      \"menuCode\": \"crm_switcher:lead\",\n      \"title\": \"VIBE-PROBE\",\n      \"publicUrl\": \"https:\u002F\u002Fexample.bitrix24.com\u002Fknowledge\u002Fvibe-probe-bind\u002F\"\n    }\n  ]\n}\n```\n\n## Error response example\n\n404 — site not found:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"ENTITY_NOT_FOUND\",\n    \"message\": \"Site not found or not visible\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `MISSING_REQUIRED_FIELDS` | The body has no `menuCode` field or the body is not an object |\n| 400 | `INVALID_PARAMS` | The body has fields other than `menuCode` — message `Only menuCode is accepted` |\n| 400 | `INVALID_PARAMS` | `menuCode` is empty, whitespace only or not a string |\n| 400 | `INVALID_PARAMS` | `id` in the path is not a positive integer |\n| 400 | `INVALID_SCOPE` | `scope` is not `KNOWLEDGE`, `GROUP` or `MAINPAGE` |\n| 404 | `ENTITY_NOT_FOUND` | No site with this `id` was found among knowledge bases, workgroup sites and sites in the given `scope` — message `Site not found or not visible` |\n| 409 | `SITE_BINDING_TYPE_MISMATCH` | The 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` |\n| 409 | `LANDING_MODULE_NOT_ENABLED` | The 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 |\n| 422 | `BITRIX_ERROR` | Bitrix24 rejected the binding. `message` lists possible causes: the site is unavailable, not a knowledge base, no write permission, the binding already exists |\n| 422 | `BITRIX_ERROR` | The binding was created, but Bitrix24 returned the bindings list in an unexpected format |\n| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied access to the key owner |\n| 403 | `B24_TARIFF_RESTRICTION` | The portal plan does not allow the call |\n| 403 | `SCOPE_DENIED` | The API key does not have the `landing` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode, the request does not reach Bitrix24 |\n| 401 | `TOKEN_MISSING` | The API key has no configured tokens |\n| 429 | `RATE_LIMITED` | Bitrix24 throttled requests to the portal. Retry after the delay given in the `Retry-After` header |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 returned a server error or the connection dropped before the full response. The operation may have succeeded — read the bindings back before retrying |\n| 503 | `BITRIX_TIMEOUT` | Bitrix24 did not respond in time. The operation may have succeeded — read the bindings back before retrying |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## See also\n\n- [Knowledge base menu bindings](\u002Fdocs\u002Fentities\u002Fsites\u002Fmenu-bindings)\n- [List knowledge base menu bindings](\u002Fdocs\u002Fentities\u002Fsites\u002Fmenu-bindings\u002Flist)\n- [Unbind a knowledge base from a menu](\u002Fdocs\u002Fentities\u002Fsites\u002Fmenu-bindings\u002Funbind)\n- [Knowledge base workgroup bindings](\u002Fdocs\u002Fentities\u002Fsites\u002Fgroup-binding)\n- [List sites](\u002Fdocs\u002Fentities\u002Fsites\u002Flist)\n- [Errors](\u002Fdocs\u002Ferrors)\n","2026-10-19",{},1795343881549]