# Schedule maintenance

Announce planned work on your status page with its window, so visitors know in advance and the time does not count against uptime.

A maintenance is an incident of kind `maintenance` with a window: `scheduledStart` and
`scheduledEnd`. Replace _page-id_ with the status page's id and _incident-id_ with the
maintenance's, and the component id in the examples (`7c1d2e3f-4a5b-4c6d-8e9f-0a1b2c3d4e5f`) with
one of the page's component ids.

| Status        | What the page shows                                                                          |
| ------------- | -------------------------------------------------------------------------------------------- |
| `scheduled`   | A card under **Scheduled maintenance** with the window in UTC and its length                 |
| `in_progress` | The same card; its components show **Maintenance** (also from `scheduledStart` on by itself) |
| `completed`   | The maintenance moves to **History**                                                         |

Outage time inside the window is drawn as maintenance on the day cells and does not count against
uptime. An open incident on the same component still makes it worse than maintenance. Subscribers
are told when you announce it and with every update, like for an incident.

## Prerequisites

- Permission on the page, `rn:ews::<organization id>:monitoring:status-page/<page id>`:
  `monitoring:CreateIncident` to announce it, `monitoring:UpdateIncident` to post an update or
  complete it.
- In the console, also `monitoring:DescribeStatusPages` on the page to open it.

## Announce the maintenance

**Console**
1. Open **Monitoring**, then **Status pages**, and choose the page.
2. Under **Incidents**, for **Kind**, choose **Scheduled maintenance**.
3. Enter the title and what will happen, and for **Starts** and **Ends** the window in your own
   time zone; the page shows it in UTC.
4. Select the components it affects, and choose **Announce maintenance**.

**CLI**
```sh
dcloud monitoring incidents create page-id --kind maintenance \
  --title "Database minor version rollout" --impact minor \
  --scheduled-start 2026-11-24T02:00:00Z --scheduled-end 2026-11-24T04:00:00Z \
  --body "Each instance restarts once, for under 60 seconds." \
  --component-ids 7c1d2e3f-4a5b-4c6d-8e9f-0a1b2c3d4e5f
```

**API**
```http
POST /monitoring/api/status-pages/page-id/incidents
{ "kind": "maintenance", "title": "Database minor version rollout", "impact": "minor",
  "scheduledStart": "2026-11-24T02:00:00Z", "scheduledEnd": "2026-11-24T04:00:00Z",
  "body": "Each instance restarts once, for under 60 seconds.",
  "componentIds": ["7c1d2e3f-4a5b-4c6d-8e9f-0a1b2c3d4e5f"] }
```

## Start and complete it

Post an update with the status `in_progress` when the work starts and `completed` when it is done:

```sh
dcloud monitoring incidents update page-id incident-id --status completed \
  --body "All instances run the new version."
```

## When it is refused

- `400` "A maintenance needs scheduledStart and scheduledEnd", "scheduledEnd must be after
  scheduledStart", or "A maintenance is scheduled at most a year ahead".
- `400` "A maintenance takes the status scheduled, in_progress, completed; not resolved" for a
  status of an incident (and the other way round).

## Related

- [Post an incident](post-an-incident.md)
- [Add components to a status page](add-components.md)
- `monitoring.incidents.create`
