For AI agents: markdown of this page — /docs-content-en/entities/documents/delete.md documentation index — /llms.txt
Delete document
DELETE /v1/documents/:id
Deletes a document by ID. A deleted document cannot be restored through the API — create a new one if needed.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
Parameterid (path) |
Typenumber | Requiredyes | DescriptionDocument identifier. List: GET /v1/documents |
Examples
curl — personal key
curl -X DELETE "https://vibecode.bitrix24.com/v1/documents/51" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl -X DELETE "https://vibecode.bitrix24.com/v1/documents/51" \
-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/documents/51', {
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
},
})
if (res.status === 204) {
console.log('Document deleted')
}
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/documents/51', {
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
if (res.status === 204) {
console.log('Deleted')
}
Response
On successful deletion the API returns HTTP status 204 No Content with an empty body. The success indicator is the response code, not the body.
Response example
HTTP/1.1 204 No Content
Error response example
404 — document not found:
{
"success": false,
"error": {
"code": "ENTITY_NOT_FOUND",
"message": "Document not found"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
Descriptionid is not a number, for example abc. Message: id must be a non-negative integer |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionNo document with that id was found, or it is already deleted |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionBitrix24 denied access to the document |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key works in read-only mode |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key is missing the documentgenerator scope |
| HTTP401 | CodeMISSING_API_KEY |
DescriptionThe X-Api-Key header was not provided |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe key has no tokens mapped to it — an OAuth application key was called without a user session |
Full list of common API errors — Errors.