## Delete journal entry

`DELETE /v1/calls/log/:callId`

Deletes a record from the key owner's personal call journal. A record in another user's journal cannot be deleted. A deleted record cannot be restored via the API.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|-------|----------|
| `callId` (path) | integer | yes | Journal record ID — the `id` field from the [call journal list](/docs/calls/log/list) |

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/calls/log/77" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/calls/log/77" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const response = await fetch('https://vibecode.bitrix24.com/v1/calls/log/77', {
  method: 'DELETE',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { success, data, error } = await response.json()
console.log(success ? data.missedCounter : error.code)
```

### JavaScript — OAuth application

```javascript
const response = await fetch('https://vibecode.bitrix24.com/v1/calls/log/77', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})
const { success, data, error } = await response.json()
console.log(success ? data.missedCounter : error.code)
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | `true` on success, HTTP `200` |
| `data.deleted` | boolean | Always `true` — the record is deleted |
| `data.missedCounter` | integer | Missed-call counter after the deletion |

## Response example

```json
{
  "success": true,
  "data": {
    "deleted": true,
    "missedCounter": 0
  }
}
```

## Error response example

404 — no record with this `callId` in the journal:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Call log entry not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_CALL_ID` | `callId` is not a positive integer: `callId must be a positive integer` |
| 404 | `ENTITY_NOT_FOUND` | No record with this `callId` in the key owner's journal |
| 422 | `CALL_LOG_PREREAD_LIMIT_EXCEEDED` | The record was not found among the 5000 newest journal records; nothing is deleted |
| 422 | `BITRIX_ERROR` | Bitrix24 did not confirm the deletion: `Bitrix24 did not delete the call log entry` |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | A read-only key cannot delete records — see [access rights](/docs/access-rights) |
| 403 | `SCOPE_DENIED` | The key lacks the `call` scope |
| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied access |
| 401 | `TOKEN_MISSING` | The key has no Bitrix24 tokens configured |
| 429 | `RATE_LIMITED` | The Bitrix24 request limit is exceeded |
| 502 | `BITRIX_ERROR` | The journal response does not have the expected shape, or the journal cursor stopped advancing |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable |
| 503 | `BITRIX_TIMEOUT` | Bitrix24 did not respond in time |

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

## Known specifics

**The journal is read before deletion.** Vibecode first looks for the record in the key owner's journal, 100 records per request, and deletes it only if found. That is why a missing record or another user's record returns `404`, not success.

**Only the 5000 newest records can be deleted.** The search reads at most 50 pages of 100 records. An older record returns `422 CALL_LOG_PREREAD_LIMIT_EXCEEDED` and cannot be deleted via the API.

## See also

- [Call journal](/docs/calls/log)
- [List call journal](/docs/calls/log/list)
- [Chat with a user](/docs/calls/log/chat)
