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

Delete a document

DELETE /v1/note/documents/:id

Moves a document together with its entire subtree to the trash. A deleted document cannot be restored via the API, only in the Bitrix24 interface.

Parameters

Parameter In Type Required Description
Parameterid Inpath Typeinteger Requiredyes DescriptionIdentifier of the subtree root document. List: GET /v1/note/documents

Examples

curl — personal key

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

curl — OAuth application

Terminal
curl -X DELETE https://vibecode.bitrix24.com/v1/note/documents/77 \
  -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/documents/77', {
  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/documents/77', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

Response

On successful deletion, the method returns the object { deleted: true }.

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata Typeobject DescriptionDeletion result
Fielddata.deleted Typeboolean Descriptiontrue on successful deletion

Response example

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

Error response example

404 — document not found:

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

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS Descriptionid is not a positive integer
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe access key is read-only
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionNo permission to edit the document
HTTP404 CodeENTITY_NOT_FOUND DescriptionThe document does not exist or is already in the trash
HTTP403 CodeSCOPE_DENIED DescriptionThe key lacks the note scope
HTTP401 CodeTOKEN_MISSING DescriptionThe key has no tokens configured

Full list of common API errors — Errors.

Known specifics

See also