[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-chats\u002Fmanagement\u002Ffolders-update":3,"docs-tabs-chats\u002Fmanagement\u002Ffolders-update":6},{"content":4,"lastmod":5},"## Update a chat folder\n\n`PATCH \u002Fv1\u002Fchats\u002Ffolders\u002F:folderId`\n\nRenames the current user's personal chat folder and replaces its contents.\n\nTo add or remove individual chats without passing the full contents, see [Add chats to a folder](\u002Fdocs\u002Fchats\u002Fmanagement\u002Ffolder-chats) and [Remove chats from a folder](\u002Fdocs\u002Fchats\u002Fmanagement\u002Ffolder-chats-delete).\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `folderId` (path) | number | yes | Personal folder ID — the `id` field in [`GET \u002Fv1\u002Fchats\u002Ffolders`](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Ffolders). A positive integer |\n\nThere are no query parameters: any query parameter is rejected with `400 INVALID_PARAMS`.\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `title` | string | no | New folder name, 1 to 30 characters after trimming whitespace. A name outside these bounds is rejected with `422 BITRIX_ERROR`, not `400` |\n| `chatIds` | (number \\| string)[] | no | Chat IDs of the new contents. Each element is a positive integer up to `9007199254740991`: a number or a string of decimal digits without leading zeros or spaces. The chat ID is the `chatId` field in [recent dialogs](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent) |\n| `dialogIds` | string[] | no | Dialog IDs of the new contents: `chatXXX` or a user ID for a direct dialog. An element is a non-empty string of up to 64 characters, with no commas and no leading or trailing whitespace. The `me` alias is not accepted — pass the user ID. The ID is the `dialogId` field in [recent dialogs](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent) |\n\nAt least one of `title`, `chatIds`, `dialogIds` is required. The passed contents — the union of `chatIds` and `dialogIds` — replace the previous contents entirely. Empty contents — `chatIds: []`, `dialogIds: []` or both — clear the folder. Any other body field is rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X PATCH \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Ffolders\u002F127\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"title\": \"Key clients\", \"chatIds\": [5287]}'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X PATCH \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Ffolders\u002F127\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"title\": \"Key clients\", \"chatIds\": [5287]}'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Ffolders\u002F127', {\n  method: 'PATCH',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ title: 'Key clients', chatIds: [5287] }),\n})\n\nconst { success, data } = await res.json()\nconsole.log(data.folder.definition.chats)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Ffolders\u002F127', {\n  method: 'PATCH',\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({ title: 'Key clients', chatIds: [5287] }),\n})\n\nconst { success, data } = await res.json()\nconsole.log(data.folder.definition.chats)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.folder` | object | The folder after the update |\n| `data.folder.id` | number | Folder ID |\n| `data.folder.type` | string | Always `personal` |\n| `data.folder.title` | string | Name |\n| `data.folder.sort` | number | Folder order in the interface |\n| `data.folder.visible` | boolean | The folder is shown in the interface |\n| `data.folder.description` | null | A personal folder has no description |\n| `data.folder.displaysNestedInRoot` | boolean | Nested chats are also shown in the root list |\n| `data.folder.definition.chats` | array | Folder contents after the update, a list of `{ chatId, dialogId }` |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"folder\": {\n      \"id\": 127,\n      \"type\": \"personal\",\n      \"title\": \"Key clients\",\n      \"sort\": 12,\n      \"visible\": true,\n      \"description\": null,\n      \"displaysNestedInRoot\": false,\n      \"definition\": {\n        \"chats\": [{ \"chatId\": 5287, \"dialogId\": \"chat5287\" }]\n      }\n    }\n  }\n}\n```\n\n## Error response example\n\n400 — no field passed:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"Nothing to change: pass `title`, `chatIds` or `dialogIds`.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | `folderId` is not a positive integer, no field is passed, `title` is not a string, a `chatIds` or `dialogIds` element is invalid, a query parameter or an unknown body field is passed, or the body is not a JSON object. Checked before any call to Bitrix24 |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | Read-only key: updating a folder is a write, see [access rights](\u002Fdocs\u002Faccess-rights) |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned \"not found\". The portal code is in `error.b24Code` |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned `FOLDER_NOT_FOUND` — the folder does not exist. The portal code is in `error.b24Code` |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned `FOLDER_ACCESS_DENIED` — the folder belongs to another user. The portal code is in `error.b24Code` |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned `FOLDER_SYSTEM_MUTATION_FORBIDDEN` — a system folder cannot be changed. The portal code is in `error.b24Code` |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned `FOLDER_CHATS_LIMIT_EXCEEDED` — the contents exceed 50 chats. The portal code is in `error.b24Code` |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned `FOLDER_CHAT_NOT_ELIGIBLE` — the contents include a chat that cannot be placed in a folder, for example a chat the user is not a member of. The portal code is in `error.b24Code` |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned `title` — the name is empty after trimming whitespace or longer than 30 characters. The portal code is in `error.b24Code` |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |\n\nFor the full list of common API errors, see [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- **One ineligible chat rejects the whole contents.** If `chatIds` or `dialogIds` contains even one chat the user is not a member of, the call returns `FOLDER_CHAT_NOT_ELIGIBLE` and the previous contents remain, even when the other chats are eligible.\n- **A user ID in `dialogIds` creates a direct dialog.** If there is no direct chat with the user yet, the call creates it and places it in the folder.\n- **`dialogIds` works starting with the `im 26.1000.0` update.** Cloud Bitrix24 already has it installed. On-premise Bitrix24 without this update skips `dialogIds` and returns no error: a call with only `dialogIds` does not change the contents. On such an installation, pass `chatIds`.\n- **`FOLDER_NOT_FOUND` arrives in `error.b24Code` of a `422 BITRIX_ERROR` response.** Do not confuse it with the `404 FOLDER_NOT_FOUND` on [Upload a file to a chat](\u002Fdocs\u002Fchats\u002Ffiles\u002Fupload).\n\n## See also\n\n- [Chat folders](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Ffolders)\n- [Get a chat folder](\u002Fdocs\u002Fchats\u002Fmanagement\u002Ffolders-get)\n- [Create a chat folder](\u002Fdocs\u002Fchats\u002Fmanagement\u002Ffolders-create)\n- [Delete a chat folder](\u002Fdocs\u002Fchats\u002Fmanagement\u002Ffolders-delete)\n- [Add chats to a folder](\u002Fdocs\u002Fchats\u002Fmanagement\u002Ffolder-chats)\n- [Remove chats from a folder](\u002Fdocs\u002Fchats\u002Fmanagement\u002Ffolder-chats-delete)\n","2026-11-20",{},1795415428435]