## Delete a wake window

`DELETE /v1/infra/servers/:id/wake-schedules/:scheduleId`

Deletes one wake window of a server. A deleted window can't be restored through the API — create a new one if you need it back.

## Parameters

| Parameter | In | Type | Required | Description |
|-----------|----|------|:--------:|--------------|
| `id` | path | string (UUID) | yes | ID of the BLACKHOLE server |
| `scheduleId` | path | string | yes | Window ID, taken from `data[].id` in the [window list](./list.md) |

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/infra/servers/SERVER_ID/wake-schedules/SCHEDULE_ID" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/infra/servers/SERVER_ID/wake-schedules/SCHEDULE_ID" \
  -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/infra/servers/${serverId}/wake-schedules/${scheduleId}`,
  { method: 'DELETE', headers: { 'X-Api-Key': 'YOUR_API_KEY' } }
)
const body = await res.json()
if (body.success) console.log('Window deleted')
```

### JavaScript — OAuth application

```javascript
const res = await fetch(
  `https://vibecode.bitrix24.com/v1/infra/servers/${serverId}/wake-schedules/${scheduleId}`,
  {
    method: 'DELETE',
    headers: {
      'X-Api-Key': 'YOUR_APP_KEY',
      'Authorization': 'Bearer USER_SESSION_TOKEN',
    },
  }
)
```

## Response fields

| Field | Type | Description |
|-------|------|--------------|
| `success` | boolean | `true` on successful deletion |

Unlike deleting CRM entity records, this endpoint responds with `200` and the body `{ "success": true }`, not `204 No Content`.

## Response example

```json
{
  "success": true
}
```

## Error response example

404 — window not found:

```json
{
  "success": false,
  "error": {
    "code": "NOT_FOUND",
    "message": "Wake window not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|------|--------------|
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |
| 401 | `INVALID_API_KEY` | The key is not recognized — no such key exists on the platform |
| 403 | `INFRA_SCOPE_REQUIRED` | The key lacks the `vibe:infra` scope |
| 403 | `INFRA_FORBIDDEN_FOR_COWORK_KEY` | The call was made with a Cowork key — such a key works with data only and cannot perform write operations. To issue a key that can, see [Project key for deploy](/docs/cowork/deploy-key) |
| 403 | `SERVER_ROLE_FORBIDDEN` | You are on this server's development team with the Developer role, and this operation is open to the Administrator role. `error.hint` carries your role, the required threshold and the list of calls that are open to you. Role breakdown — [List servers](/docs/infra/servers/list) |
| 404 | `NOT_FOUND` | No window with that `scheduleId` exists on this server, or the server itself was not found, was deleted, or belongs to a different API key while you are not on its development team |
| 429 | `RATE_LIMITED` | The 10-requests-per-minute limit for this endpoint was exceeded. The current limit is returned in the `x-ratelimit-limit` header |

For the full list of shared API errors, see [Errors](/docs/errors).

## Known specifics

- **Works regardless of the feature's per-account status.** Unlike creating and updating, deleting an existing window is not gated by `WAKE_SCHEDULE_DISABLED` — so the server owner can remove a window even if scheduled wake was disabled for their Bitrix24 account after the window was created.
- **Doesn't check server mode or status.** Unlike creating and updating, deleting doesn't run the `BLACKHOLE_ONLY`/`GALAXY_NOT_SUPPORTED`/`WAKE_SCHEDULE_GALAXY_DISABLED`/`ALWAYS_ON_CONFLICT` checks — a window can be deleted from a server in any mode, including from a Galaxy app, provided the window exists on it.

## See also

- [List windows](./list.md)
- [Create a window](./create.md)
- [Update a window](./update.md)
