For AI agents: markdown of this page — /docs-content-en/entities/leads/contacts-delete.md documentation index — /llms.txt
Unlink all contacts from a lead
DELETE /v1/leads/:id/contacts
Unlinks all contacts from a lead in one call. The contacts themselves stay in the CRM.
To restore the links later, save the set with GET /v1/leads/:id/contacts before unlinking and pass it to PUT /v1/leads/:id/contacts.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
Parameterid (path) |
Typenumber | Requiredyes | DescriptionLead ID. List: GET /v1/leads |
Examples
curl — personal key
curl -X DELETE "https://vibecode.bitrix24.com/v1/leads/1001321/contacts" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl -X DELETE "https://vibecode.bitrix24.com/v1/leads/1001321/contacts" \
-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/leads/1001321/contacts', {
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
},
})
if (res.status === 204) {
console.log('All contacts unlinked')
}
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/leads/1001321/contacts', {
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
if (res.status === 204) {
console.log('All contacts unlinked')
}
Response
On successful unlinking, the HTTP status 204 No Content is returned with an empty body. Success is indicated by the status code, not by the content.
Response example
HTTP/1.1 204 No Content
Error response example
404 — no lead with this id exists:
{
"success": false,
"error": {
"code": "ENTITY_NOT_FOUND",
"message": "Item was not found."
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
Descriptionid is not a positive integer |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionNo lead with this id exists |
| HTTP401 | CodeMISSING_API_KEY |
DescriptionThe X-Api-Key header is missing |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe key has no Bitrix24 tokens attached |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key does not have the crm scope |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key is in read-only mode. Unlinking requires a key with write access |
| HTTP429 | CodeRATE_LIMITED |
DescriptionRate limit exceeded. Retry after the delay in the Retry-After header |
| HTTP502 | CodeBITRIX_UNAVAILABLE |
DescriptionBitrix24 is unavailable. Retry the request later |
Full list of common API errors — Errors.
Known specifics
- Retrying is safe. A call for a lead without contacts also returns
204, so you can repeat the request after a lost response.