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

Unlink a contact from a company

DELETE /v1/companies/:id/contacts/:relatedId

Unlinks one contact from a company; the company's other contacts stay linked. The contact itself stays in the CRM.

To restore the link, use POST /v1/companies/:id/contacts.

Parameters

Parameter Type Required Description
Parameterid (path) Typenumber Requiredyes DescriptionCompany ID. List: GET /v1/companies
ParameterrelatedId (path) Typenumber Requiredyes DescriptionID of the linked contact — the contactId value from GET /v1/companies/:id/contacts

Examples

curl — personal key

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

curl — OAuth application

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

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

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/companies/3123/contacts/2989', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

if (res.status === 204) {
  console.log('Contact 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 — the contact is not linked to this company:

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

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS Descriptionid or relatedId is not a positive integer
HTTP404 CodeENTITY_NOT_FOUND DescriptionThe contact with this ID is not linked to this company, for example because it was already unlinked. The message is Binding not found
HTTP404 CodeENTITY_NOT_FOUND DescriptionNo company with this id. The message is Not found.
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 contact's primary company. If this company was the contact's primary company, the contact's companyId field returns the ID of another of its companies, or 0 if it has no other companies. The isPrimary flag on the contact's remaining links does not change.
  • Retrying after a lost response. Unlinking the same contact again answers 404 with the message Binding not found: the link no longer exists. To check the result, use the company's contact list.

See also