[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Fsites\u002Fpermissions":3,"docs-tabs-entities\u002Fsites\u002Fpermissions":6},{"content":4,"lastmod":5},"## Site permissions\n\n`PUT \u002Fv1\u002Fsites\u002F:id\u002Fpermissions`\n\nReplaces all access permissions of a site: after the call, the site keeps only the permissions you pass. To reset all permissions, use [`DELETE \u002Fv1\u002Fsites\u002F:id\u002Fpermissions`](\u002Fdocs\u002Fentities\u002Fsites\u002Fpermissions-delete).\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `id` (path) | number | yes | Site ID. List: [`GET \u002Fv1\u002Fsites`](\u002Fdocs\u002Fentities\u002Fsites\u002Flist) |\n| `scope` (query) | string | no | Site type: `KNOWLEDGE` — knowledge base, `GROUP` — workgroup site, `MAINPAGE` — home page. Omit the parameter for all other sites |\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|----------|\n| `rights` | object | yes | Site permissions: the key is an access code, the value is an array of operations. At least one access code is required |\n| `rights.\u003Caccess code>` | string[] | yes | Operations for the access code: `read` — view, `edit` — edit, `sett` — change settings, `public` — publish, `delete` — delete, `denied` — access denied. An empty array is accepted. The access code is a non-empty string, for example `U1317` for the employee with ID `1317` from [`GET \u002Fv1\u002Fusers`](\u002Fdocs\u002Fentities\u002Fusers\u002Flist), or `AU` |\n\nNo other fields are accepted in the body.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X PUT \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fsites\u002F42\u002Fpermissions\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"rights\": {\"U1317\": [\"read\", \"edit\"]}}'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X PUT \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fsites\u002F42\u002Fpermissions\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"rights\": {\"U1317\": [\"read\", \"edit\"]}}'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fsites\u002F42\u002Fpermissions', {\n  method: 'PUT',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ rights: { U1317: ['read', 'edit'] } }),\n})\nconst body = await res.json()\n\nif (body.success && body.data.updated) {\n  console.log('Site permissions replaced')\n}\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fsites\u002F42\u002Fpermissions', {\n  method: 'PUT',\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({ rights: { U1317: ['read', 'edit'] } }),\n})\nconst body = await res.json()\n\nif (body.success && body.data.updated) {\n  console.log('Site permissions replaced')\n}\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|----------|\n| `success` | boolean | `true` — the permissions were replaced |\n| `data.updated` | boolean | Always `true`: Bitrix24 confirmed the permissions replacement |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"updated\": true\n  }\n}\n```\n\n## Error response example\n\n400 — the body has no `rights`, or an empty object was passed:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"MISSING_REQUIRED_FIELDS\",\n    \"message\": \"rights must be a non-empty access-code dictionary; use DELETE to clear all rights\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|----------|\n| 400 | `MISSING_REQUIRED_FIELDS` | The body has no `rights`, or `rights` is an empty object or not an object |\n| 400 | `INVALID_PARAMS` | The body has fields other than `rights`. The error message is `Only rights is accepted` |\n| 400 | `INVALID_PARAMS` | An access code is an empty string, a value is not an array, or the array holds an operation outside `read`, `edit`, `sett`, `public`, `delete`, `denied` |\n| 400 | `INVALID_PARAMS` | `id` is not a positive integer |\n| 400 | `INVALID_SCOPE` | `scope` is not one of `KNOWLEDGE`, `GROUP`, `MAINPAGE` |\n| 404 | `ENTITY_NOT_FOUND` | No site with this `id` exists, or it is not visible to the key. A knowledge base, workgroup site or home page requires the `scope` parameter |\n| 403 | `BITRIX_ACCESS_DENIED` | The key does not belong to a Bitrix24 account administrator, or the Bitrix24 plan does not include extended site permissions |\n| 409 | `LANDING_MODULE_NOT_ENABLED` | The Sites module is unavailable on the Bitrix24 account |\n| 422 | `BITRIX_ERROR` | Bitrix24 did not confirm the permissions replacement or rejected the site operation |\n| 403 | `SCOPE_DENIED` | The key lacks the `landing` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only |\n| 401 | `TOKEN_MISSING` | The key has no Bitrix24 tokens configured |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- **Assigned permissions cannot be verified through the API.** No method reads site permissions. [`GET \u002Fv1\u002Fsites\u002F:id\u002Fmy-permissions`](\u002Fdocs\u002Fentities\u002Fsites\u002Fmy-permissions) shows only the operations of the key's user: for a Bitrix24 account administrator it lists all six operations regardless of the assigned permissions.\n\n## See also\n\n- [Reset site permissions](\u002Fdocs\u002Fentities\u002Fsites\u002Fpermissions-delete)\n- [My site permissions](\u002Fdocs\u002Fentities\u002Fsites\u002Fmy-permissions)\n- [Site list](\u002Fdocs\u002Fentities\u002Fsites\u002Flist)\n- [Sites](\u002Fdocs\u002Fentities\u002Fsites)\n- [Errors](\u002Fdocs\u002Ferrors)\n","2026-10-19",{},1795415301738]