---
title: "Update Maintenance Window"
description: "Partially updates a maintenance window. All fields are optional; only supplied fields are changed. When targets or tagIds are provided they replace the existing selection entirely."
---

`PATCH /api/maintenance-windows/{id}`

## Path Parameters

- `id` (required): The numeric ID of the maintenance window to update.

## Body

All fields are optional. Omit a field to leave it unchanged.

```json
{
  "name": "Extended deployment window",
  "endTime": "2026-07-11T03:00:00.000Z",
  "targets": [
    { "type": "website", "id": 101 },
    { "type": "dns", "id": 9 }
  ],
  "tagIds": [7, 12],
  "isActive": true
}
```

### Updatable fields

| Field | Type | Notes |
|-------|------|-------|
| `name` | string | Display label |
| `description` | string | Free-text notes |
| `startTime` | ISO 8601 datetime | New start time |
| `endTime` | ISO 8601 datetime | New end time; must be after `startTime` |
| `isActive` | boolean | Enable or disable without deleting |
| `isRecurring` | boolean | Toggle recurrence |
| `recurrencePattern` | object | Replaces the recurrence pattern; structure identical to create |
| `timezone` | string | The IANA zone (e.g. `"Europe/Berlin"`) the recurrence pattern is interpreted in. Case-insensitive spellings and legacy IANA link names (e.g. `"gmt"`, `"Zulu"`) are accepted and stored under the runtime's canonical name, `"utc"` and `"Zulu"` are both stored as `"UTC"`. A raw UTC offset (e.g. `"+05:00"`) is rejected: it carries no daylight-saving rule, so it cannot express what a zone name does. |
| `targets` | `{ type, id }[]` | **Replaces** the full set of explicit monitor targets |
| `tagIds` | number[] | **Replaces** the full set of tag IDs |
| `websiteId` / `icmpMonitorId` / … | number \| null | Legacy single-target fields |
| `customerId` | number | Customer anchor (only for tag-only windows) |

### Replace semantics for targets and tagIds

When `targets` or `tagIds` is included in the request body, the **entire existing selection** for that field is replaced. To remove all explicit targets send `"targets": []`; to remove all tags send `"tagIds": []`.

### Combination rules

PATCH validates target and tag scope using the same resolver as create, but does **not** re-run the create-time Zod superRefine. In practice:

- `customerId` cannot be combined with `targets`, `tagIds`, or legacy fields.
- All monitors in `targets` must belong to the same customer; mixing returns `{ data: { code: "mixedCustomers" } }`.
- An org-wide tag-only window (tags without `customerId`, `targets`, or legacy fields) can be edited by admin or editor users within the organization.

### Readonly users in scope

Read-only users assigned to the window's customer may edit maintenance windows scoped to that customer. Global supporter accounts cannot. Readonly users cannot create or update org-wide tag-only windows.

## Example (cURL)

```bash
BASE_URL="https://uptimeify.io"
TOKEN="<your-api-token>"

curl -X PATCH "$BASE_URL/api/maintenance-windows/42" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"isActive": false}'
```

## Response

Returns the updated maintenance window object in the same shape as [Get Maintenance Window](./get).

## Common errors

| Status | Description |
|--------|-------------|
| `400` (validation) | Update would leave the window with no targets, `customerId` combined with other target fields, or `timezone` is a raw UTC offset or not a zone name the runtime recognizes. These are Zod validation errors; the response body is a standard validation error, **not** `{ data: { code } }`. |
| `400` `{ data: { code: "mixedCustomers" } }` | `targets` contains monitors from different customers. |
| `400` `{ data: { code: "mixedTagOrganizations" } }` | `tagIds` contains tags from different organizations. |
| `401 Unauthorized` | Not logged in. |
| `403 Forbidden` | You cannot access the window (global supporter accounts cannot edit), or you are a readonly user attempting to set an org-wide tag-only scope. |
| `404 Not Found` | No maintenance window with the given ID exists. |
| `404` `{ data: { code: "tagNotFound" } }` | A `tagId` does not exist in your organization. |
