# Delete: Booking resources

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

Deletes a booking resource that has no future bookings. 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 identifier. List: [`GET /v1/booking-resources`](/docs/entities/booking-resources/list) |

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/booking-resources/51" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -w "%{http_code}\n"
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/booking-resources/51" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -w "%{http_code}\n"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/booking-resources/51', {
  method: 'DELETE',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

if (res.status === 204) {
  console.log('Deleted')
} else {
  const { error } = await res.json()
  console.log(error.code, error.message)
}
```

### JavaScript — OAuth application

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

if (res.status === 204) {
  console.log('Deleted')
} else {
  const { error } = await res.json()
  console.log(error.code, error.message)
}
```

## Response

On successful deletion, the HTTP status is `204 No Content` with an empty body. The status code signals success, not the body.

## Response example

```
HTTP/1.1 204 No Content
```

## Error response example

422 — the resource has future bookings:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "The resource can not be deleted. There are future bookings with that resource.",
    "b24Code": "1008"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 404 | `ENTITY_NOT_FOUND` | No resource with this `id` exists, including on a repeated deletion. Message `Booking record not found` |
| 422 | `BITRIX_ERROR` | The resource has future bookings. Message `The resource can not be deleted. There are future bookings with that resource.`, `b24Code` `1008` |
| 400 | `INVALID_PARAMS` | `id` is not a positive integer. Message `id must be a positive safe integer` |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is not passed |
| 401 | `TOKEN_MISSING` | The key has no Bitrix24 tokens |
| 403 | `SCOPE_DENIED` | The key does not have the `booking` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode |
| 429 | `RATE_LIMITED` | Request rate exceeded. The effective cap is in the `x-ratelimit-limit` header |
| 502 | `BITRIX_RESPONSE_INVALID` | Bitrix24 did not confirm the deletion |

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

## Known specifics

**Future bookings are not deleted together with the resource.** While the resource has a booking in the future, deletion is refused with `422 BITRIX_ERROR`. First delete those bookings via [`DELETE /v1/bookings/:id`](/docs/entities/bookings/delete), then delete the resource.

## See also

- [List booking resources](/docs/entities/booking-resources/list)
- [Get a booking resource](/docs/entities/booking-resources/get)
- [Bookings](/docs/entities/bookings)
- [Errors](/docs/errors)
