For AI agents: markdown of this page — /docs-content-en/entities/crm-document-templates/delete.md documentation index — /llms.txt

Delete a CRM document template

DELETE /v1/crm-document-templates/:id

Deletes a CRM document template by its ID. A deleted template cannot be restored via the API — create a new one if needed.

Parameters

Parameter Type Required Description
id (path) number yes Template identifier. List: GET /v1/crm-document-templates

No request body is sent.

Examples

curl — personal key

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

curl — OAuth application

Terminal
curl -X DELETE "https://vibecode.bitrix24.com/v1/crm-document-templates/263" \
  -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-document-templates/263', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const body = await res.json()
if (body.success) {
  console.log('Template deleted')
}

JavaScript — OAuth application

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

const body = await res.json()
if (body.success) {
  console.log('Template deleted')
}

Response fields

On successful deletion, HTTP status 200 OK is returned.

Field Type Description
success boolean true — the template is deleted
data null Deletion result, always null

Response example

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

Error response example

404 — template not found, including when the same id is deleted again:

JSON
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "CRM template not found."
  }
}

Errors

HTTP Code Description
400 INVALID_PARAMS id is not a positive integer, for example abc. Message: Template ID must be a positive integer.
404 ENTITY_NOT_FOUND No template with this id exists, it has already been deleted, or it does not belong to the CRM module. The template is not deleted. Templates with moduleId: rest are deleted by DELETE /v1/doc-templates/:id
422 BITRIX_ERROR Bitrix24 rejected the deletion. The reason is in error.message
403 WRITE_BLOCKED_READONLY_KEY The key is read-only. Deletion requires a key with write access
403 SCOPE_DENIED The key lacks the crm scope
401 TOKEN_MISSING The key has no configured tokens
429 RATE_LIMITED Bitrix24 rate-limited requests to the portal. Retry after the delay in the Retry-After header

Full list of common API errors — Errors.

See also