# Schedule maintenance

> Schedule maintenance on an Uptenna status page with the API: affected services show under maintenance, with no incidents or alerts during the window.

Source: https://uptenna.com/docs/api-create-maintenance  
Markdown: https://uptenna.com/docs/api-create-maintenance.md

`POST https://uptenna.com/v1/maintenance-windows`

Schedule a maintenance window on a status page. Subscribers get one email now; during the window the affected monitors open no incidents and send no alerts.

Checks keep running during the window and their results are kept, but failures don't count against uptime. A page can have 20 windows that haven't ended.

## Request body

JSON. Fields not sent take their defaults.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `status_page_id` | string | yes | The status page to show it on (`sp_…`). |
| `title` | string | yes | Up to 120 characters. |
| `message` | string or null | no | What happens and what users may notice. Plain text, up to 1000 characters. |
| `starts_at` | timestamp (ISO 8601) | yes | ISO 8601 with a time zone. Can be in the past (maintenance already running). |
| `ends_at` | timestamp (ISO 8601) | yes | After `starts_at`, in the future, at most 14 days after the start. |
| `monitor_ids` | array of strings | no | Monitors on that page it affects: no incidents or alerts for them during the window. |

## Example request

```bash curl
curl -X POST "https://uptenna.com/v1/maintenance-windows" \
  -H "Authorization: Bearer $UPTENNA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"status_page_id":"sp_Hn4c7VtQ1wXa","title":"Database upgrade","message":"We're upgrading the main database. The API may answer slowly for a few minutes.","starts_at":"2027-01-09T02:00:00Z","ends_at":"2027-01-09T04:00:00Z","monitor_ids":["mon_Xk3v9QmT2bLp"]}'
```

```js Node.js (fetch)
const res = await fetch("https://uptenna.com/v1/maintenance-windows", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UPTENNA_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"status_page_id":"sp_Hn4c7VtQ1wXa","title":"Database upgrade","message":"We're upgrading the main database. The API may answer slowly for a few minutes.","starts_at":"2027-01-09T02:00:00Z","ends_at":"2027-01-09T04:00:00Z","monitor_ids":["mon_Xk3v9QmT2bLp"]}),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const maintenance = await res.json();
```

## Response

Returns **201 Created** with the [maintenance window object](https://uptenna.com/docs/api-objects#maintenance-window).

```json 201 Created
{
  "id": "mnt_F6s2Kd9QwLz3",
  "status_page_id": "sp_Hn4c7VtQ1wXa",
  "title": "Database upgrade",
  "message": "We're upgrading the main database. The API may answer slowly for a few minutes.",
  "starts_at": "2027-01-09T02:00:00.000Z",
  "ends_at": "2027-01-09T04:00:00.000Z",
  "state": "scheduled",
  "monitor_ids": [
    "mon_Xk3v9QmT2bLp"
  ],
  "created_at": "2026-12-01T16:20:31.000Z",
  "updated_at": "2026-12-01T16:20:31.000Z"
}
```

## Errors

Errors look like `{ "error": { "code", "message" } }` (see [Errors](https://uptenna.com/docs/api#errors)).

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_maintenance` | A field is missing or invalid (the window must end after it starts, last up to 14 days and end in the future). |
| 404 | `not_found` | No status page with this id in your account. |
| 409 | `maintenance_limit` | The page already has 20 windows that haven't ended. |
| 429 | `rate_limited` | More than 30 posts that email subscribers (new incidents, updates, maintenance notices) in an hour. |
| 401 | `unauthorized` | The Authorization header is missing, malformed, or the key is unknown or revoked. |
| 429 | `rate_limited` | More than 120 requests in 60 seconds with this key. Wait for the Retry-After header's seconds. |
