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 — the v2 messenger method im.v2.Folder.list. 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

Terminal
curl "https://vibecode.bitrix24.com/v1/chats/folders" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl "https://vibecode.bitrix24.com/v1/chats/folders" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"

JavaScript — personal key

javascript
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

javascript
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
success boolean Always true on success
data.folders array The user's folders
data.folders[].id number Folder ID — the folderId for the folder's chat list
data.folders[].type string system — a messenger section, personal — a personal folder
data.folders[].code string System folder code, for example default, tasksTask, collab, lines, openChannel. A personal folder has no such field
data.folders[].title string Folder name
data.folders[].sort number Folder order in the interface
data.folders[].visible boolean The folder is shown in the interface
data.folders[].description string | null Description. null for a personal folder
data.folders[].displaysNestedInRoot boolean Nested chats are also shown in the root list
data.folders[].definition object What 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

JSON
{
  "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:

JSON
{
  "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
400 INVALID_PARAMS A query parameter was sent — the endpoint takes none
403 SCOPE_DENIED The API key does not have the im scope
403 WRITE_BLOCKED_READONLY_KEY Read-only key: listing folders can change portal state
401 TOKEN_MISSING The API key has no Bitrix24 tokens configured
422 BITRIX_ERROR Bitrix24 returned an error; the portal code is in error.b24Code
502 BITRIX_UNAVAILABLE Bitrix24 is unavailable or returned a server error

Full list of common API errors — Errors.

Known specifics

  • On the first call or a cache miss, Bitrix24 may create system folders, migrate legacy pins and populate folder sources. A read-only key therefore gets 403 WRITE_BLOCKED_READONLY_KEY before the portal call. Listing chats in a folder remains a read.
  • Not every system folder has a chat list: the public channel showcase answers a list request with the code FOLDER_OPERATION_NOT_SUPPORTED.

See also