## Bind knowledge-base menu bindings

`POST /v1/sites/:id/menu-bindings`

Writes change interface menus for ALL employees of the Bitrix24 account. Only KNOWLEDGE sites are supported. Menu codes are internal Bitrix24 codes such as crm_switcher:lead; discover existing codes with GET /v1/sites/menu-bindings. Bitrix24 provides no other catalogue.

Requires landing key scope. Every route accepts optional query scope=KNOWLEDGE|GROUP|MAINPAGE. Bitrix24 selects its binding context; pre-read searches KNOWLEDGE, then GROUP and the supplied or default context.

## Parameters

| Parameter | Type | Required | Description |
|---|---|---|---|
| id | integer | yes | Positive safe site ID from GET /v1/sites |
| menuCode | string | yes | Non-empty internal menu code |
| scope | string | no | KNOWLEDGE / GROUP / MAINPAGE |

The body contains only menuCode.

## curl

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/sites/42/menu-bindings" -H "X-Api-Key: YOUR_API_KEY" -H 'Content-Type: application/json' -d '{"menuCode": "crm_switcher:lead"}'
```

## JavaScript

```javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/sites/42/menu-bindings", {
  method: "POST",
  headers: { "X-Api-Key": "YOUR_API_KEY", "Content-Type": "application/json" },
  body: JSON.stringify({"menuCode": "crm_switcher:lead"}),
});
const result = await response.json();
```

## Response

```json
{
  "success": true,
  "data": [
    {
      "siteId": 42,
      "menuCode": "crm_switcher:lead",
      "title": "VIBE-PROBE",
      "publicUrl": "https://example.bitrix24site.com/knowledge/"
    }
  ]
}
```

READONLY rejects writes before Bitrix24. false returns 422 with possible reasons; true reads bindings back and, for groups, the site with its new type. Rebinding or removing a missing binding can also return false.

## Errors

400 INVALID_PARAMS / INVALID_SCOPE / MISSING_REQUIRED_FIELDS; 401 TOKEN_MISSING; 403 SCOPE_DENIED / BITRIX_ACCESS_DENIED / WRITE_BLOCKED_READONLY_KEY; 404 ENTITY_NOT_FOUND; 409 SITE_BINDING_TYPE_MISMATCH / LANDING_MODULE_NOT_ENABLED; 422 BITRIX_ERROR; 429; 502 / 503.

Bitrix24: `landing.site.bindingToMenu`.

[Sites](/docs/entities/sites)
