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

Unlink all contacts from a company

DELETE /v1/companies/:id/contacts

Unlinks all linked contacts from a company in one call; the contacts themselves stay in the CRM.

Before unlinking, request the current set with GET /v1/companies/:id/contacts, so you can restore the links later with PUT /v1/companies/:id/contacts.

Parameters

Parameter Type Required Description
Parameterid (path) Typenumber Requiredyes DescriptionCompany ID. List: GET /v1/companies

Examples

curl — personal key

Terminal
curl -X DELETE "https://vibecode.bitrix24.com/v1/companies/3123/contacts" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

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

if (res.status === 204) {
  console.log('All contacts unlinked')
}

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/companies/3123/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 API returns HTTP status 204 No Content with an empty body. Success is indicated by the response code, not the content.

Response example

HTTP/1.1 204 No Content

Error response example

404 — no company with this id:

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

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS Descriptionid is not a positive integer
HTTP404 CodeENTITY_NOT_FOUND DescriptionNo company with this id
HTTP401 CodeMISSING_API_KEY DescriptionThe X-Api-Key header is missing
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no Bitrix24 tokens configured
HTTP403 CodeSCOPE_DENIED DescriptionThe key has no 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

  • The contacts' primary company. For contacts whose primary company was this company, the companyId field returns the ID of another of their companies, or 0 if they have no other companies.
  • Retrying is safe. A call for a company without contacts also returns 204, so you can repeat the request if the response is lost.

See also