For AI agents: markdown of this page — /docs-content-en/chats/files/folder.md documentation index — /llms.txt

Chat folder on Drive

GET /v1/chats/:chatId/folder

Returns the identifier of the chat folder in Bitrix24 Drive. Files uploaded to the chat via POST /v1/chats/:chatId/files are stored in this folder.

Requires the im scope and READWRITE mode. The Bitrix24 method can create a missing chat folder and link it to the chat. Therefore keys in READONLY mode get 403 WRITE_BLOCKED_READONLY_KEY before the Bitrix24 method is called, even though the request is an HTTP GET. Listing files, reading metadata and downloading content keep their own read rules.

Parameters

Parameter Type Required Description
ParameterchatId (path) Typenumber Requiredyes DescriptionChat ID. Get it: POST /v1/chats or GET /v1/chats/recent

Examples

curl — personal key

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

curl — OAuth application

Terminal
curl https://vibecode.bitrix24.com/v1/chats/1001/folder \
  -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/1001/folder', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('Folder ID:', data.id)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/1001/folder', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { success, data } = await res.json()
console.log('Folder ID:', data.id)

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.id Typenumber DescriptionID of the chat folder on Drive

Response example

JSON
{
  "success": true,
  "data": {
    "id": 9263
  }
}

Error response example

400 — chatId is not a positive integer. The route checks this before the Bitrix24 call:

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_CHAT_ID",
    "message": "chatId must be a positive integer."
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_CHAT_ID DescriptionchatId is not a positive integer — checked before the Bitrix24 call
HTTP404 CodeENTITY_NOT_FOUND DescriptionBitrix24 returned a NOT_FOUND error — the chat does not exist or is not accessible
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 error while retrieving the folder
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionREADONLY mode blocks folder initialization before the Bitrix24 call
HTTP403 CodeSCOPE_DENIED DescriptionThe key lacks the im scope
HTTP401 CodeTOKEN_MISSING DescriptionThe key has no configured Bitrix24 tokens

Full list of common API errors — Errors.

See also