Untuk ejen AI: markdown halaman ini — /docs-content-en/entities/documents/crm-delete.md indeks dokumentasi — /llms.txt

Artikel dokumentasi kini tersedia dalam bahasa Inggeris.

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
id (path) number yes Document ID, a positive integer. Documents of a record: GET /v1/crm-documents

The request has no body.

Examples

curl — personal key

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

curl — OAuth application

Terminal
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

javascript
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

javascript
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:

JSON
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Document not found"
  }
}

Errors

HTTP Code Description
400 INVALID_PARAMS id is not a positive integer, for example 0 or abc. Message: id must be a positive integer
404 ENTITY_NOT_FOUND No document with this id exists, or it was already deleted
403 BITRIX_ACCESS_DENIED No access to the CRM record the document is attached to, including when the record does not exist. Message: Access denied
403 WRITE_BLOCKED_READONLY_KEY The key is in read-only mode
403 SCOPE_DENIED The key lacks the crm scope
401 MISSING_API_KEY The X-Api-Key header is missing
401 TOKEN_MISSING The key has no tokens mapped to it — an OAuth application key was called without a user session

Full list of common API errors — Errors.

See also