For AI agents: markdown of this page — /docs-content-en/chats/management/folder-sources-update.md documentation index — /llms.txt
Set the sources of the "All" folder
The method ships in the
im 26.1300.0update and is not yet available on all Bitrix24 accounts. If the update has not reached your Bitrix24 account yet, the API returns422 METHOD_NOT_YET_AVAILABLE— this means the method has not been released on the account yet, not that the integration is broken.
PUT /v1/chats/folders/:folderId/sources
Sets 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 /v1/chats/folders/:folderId/sources.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
folderId (path) |
number | yes | ID of the "All" folder — the id of the folder with type: "system" and code: "all" from GET /v1/chats/folders |
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
sourceCodes |
string[] | yes | Codes of the sources that must be enabled — the data.sources[].code values from GET /v1/chats/folders/:folderId/sources. Each element is a non-empty string of up to 64 characters. [] switches off every source that can be switched off |
There are no query parameters. Any query parameter or other body field is rejected with 400 INVALID_PARAMS.
Examples
curl — personal key
# Keep tasks and collabs enabled in the "All" folder (ID 7)
curl -X PUT "https://vibecode.bitrix24.com/v1/chats/folders/7/sources" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"sourceCodes": ["tasksTask", "collab"]}'
curl — OAuth application
# Keep tasks and collabs enabled in the "All" folder (ID 7)
curl -X PUT "https://vibecode.bitrix24.com/v1/chats/folders/7/sources" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{"sourceCodes": ["tasksTask", "collab"]}'
JavaScript — personal key
const base = 'https://vibecode.bitrix24.com/v1/chats/folders/7/sources'
const headers = { 'X-Api-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' }
const { data } = await fetch(base, { headers }).then((r) => r.json())
// Switch collabs off, keep the rest as is
const sourceCodes = data.sources
.filter((s) => s.togglable && s.enabled && s.code !== 'collab')
.map((s) => s.code)
const saved = await fetch(base, {
method: 'PUT',
headers,
body: JSON.stringify({ sourceCodes }),
}).then((r) => r.json())
console.log('Enabled:', saved.data.sourceFolders)
JavaScript — OAuth application
const base = 'https://vibecode.bitrix24.com/v1/chats/folders/7/sources'
const headers = {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
}
const { data } = await fetch(base, { headers }).then((r) => r.json())
// Switch collabs off, keep the rest as is
const sourceCodes = data.sources
.filter((s) => s.togglable && s.enabled && s.code !== 'collab')
.map((s) => s.code)
const saved = await fetch(base, {
method: 'PUT',
headers,
body: JSON.stringify({ sourceCodes }),
}).then((r) => r.json())
console.log('Enabled:', saved.data.sourceFolders)
Response fields
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on success |
data.sourceFolders |
string[] | Codes of the sources enabled after the write — including the mandatory one |
Response example
{
"success": true,
"data": {
"sourceFolders": ["default", "tasksTask", "collab"]
}
}
Error response example
400 — sourceCodes is missing:
{
"success": false,
"error": {
"code": "INVALID_PARAMS",
"message": "`sourceCodes` is missing: pass the full list of enabled source codes (`[]` switches every optional source off)."
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 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 |
| 404 | ENTITY_NOT_FOUND |
Bitrix24 answered "not found", the Bitrix24 code is in error.b24Code |
| 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 |
| 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 |
| 502 | BITRIX_UNAVAILABLE |
Bitrix24 is unavailable or returned a server error |
| 403 | SCOPE_DENIED |
The API key does not have the im scope |
| 403 | WRITE_BLOCKED_READONLY_KEY |
The key is read-only |
| 401 | TOKEN_MISSING |
The API key has no Bitrix24 tokens configured |
Full list of common API errors — Errors.
Known specifics
- 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.
- 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 indata.sourceFolders. - The order of the
sourceCodeselements does not change the order ofdata.sourcesin the source-reading response.