
## Unbind

`POST /v1/timeline-logs/:id/unbind`

Removes the binding of a log entry to the specified CRM entity. The entry no longer appears in its timeline but remains in the logs of the other bound entities.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Log entry ID |

## Request fields (body)

The same fields as in [`bind`](/docs/timeline-logs/bindings/bind):

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| **`entityId`** | number | yes | ID of the entity to unbind from |
| **`entityTypeId`** | number | yes* | Numeric CRM entity type |
| **`entityType`** | string | yes* | String type code: `"lead"`, `"deal"`, `"contact"`, `"company"`, `"quote"`, `"order"`, `"smart_invoice"`, `"dynamic_<entityTypeId>"` |

*Pass either `entityTypeId` or `entityType`. Full list of supported types — [Bind an entry](/docs/timeline-logs/bindings/bind#supported-types).

## Examples

### curl — personal key

```bash
curl -X POST https://vibecode.bitrix24.com/v1/timeline-logs/5012/unbind \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "entityTypeId": 3, "entityId": 50 }'
```

### curl — OAuth app

```bash
curl -X POST https://vibecode.bitrix24.com/v1/timeline-logs/5012/unbind \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "entityTypeId": 3, "entityId": 50 }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/timeline-logs/5012/unbind', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ entityTypeId: 3, entityId: 50 }),
})

const { success } = await res.json()
```

### JavaScript — OAuth app

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/timeline-logs/5012/unbind', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ entityTypeId: 3, entityId: 50 }),
})

const { success } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.bound` | boolean | Always `false` — confirmation that the binding was removed |

## Response example

```json
{
  "success": true,
  "data": { "bound": false }
}
```

## Error response example

400 — `entityTypeId` with no mapping:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_ENTITY_TYPE_ID",
    "message": "entityTypeId=99 has no ENTITY_TYPE mapping. Use 1=lead, 2=deal, 3=contact, 4=company, 7=quote, 14=order, 31=smart_invoice, or ≥128 for smart-processes."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | `entityId` was not passed, or neither `entityTypeId` nor `entityType` |
| 400 | `INVALID_ENTITY_TYPE_ID` | `entityTypeId` < 128 and not in the mapping table |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the request |
| 403 | `SCOPE_DENIED` | The API key lacks the `crm` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

**Idempotent.** Unbinding from an already-unbound entity returns `200 + {bound: false}` with no error.

**It does not validate the existence of the `:id` log entry.** For a nonexistent `id`, `unbind` also returns `200 + {bound: false}` — the operation is a silent no-op. If the fact that "the binding actually existed and was removed" matters, first call [`GET /v1/timeline-logs/:id/bindings`](/docs/timeline-logs/bindings/list) and check the list before `unbind`.

**Do not unbind the only binding — the entry will be "orphaned".** If an entry has only one binding (for example, the one created automatically with the entry), `unbind` returns `200 + {bound: false}`, but the entry then becomes inaccessible via the API: [`GET /v1/timeline-logs/:id`](/docs/timeline-logs/logs/get) returns `403 BITRIX_ACCESS_DENIED`. This is Bitrix24 behavior — without an active binding the entry loses access.

**Safe order when changing the parent.** First bind to the new entity via [`POST /:id/bind`](./bind.md), then unbind from the original one. As long as at least one binding remains, the entry stays accessible through its timeline.

**To remove the entry everywhere — delete it via `DELETE`.** [`DELETE /v1/timeline-logs/:id`](/docs/timeline-logs/logs/delete) deletes the entry from all bound timelines at once (subject to the cross-app restriction — see the method's documentation).

## See also

- [Bind](/docs/timeline-logs/bindings/bind) — the reverse operation
- [List bindings](/docs/timeline-logs/bindings/list) — check what the entry is currently bound to
- [Delete an entry](/docs/timeline-logs/logs/delete) — fully remove the entry from all timelines
