For AI agents: markdown of this page — /docs-content-en/mail/conversions/crm-activity-delete.md documentation index — /llms.txt
Delete a CRM activity from a message
DELETE /v1/mail/messages/:id/crm-activity
Deletes the CRM activity created from a message and unlinks the message from CRM. No request body is required — the message identifier is taken from the path.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | integer | yes | Message identifier. List: GET /v1/mail/messages |
Examples
curl — personal key
curl -X DELETE \
-H "X-Api-Key: YOUR_API_KEY" \
https://vibecode.bitrix24.com/v1/mail/messages/123/crm-activity
curl — OAuth application
curl -X DELETE \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
https://vibecode.bitrix24.com/v1/mail/messages/123/crm-activity
JavaScript — personal key
const res = await fetch(
'https://vibecode.bitrix24.com/v1/mail/messages/123/crm-activity',
{
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
},
}
)
const body = await res.json()
if (!body.success) throw new Error(body.error.code)
console.log(`Activity deleted: ${body.data.result}`)
JavaScript — OAuth application
const res = await fetch(
'https://vibecode.bitrix24.com/v1/mail/messages/123/crm-activity',
{
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
}
)
const body = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
success |
boolean | true on success |
data.result |
boolean | true when the CRM activity is deleted |
Response example
{
"success": true,
"data": {
"result": true
}
}
Error response example
400 — message not found:
{
"success": false,
"error": {
"code": "INVALID_PARAMS",
"message": "Request object validation failed",
"validation": [
{
"message": "The message was deleted or moved to another folder"
}
]
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_PARAMS |
Non-numeric or negative :id in the path — message id must be a positive integer |
| 400 | INVALID_PARAMS |
The message was deleted or moved to another folder. The reason is in the validation array |
| 401 | MISSING_API_KEY |
The X-Api-Key header is missing |
| 401 | INVALID_API_KEY |
Invalid or expired key |
| 401 | KEY_INACTIVE |
The key is deactivated |
| 401 | KEY_EXPIRED |
The key has expired |
| 401 | TOKEN_MISSING |
The key is not linked to a Bitrix24 portal |
| 403 | SCOPE_DENIED |
The key lacks the mail scope |
| 422 | BITRIX_ERROR |
Other Bitrix24 errors |
| 429 | RATE_LIMITED |
Request limit exceeded |
| 502 | BITRIX_UNAVAILABLE |
Bitrix24 is unavailable |
The full list of common API errors — Errors.
Known specifics
- A repeated call for a message that has no CRM activity returns the same successful response — the operation is idempotent.
- The CRM record created together with the activity stays in your Bitrix24 account — delete it separately.