لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/entities/documents/crm-delete.md فهرس التوثيق — /llms.txt
مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.
Delete a CRM document
DELETE /v1/crm-documents/:id
Deletes a document generated for a CRM record. It cannot be restored through the API — generate a new one if needed.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
Parameterid (path) |
Typenumber | Requiredyes | DescriptionDocument ID, a positive integer. Documents of a record: GET /v1/crm-documents |
The request has no body.
Examples
curl — personal key
curl -X DELETE "https://vibecode.bitrix24.com/v1/crm-documents/1969" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl -X DELETE "https://vibecode.bitrix24.com/v1/crm-documents/1969" \
-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/crm-documents/1969', {
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/crm-documents/1969', {
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
if (res.status === 204) {
console.log('Document deleted')
}
Response
On successful deletion, the HTTP status 204 No Content is returned with an empty body. Success is indicated by the status code, not the content.
Response example
HTTP/1.1 204 No Content
Error response example
404 — no document with this id exists, including when the same id is deleted again:
{
"success": false,
"error": {
"code": "ENTITY_NOT_FOUND",
"message": "Document not found"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
Descriptionid is not a positive integer, for example 0 or abc. Message: id must be a positive integer |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionNo document with this id exists, or it was already deleted |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionNo access to the CRM record the document is attached to, including when the record does not exist. Message: Access denied |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key is in read-only mode |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key lacks the crm scope |
| HTTP401 | CodeMISSING_API_KEY |
DescriptionThe X-Api-Key header is missing |
| 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.