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

Delete a knowledge base

DELETE /v1/note/collections/:id

Moves a knowledge base and its documents to the trash. An already archived knowledge base can also be deleted.

Parameters

Parameter Type Required Description
id integer yes Knowledge base identifier (path parameter)

Examples

curl — personal key

Terminal
curl -X DELETE https://vibecode.bitrix24.com/v1/note/collections/42 \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -X DELETE https://vibecode.bitrix24.com/v1/note/collections/42 \
  -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/note/collections/42', {
  method: 'DELETE',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { data } = await res.json()
console.log(data.deleted) // true

JavaScript — OAuth application

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

Response

On successful deletion, { deleted: true } is returned with HTTP status 200.

Response example

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

Error response example

404 — knowledge base not found:

JSON
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Record with ID = `999999` not found"
  }
}

Errors

HTTP Code Description
400 INVALID_PARAMS id is not a positive integer
404 ENTITY_NOT_FOUND The knowledge base does not exist or is already deleted
422 BITRIX_ERROR A background document import is running for the knowledge base — deletion is possible after it completes. The text is in error.message
403 BITRIX_ACCESS_DENIED No permission to manage the knowledge base
403 WRITE_BLOCKED_READONLY_KEY The key is in read-only mode
403 SCOPE_DENIED The key is missing the note scope
401 TOKEN_MISSING The API key has no configured tokens

Full list of common API errors — Errors.

Known specifics

  • A knowledge base cannot be restored through the API. Restoration is available from the trash in the Bitrix24 interface.

See also