For AI agents: markdown of this page — /docs-content-en/chats/discovery/folders.md documentation index — /llms.txt
Chat folders
GET /v1/chats/folders
Returns the current user's chat folders. System folders are the messenger's sections: chats, tasks, collabs, Open Channels, the public channel showcase and others; the set depends on the Bitrix24 account. Users create personal folders themselves from chats they select. To get a folder's chat list, call GET /v1/chats/folders/:folderId/recent.
Parameters
There are no parameters. Any query parameter is rejected with 400 INVALID_PARAMS.
Examples
curl — personal key
curl "https://vibecode.bitrix24.com/v1/chats/folders" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl "https://vibecode.bitrix24.com/v1/chats/folders" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN"
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/folders', {
headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { data } = await res.json()
const personal = data.folders.filter((f) => f.type === 'personal')
console.log('Personal folders:', personal.length)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/folders', {
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const { data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | DescriptionAlways true on success |
Fielddata.folders |
Typearray | DescriptionThe user's folders |
Fielddata.folders[].id |
Typenumber | DescriptionFolder ID — the folderId for the folder's chat list |
Fielddata.folders[].type |
Typestring | Descriptionsystem — a messenger section, personal — a personal folder |
Fielddata.folders[].code |
Typestring | DescriptionSystem folder code, for example default, tasksTask, collab, lines, openChannel. A personal folder has no such field |
Fielddata.folders[].title |
Typestring | DescriptionFolder name |
Fielddata.folders[].sort |
Typenumber | DescriptionFolder order in the interface |
Fielddata.folders[].visible |
Typeboolean | DescriptionThe folder is shown in the interface |
Fielddata.folders[].description |
Typestring | null | DescriptionDescription. null for a personal folder |
Fielddata.folders[].displaysNestedInRoot |
Typeboolean | DescriptionNested chats are also shown in the root list |
Fielddata.folders[].definition |
Typeobject | DescriptionWhat the folder holds. For a system folder, recentSection (the list section) and parentChatId. For a personal folder, chats, a list of { chatId, dialogId } |
Response example
{
"success": true,
"data": {
"folders": [
{
"id": 1,
"type": "system",
"code": "default",
"title": "Chats",
"sort": 2,
"visible": true,
"description": "All chats, channels and projects",
"displaysNestedInRoot": false,
"definition": { "recentSection": "default", "parentChatId": 0 }
},
{
"id": 15,
"type": "personal",
"title": "Clients",
"sort": 12,
"visible": true,
"description": null,
"displaysNestedInRoot": false,
"definition": { "chats": [{ "chatId": 42, "dialogId": "chat42" }] }
}
]
}
}
Error response example
400 — a query parameter was sent:
{
"success": false,
"error": {
"code": "INVALID_PARAMS",
"message": "Query parameter `type` is not accepted by GET /v1/chats/folders. It takes no query parameters."
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
DescriptionA query parameter was sent — the endpoint takes none |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe API key does not have the im scope |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionRead-only key: listing folders can change portal state |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe API key has no Bitrix24 tokens configured |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 returned an error. The portal code is in error.b24Code |
| HTTP502 | CodeBITRIX_UNAVAILABLE |
DescriptionBitrix24 is unavailable or returned a server error |
Full list of common API errors — Errors.
Known specifics
- On the first call or after a cache reset, the call may create system folders, migrate legacy pins and populate folder sources. A read-only key therefore gets
403 WRITE_BLOCKED_READONLY_KEYbefore the call reaches Bitrix24. Listing chats in a folder remains a read-only operation. - Not every system folder has a chat list: the public channel showcase responds to a list request with the code
FOLDER_OPERATION_NOT_SUPPORTED.