[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-chats\u002Fmanagement\u002Ffolder-sources-update":3,"docs-tabs-chats\u002Fmanagement\u002Ffolder-sources-update":6},{"content":4,"lastmod":5},"## Set the sources of the \"All\" folder\n\n> **The method ships in the `im 26.1300.0` update and is not yet available on all Bitrix24 accounts.** If the update has not reached your Bitrix24 account yet, the API returns `422 METHOD_NOT_YET_AVAILABLE` — this means the method has not been released on the account yet, not that the integration is broken.\n\n`PUT \u002Fv1\u002Fchats\u002Ffolders\u002F:folderId\u002Fsources`\n\nSets the full set of enabled sources of the \"All\" folder. Works only with this folder. What sources are, their current set and their codes — [`GET \u002Fv1\u002Fchats\u002Ffolders\u002F:folderId\u002Fsources`](\u002Fdocs\u002Fchats\u002Fmanagement\u002Ffolder-sources).\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `folderId` (path) | number | yes | ID of the \"All\" folder — the `id` of the folder with `type: \"system\"` and `code: \"all\"` from [`GET \u002Fv1\u002Fchats\u002Ffolders`](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Ffolders) |\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `sourceCodes` | string[] | yes | Codes of the sources that must be enabled — the `data.sources[].code` values from [`GET \u002Fv1\u002Fchats\u002Ffolders\u002F:folderId\u002Fsources`](\u002Fdocs\u002Fchats\u002Fmanagement\u002Ffolder-sources). Each element is a non-empty string of up to 64 characters. `[]` switches off every source that can be switched off |\n\nThere are no query parameters. Any query parameter or other body field is rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\n# Keep tasks and collabs enabled in the \"All\" folder (ID 7)\ncurl -X PUT \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Ffolders\u002F7\u002Fsources\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"sourceCodes\": [\"tasksTask\", \"collab\"]}'\n```\n\n### curl — OAuth application\n\n```bash\n# Keep tasks and collabs enabled in the \"All\" folder (ID 7)\ncurl -X PUT \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Ffolders\u002F7\u002Fsources\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"sourceCodes\": [\"tasksTask\", \"collab\"]}'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst base = 'https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Ffolders\u002F7\u002Fsources'\nconst headers = { 'X-Api-Key': 'YOUR_API_KEY', 'Content-Type': 'application\u002Fjson' }\n\nconst { data } = await fetch(base, { headers }).then((r) => r.json())\n\n\u002F\u002F Switch collabs off, keep the rest as is\nconst sourceCodes = data.sources\n  .filter((s) => s.togglable && s.enabled && s.code !== 'collab')\n  .map((s) => s.code)\n\nconst saved = await fetch(base, {\n  method: 'PUT',\n  headers,\n  body: JSON.stringify({ sourceCodes }),\n}).then((r) => r.json())\n\nconsole.log('Enabled:', saved.data.sourceFolders)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst base = 'https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Ffolders\u002F7\u002Fsources'\nconst headers = {\n  'X-Api-Key': 'YOUR_APP_KEY',\n  'Authorization': 'Bearer USER_SESSION_TOKEN',\n  'Content-Type': 'application\u002Fjson',\n}\n\nconst { data } = await fetch(base, { headers }).then((r) => r.json())\n\n\u002F\u002F Switch collabs off, keep the rest as is\nconst sourceCodes = data.sources\n  .filter((s) => s.togglable && s.enabled && s.code !== 'collab')\n  .map((s) => s.code)\n\nconst saved = await fetch(base, {\n  method: 'PUT',\n  headers,\n  body: JSON.stringify({ sourceCodes }),\n}).then((r) => r.json())\n\nconsole.log('Enabled:', saved.data.sourceFolders)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.sourceFolders` | string[] | Codes of the sources enabled after the write — including the mandatory one |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"sourceFolders\": [\"default\", \"tasksTask\", \"collab\"]\n  }\n}\n```\n\n## Error response example\n\n400 — `sourceCodes` is missing:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"`sourceCodes` is missing: pass the full list of enabled source codes (`[]` switches every optional source off).\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | `folderId` is not a positive integer, `sourceCodes` is missing, is not an array or has an invalid element, a query parameter or an unknown body field was sent, the body is not a JSON object. Checked before any call to Bitrix24 |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 answered \"not found\", the Bitrix24 code is in `error.b24Code` |\n| 422 | `METHOD_NOT_YET_AVAILABLE` | The `im 26.1300.0` update is not installed on the Bitrix24 account yet — see the notice at the top of the page |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error, the Bitrix24 code is in `error.b24Code`: `FOLDER_OPERATION_NOT_SUPPORTED` — the folder has no sources or a concurrent write to the same folder is in progress. In the second case nothing is written, and the call can be retried. `FOLDER_NOT_FOUND` — no such folder, `FOLDER_ACCESS_DENIED` — another user's folder |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- **Pinning in the \"All\" folder follows the sources.** Switching a source off unpins its chats in this folder. When the source is switched back on, those of its chats that are pinned in the general chat list become pinned again.\n- **Rely on the response, not the request.** An unknown code is dropped without an error, and the mandatory source is added even if it is not in `sourceCodes`. The resulting set is in `data.sourceFolders`.\n- The order of the `sourceCodes` elements does not change the order of `data.sources` in the source-reading response.\n\n## See also\n\n- [Sources of the \"All\" folder](\u002Fdocs\u002Fchats\u002Fmanagement\u002Ffolder-sources)\n- [Chat folders](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Ffolders)\n- [Create a chat folder](\u002Fdocs\u002Fchats\u002Fmanagement\u002Ffolders-create)\n- [Update a chat folder](\u002Fdocs\u002Fchats\u002Fmanagement\u002Ffolders-update)\n- [Platform errors](\u002Fdocs\u002Ferrors\u002Fplatform#method_not_yet_available-422)\n","2026-10-07",{},1795415427733]