For AI agents: markdown of this page — /docs-content-en/chats/management/folder-sources.md documentation index — /llms.txt
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.
GET /v1/chats/folders/:folderId/sources
PUT /v1/chats/folders/:folderId/sources
The "All" folder gathers chats from several messenger sections — sources: tasks, collabs, Open Channels and others. These calls read and change which sources it includes:
GETreturns the folder's sources and which of them are enabled — the v2 messenger methodim.v2.Folder.getSources.PUTreplaces the full set of enabled sources — the methodim.v2.Folder.updateSources.
Both calls work only with the "All" folder: other folders have no sources, and Bitrix24 answers with the code FOLDER_OPERATION_NOT_SUPPORTED. The ID of the "All" folder is in GET /v1/chats/folders; it has type: "system" and code: "all". Bitrix24 does not show the "All" folder everywhere: if it is not in the folder list, it is switched off on that Bitrix24 account.
Both calls require a write-capable key: the first GET may persist the 'All' folder composition and migrate old pins. A read-only key gets 403 WRITE_BLOCKED_READONLY_KEY before any Bitrix24 call.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
folderId (path) |
number | yes | — | ID of the "All" folder |
sourceCodes (body — PUT) |
string[] | yes | — | Codes of the sources that must be enabled — the code values from the GET response. [] switches off every source that can be switched off |
Each sourceCodes element is a non-empty string of up to 64 characters. There are no query parameters. Any query parameter or other body field is rejected with 400 INVALID_PARAMS.
Examples
curl — personal key
# Read the sources of the "All" folder (ID 7)
curl "https://vibecode.bitrix24.com/v1/chats/folders/7/sources" \
-H "X-Api-Key: YOUR_API_KEY"
# Keep tasks and collabs enabled
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
curl "https://vibecode.bitrix24.com/v1/chats/folders/7/sources" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN"
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 res = await fetch('https://vibecode.bitrix24.com/v1/chats/folders/7/sources', {
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const { data } = await res.json()
Response fields
GET:
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on success |
data.sources |
array | Sources in the order the interface shows them |
data.sources[].folderId |
number | ID of the source's system folder |
data.sources[].code |
string | Code of the source — the value to pass in sourceCodes |
data.sources[].enabled |
boolean | The source is included in the "All" folder |
data.sources[].togglable |
boolean | The source can be switched on and off. false for showcase sources: they are shown but cannot be switched on or off |
data.folders |
array | The sources' system folders — the same fields as in GET /v1/chats/folders |
PUT:
| 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
GET:
{
"success": true,
"data": {
"sources": [
{ "folderId": 2, "code": "tasksTask", "enabled": true, "togglable": true },
{ "folderId": 4, "code": "collab", "enabled": false, "togglable": true },
{ "folderId": 6, "code": "openChannel", "enabled": false, "togglable": false }
],
"folders": [
{
"id": 2,
"type": "system",
"code": "tasksTask",
"title": "Tasks",
"sort": 3,
"visible": true,
"description": "Task chats",
"displaysNestedInRoot": false,
"definition": { "recentSection": "tasksTask", "parentChatId": 0 }
}
]
}
}
PUT:
{
"success": true,
"data": {
"sourceFolders": ["default", "tasksTask", "collab"]
}
}
Error response example
400 — PUT without sourceCodes:
{
"success": false,
"error": {
"code": "INVALID_PARAMS",
"message": "`sourceCodes` is missing: pass the full list of enabled source codes (`[]` switches every optional source off)."
}
}
422 — the folder is not "All":
{
"success": false,
"error": {
"code": "BITRIX_ERROR",
"message": "This action is unavailable for this folder.",
"b24Code": "FOLDER_OPERATION_NOT_SUPPORTED"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_PARAMS |
folderId is not a positive integer; no sourceCodes for PUT or an invalid list element; a query parameter or an unknown body field was sent; the body is not a JSON object. Checked before any call to Bitrix24 |
| 403 | SCOPE_DENIED |
The API key does not have the im scope |
| 403 | WRITE_BLOCKED_READONLY_KEY |
GET and PUT: the key is read-only |
| 401 | TOKEN_MISSING |
The API key has no Bitrix24 tokens configured |
| 404 | ENTITY_NOT_FOUND |
Bitrix24 answered "not found"; the portal code is in error.b24Code |
| 422 | METHOD_NOT_YET_AVAILABLE |
The im 26.1300.0 update has not reached the Bitrix24 account yet — see the notice at the top of the page |
| 422 | BITRIX_ERROR |
Bitrix24 returned an error; the portal 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, FOLDER_NOT_FOUND — no such folder, FOLDER_ACCESS_DENIED — another user's folder |
| 502 | BITRIX_UNAVAILABLE |
Bitrix24 is unavailable or returned a server error |
Full list of common API errors — Errors.
Known specifics
PUTreplaces the whole set, andsourceCodesis required. Sources outside the list are switched off. Without the field, Bitrix24 would switch off every source, so a missing field is rejected with400, while an explicit[]is valid.- Pins in the "All" folder follow 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. Bitrix24 silently drops an unknown code and adds the mandatory source itself, even if it is not in
sourceCodes. The resulting set is indata.sourceFolders. - The mandatory source is not shown in
data.sources: it cannot be switched off. Sources unavailable to the user are not shown either. - Bitrix24 sets the order of
data.sources; the order of thesourceCodeselements does not change it. - A concurrent write to the same folder can fail with
FOLDER_OPERATION_NOT_SUPPORTED: Bitrix24 has written nothing, and the call can be retried. - The first
GETmay create system folders and persist the 'All' folder composition and old pins; therefore it requires a write-capable key.