
## Delete calendar resource

`DELETE /v1/calendar-resources/:id`

Deletes a calendar resource by ID. A deleted resource cannot be restored through the API — create a new one if needed.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Resource ID. List: [`GET /v1/calendar-resources`](./list.md) |

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/calendar-resources/285" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/calendar-resources/285" \
  -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/calendar-resources/285', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
if (success && data.deleted) {
  console.log('Resource deleted:', data.id)
}
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/calendar-resources/285', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

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

## Response fields

A successful deletion returns HTTP status `200 OK` with a body.

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.id` | number | ID of the deleted resource |
| `data.deleted` | boolean | `true` — the resource is deleted |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 285,
    "deleted": true
  }
}
```

## Error response example

404 — no resource with this ID:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Calendar record not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | `id` is not a positive integer |
| 400 | `FST_ERR_CTP_EMPTY_JSON_BODY` | The `Content-Type: application/json` header is sent without a body. Send `DELETE` without this header |
| 404 | `ENTITY_NOT_FOUND` | No resource with this `id` exists in the resource list, including when the same `id` is deleted again |
| 422 | `BITRIX_ERROR` | Bitrix24 did not confirm the deletion |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The API key is in read-only mode — writes are forbidden |
| 403 | `SCOPE_DENIED` | The API key does not have the `calendar` scope |
| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied the key owner permission to delete the resource |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header was not passed |
| 429 | `RATE_LIMITED` | Rate limit exceeded |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a malformed resource list |
| 503 | `BITRIX_TIMEOUT` | Bitrix24 did not respond in time |

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

## Known specifics

**No batch deletion.** `POST /v1/calendar-resources/batch` with the `delete` action is rejected with `400 ACTION_NOT_SUPPORTED`. Delete each resource with a separate call to this method.

## See also

- [List calendar resources](./list.md)
- [Create calendar resource](./create.md)
- [Resource bookings](./bookings.md)
- [Calendar resources](/docs/entities/calendar-resources)
