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

Delete a chat folder

DELETE /v1/chats/folders/:folderId

Deletes the current user's personal chat folder together with its contents and pins. The chats themselves stay in the chat list. Deletion is irreversible: a folder cannot be restored through the API — create a new one if needed.

Parameters

Parameter Type Required Description
folderId (path) number yes Personal folder ID — the id field in GET /v1/chats/folders. A positive integer

There are no query parameters or body fields: any query parameter or body field is rejected with 400 INVALID_PARAMS.

Examples

curl — personal key

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

curl — OAuth application

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

const { success, data } = await res.json()

JavaScript — OAuth application

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

const { success, data } = await res.json()

Response fields

Field Type Description
success boolean Always true on success
data.result boolean true — the folder is deleted

Response example

JSON
{
  "success": true,
  "data": {
    "result": true
  }
}

Error response example

422 — there is no folder with this folderId, including when the folder has already been deleted:

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "FOLDER_NOT_FOUND",
    "b24Code": "FOLDER_NOT_FOUND"
  }
}

Errors

HTTP Code Description
400 INVALID_PARAMS folderId is not a positive integer, a query parameter or body field is passed, or the body is not a JSON object. Checked before any call to Bitrix24
422 BITRIX_ERROR Bitrix24 returned an error; the portal code is in error.b24Code: FOLDER_NOT_FOUND — no such folder, FOLDER_ACCESS_DENIED — another user's folder, FOLDER_SYSTEM_MUTATION_FORBIDDEN — a system folder cannot be deleted
404 ENTITY_NOT_FOUND Bitrix24 answered "not found"; the portal code is in error.b24Code
403 SCOPE_DENIED The API key does not have the im scope
403 WRITE_BLOCKED_READONLY_KEY The key is read-only: deleting a folder is a write, see access rights
401 TOKEN_MISSING The API key has no Bitrix24 tokens configured
502 BITRIX_UNAVAILABLE Bitrix24 is unavailable or returned a server error

Full list of common API errors — Errors.

Known specifics

  • FOLDER_NOT_FOUND arrives in error.b24Code of a 422 BITRIX_ERROR response. Do not confuse it with the 404 FOLDER_NOT_FOUND on Upload a file to a chat.

See also