
## Unbind

`DELETE /v1/activities/:activityId/bindings`

Removes the activity's binding to a given CRM entity. The activity no longer shows in that entity's timeline but stays in the timelines of the other bound entities.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `activityId` (path) | number | yes | Activity ID. List: `GET /v1/activities` |
| `entityTypeId` (query) | number | yes | Numeric entity-type code:<br>1 — lead<br>2 — deal<br>3 — contact<br>4 — company<br>7 — quote<br>31 — invoice<br>≥128 — smart-process, its code — in [`GET /v1/smart-processes`](/docs/entities/smart-processes/list) |
| `entityId` (query) | number | yes | ID of the entity to unbind from |

`entityTypeId` and `entityId` can be passed as query parameters or in the request body.

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/activities/3631/bindings?entityTypeId=3&entityId=9" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth app

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/activities/3631/bindings?entityTypeId=3&entityId=9" \
  -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/activities/3631/bindings?entityTypeId=3&entityId=9', {
  method: 'DELETE',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

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

### JavaScript — OAuth app

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/activities/3631/bindings?entityTypeId=3&entityId=9', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.activityId` | number | Activity ID |
| `data.entityTypeId` | number | Numeric type code of the unbound entity |
| `data.entityId` | number | ID of the unbound entity |
| `data.deleted` | boolean | Always `true` — confirmation that the binding was removed |

## Response example

```json
{
  "success": true,
  "data": {
    "activityId": 3631,
    "entityTypeId": 3,
    "entityId": 9,
    "deleted": true
  }
}
```

## Error response example

422 — attempting to remove the only binding:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "You cannot delete the only binding of an activity to an entity"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | `activityId`, `entityTypeId` or `entityId` is not a positive integer |
| 404 | `ENTITY_NOT_FOUND` | No activity exists for the given `activityId` |
| 422 | `BITRIX_ERROR` | Attempt to remove the activity's only remaining binding |
| 403 | `SCOPE_DENIED` | The key lacks the `crm` scope |
| 401 | `TOKEN_MISSING` | The key has no configured tokens |

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

## Known specifics

**You cannot remove the last binding.** An activity must stay bound to at least one entity — an attempt to unbind the only one returns `422` and the binding is kept.

**Moving an activity to another record.** To move an activity without breaking the ban on removing the last binding, see [Move a binding](/docs/entities/activities/bindings/move) — it describes the safe order and a single-call move within the same type.

## See also

- [Bind](/docs/entities/activities/bindings/bind)
- [Move a binding](/docs/entities/activities/bindings/move)
- [List bindings](/docs/entities/activities/bindings/list)
