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 |
|---|---|---|---|
chatId (path) |
number | yes | Chat ID. Get it: POST /v1/chats or GET /v1/chats/recent |
Examples
curl — personal key
curl https://vibecode.bitrix24.com/v1/chats/1001/folder \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
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
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
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 |
|---|---|---|
success |
boolean | Always true on success |
data.id |
number | ID of the chat folder on Drive |
Response example
{
"success": true,
"data": {
"id": 9263
}
}
Error response example
400 — chatId is not a positive integer. The route checks this before the Bitrix24 call:
{
"success": false,
"error": {
"code": "INVALID_CHAT_ID",
"message": "chatId must be a positive integer."
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_CHAT_ID |
chatId is not a positive integer — checked before the Bitrix24 call |
| 404 | ENTITY_NOT_FOUND |
Bitrix24 returned a NOT_FOUND error — the chat does not exist or is not accessible |
| 422 | BITRIX_ERROR |
Bitrix24 error while retrieving the folder |
| 403 | WRITE_BLOCKED_READONLY_KEY |
READONLY mode blocks folder initialization before the Bitrix24 call |
| 403 | SCOPE_DENIED |
The key lacks the im scope |
| 401 | TOKEN_MISSING |
The key has no configured Bitrix24 tokens |
Full list of common API errors — Errors.