export const metadata = {
  title: "Maintenance Windows - OnlineOrNot API Documentation",
  description:
    "Configure maintenance windows to suppress alerts during planned downtime",
}

## List all maintenance windows   {{ tag: 'GET', label: '/v1/maintenance-windows' }}
<Row>
<Col>

<a id="opIdlistMaintenanceWindows"></a>

*Retrieve a paginated list of all maintenance windows*

### Security: Bearer Auth
Provide your bearer token in the Authorization header when making requests to protected resources.

Example: `Authorization: Bearer 123`

<ParameterTree parameters={[{"schema":{"type":"string","default":"1","example":1,"description":"Page number of paginated results."},"required":false,"description":"Page number of paginated results.","name":"page","in":"query","exampleValues":{"object":1,"json":"'1'"},"originalType":"string","safeType":"string","shortDesc":"Page number of paginated results.","style":"form"},{"schema":{"type":"string","default":"20","example":20,"description":"Number of items per page."},"required":false,"description":"Number of items per page.","name":"per_page","in":"query","exampleValues":{"object":20,"json":"'20'"},"originalType":"string","safeType":"string","shortDesc":"Number of items per page.","style":"form"},{"schema":{"type":"string","example":"weekly","description":"Search term to filter maintenance windows by name"},"required":false,"description":"Search term to filter maintenance windows by name","name":"search","in":"query","exampleValues":{"object":"weekly","json":"'weekly'"},"originalType":"string","safeType":"string","shortDesc":"Search term to filter maintenance windows by name","style":"form"}]} title="Query parameters" />

<h3 id="retrieve-a-paginated-list-of-all-maintenance-windows-responses">Responses</h3>

|Status|Meaning|Description|
|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Returns a list of maintenance windows|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized - Invalid or missing API token|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal Server Error|

<ResponseSchemas schemas={[{"status":"200","properties":[{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"abc123def456","description":"Maintenance Window ID"},"name":{"type":"string","example":"Weekly Maintenance","description":"Name of the maintenance window"},"start_date":{"type":"string","example":"09:00","description":"Start time of the maintenance window (HH:MM format)"},"duration_minutes":{"type":"number","example":60,"description":"Duration of the maintenance window in minutes"},"timezone":{"type":"string","example":"America/New_York","description":"Timezone for the maintenance window"},"days_of_week":{"type":"array","items":{"type":"string","enum":["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]},"example":["MONDAY","WEDNESDAY","FRIDAY"],"description":"Days of the week when the maintenance window is active"},"status":{"type":"string","enum":["ENABLED","DISABLED"],"example":"ENABLED","description":"Whether the maintenance window is enabled or disabled"}},"required":["id","name","start_date","duration_minutes","timezone","days_of_week","status"]}},"in":"body","name":"result","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» result"},{"schema":{"type":"string","example":"abc123def456","description":"Maintenance Window ID"},"in":"body","name":"id","depth":2,"description":"Maintenance Window ID","type":"string","safeType":"string","required":true,"displayName":"»» id"},{"schema":{"type":"string","example":"Weekly Maintenance","description":"Name of the maintenance window"},"in":"body","name":"name","depth":2,"description":"Name of the maintenance window","type":"string","safeType":"string","required":true,"displayName":"»» name"},{"schema":{"type":"string","example":"09:00","description":"Start time of the maintenance window (HH:MM format)"},"in":"body","name":"start_date","depth":2,"description":"Start time of the maintenance window (HH:MM format)","type":"string","safeType":"string","required":true,"displayName":"»» start_date"},{"schema":{"type":"number","example":60,"description":"Duration of the maintenance window in minutes"},"in":"body","name":"duration_minutes","depth":2,"description":"Duration of the maintenance window in minutes","type":"number","safeType":"number","required":true,"displayName":"»» duration_minutes"},{"schema":{"type":"string","example":"America/New_York","description":"Timezone for the maintenance window"},"in":"body","name":"timezone","depth":2,"description":"Timezone for the maintenance window","type":"string","safeType":"string","required":true,"displayName":"»» timezone"},{"schema":{"type":"array","items":{"type":"string","enum":["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]},"example":["MONDAY","WEDNESDAY","FRIDAY"],"description":"Days of the week when the maintenance window is active"},"in":"body","name":"days_of_week","depth":2,"description":"Days of the week when the maintenance window is active","type":"array","safeType":"string[]","required":true,"displayName":"»» days_of_week"},{"schema":{"type":"string","enum":["ENABLED","DISABLED"],"example":"ENABLED","description":"Whether the maintenance window is enabled or disabled"},"in":"body","name":"status","depth":2,"description":"Whether the maintenance window is enabled or disabled","type":"string","safeType":"string","required":true,"displayName":"»» status"},{"schema":{"type":"object","properties":{"page":{"type":"number","default":1,"example":1,"description":"Page number of paginated results."},"per_page":{"type":"number","default":20,"example":20,"description":"Number of items per page."},"count":{"type":"number","example":1,"description":"Number of items on the current page."},"total_count":{"type":"number","example":1,"description":"Total number of items."}},"required":["count","total_count"]},"in":"body","name":"result_info","depth":1,"type":"object","safeType":"object","required":true,"displayName":"» result_info"},{"schema":{"type":"number","default":1,"example":1,"description":"Page number of paginated results."},"in":"body","name":"page","depth":2,"description":"Page number of paginated results.","type":"number","safeType":"number","required":false,"displayName":"»» page"},{"schema":{"type":"number","default":20,"example":20,"description":"Number of items per page."},"in":"body","name":"per_page","depth":2,"description":"Number of items per page.","type":"number","safeType":"number","required":false,"displayName":"»» per_page"},{"schema":{"type":"number","example":1,"description":"Number of items on the current page."},"in":"body","name":"count","depth":2,"description":"Number of items on the current page.","type":"number","safeType":"number","required":true,"displayName":"»» count"},{"schema":{"type":"number","example":1,"description":"Total number of items."},"in":"body","name":"total_count","depth":2,"description":"Total number of items.","type":"number","safeType":"number","required":true,"displayName":"»» total_count"},{"schema":{"type":"boolean","default":true,"example":true,"description":"Whether the API call was successful"},"in":"body","name":"success","depth":1,"description":"Whether the API call was successful","type":"boolean","safeType":"boolean","required":true,"displayName":"» success"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"errors","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» errors"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"messages","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» messages"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"}]}]} />

</Col>

<Col sticky>

<CodeGroup title="Request" tag="GET" label="/v1/maintenance-windows">
```bash {{ title: 'cURL' }}
curl --request GET \
  --url https://api.onlineornot.com/v1/maintenance-windows \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
```

```javascript
fetch("https://api.onlineornot.com/v1/maintenance-windows", {
  "method": "GET",
  "headers": {
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
  }
})
.then(response => {
  console.log(response);
})
.catch(err => {
  console.error(err);
});
```

```java
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.onlineornot.com/v1/maintenance-windows")
  .get()
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "Bearer {access-token}")
  .build();

Response response = client.newCall(request).execute();
```

```php
<?php

$request = new HttpRequest();
$request->setUrl('https://api.onlineornot.com/v1/maintenance-windows');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders([
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
```

```ruby
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.onlineornot.com/v1/maintenance-windows")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["Accept"] = 'application/json'
request["Authorization"] = 'Bearer {access-token}'

response = http.request(request)
puts response.read_body
```

```python
import requests

url = "https://api.onlineornot.com/v1/maintenance-windows"

headers = {
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
}

response = requests.request("GET", url, headers=headers)

print(response.text)
```

</CodeGroup>

```json {{ title: 'Response' }}
{
  "result": [
    {
      "id": "abc123def456",
      "name": "Weekly Maintenance",
      "start_date": "09:00",
      "duration_minutes": 60,
      "timezone": "America/New_York",
      "days_of_week": [
        "MONDAY",
        "WEDNESDAY",
        "FRIDAY"
      ],
      "status": "ENABLED"
    }
  ],
  "result_info": {
    "page": 1,
    "per_page": 20,
    "count": 1,
    "total_count": 1
  },
  "success": true,
  "errors": [],
  "messages": []
}
```

</Col>
</Row>

---

## Create a new maintenance window   {{ tag: 'POST', label: '/v1/maintenance-windows' }}
<Row>
<Col>

<a id="opIdcreateMaintenanceWindow"></a>

*Create a new maintenance window with associated checks and heartbeats*

### Security: Bearer Auth
Provide your bearer token in the Authorization header when making requests to protected resources.

Example: `Authorization: Bearer 123`

<ParameterTree parameters={[{"in":"body","schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"example":"Weekly Maintenance","description":"Name of the maintenance window"},"start_date":{"type":"string","example":"09:00","description":"Start time of the maintenance window (HH:MM format)"},"duration_minutes":{"type":"integer","exclusiveMinimum":0,"example":60,"description":"Duration of the maintenance window in minutes"},"timezone":{"type":"string","example":"America/New_York","description":"Timezone for the maintenance window"},"days_of_week":{"type":"array","items":{"type":"string","enum":["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]},"minItems":1,"example":["MONDAY","WEDNESDAY","FRIDAY"],"description":"Days of the week when the maintenance window is active"},"checks":{"type":"array","items":{"type":"string"},"default":[],"example":["abc123","def456"],"description":"Array of uptime check IDs to associate with this maintenance window"},"heartbeats":{"type":"array","items":{"type":"string"},"default":[],"example":["ghi789"],"description":"Array of heartbeat IDs to associate with this maintenance window"}},"required":["name","start_date","duration_minutes","timezone","days_of_week"]},"name":"body","required":true,"exampleValues":{"object":{"name":"Weekly Maintenance","start_date":"09:00","duration_minutes":60,"timezone":"America/New_York","days_of_week":["MONDAY","WEDNESDAY","FRIDAY"],"checks":["abc123","def456"],"heartbeats":["ghi789"]},"json":"{\n  \"name\": \"Weekly Maintenance\",\n  \"start_date\": \"09:00\",\n  \"duration_minutes\": 60,\n  \"timezone\": \"America/New_York\",\n  \"days_of_week\": [\n    \"MONDAY\",\n    \"WEDNESDAY\",\n    \"FRIDAY\"\n  ],\n  \"checks\": [\n    \"abc123\",\n    \"def456\"\n  ],\n  \"heartbeats\": [\n    \"ghi789\"\n  ]\n}"},"originalType":"object","safeType":"object"},{"in":"body","schema":{"type":"string","minLength":1,"example":"Weekly Maintenance","description":"Name of the maintenance window"},"name":"» name","required":true,"description":"Name of the maintenance window","safeType":"string","depth":1,"exampleValues":{"object":"Weekly Maintenance","json":"'Weekly Maintenance'"},"shortDesc":"Name of the maintenance window"},{"in":"body","schema":{"type":"string","example":"09:00","description":"Start time of the maintenance window (HH:MM format)"},"name":"» start_date","required":true,"description":"Start time of the maintenance window (HH:MM format)","safeType":"string","depth":1,"exampleValues":{"object":"09:00","json":"'09:00'"},"shortDesc":"Start time of the maintenance window (HH:MM format)"},{"in":"body","schema":{"type":"integer","exclusiveMinimum":0,"example":60,"description":"Duration of the maintenance window in minutes"},"name":"» duration_minutes","required":true,"description":"Duration of the maintenance window in minutes","safeType":"integer","depth":1,"exampleValues":{"object":60,"json":"'60'"},"shortDesc":"Duration of the maintenance window in minutes"},{"in":"body","schema":{"type":"string","example":"America/New_York","description":"Timezone for the maintenance window"},"name":"» timezone","required":true,"description":"Timezone for the maintenance window","safeType":"string","depth":1,"exampleValues":{"object":"America/New_York","json":"'America/New_York'"},"shortDesc":"Timezone for the maintenance window"},{"in":"body","schema":{"type":"array","items":{"type":"string","enum":["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]},"minItems":1,"example":["MONDAY","WEDNESDAY","FRIDAY"],"description":"Days of the week when the maintenance window is active"},"name":"» days_of_week","required":true,"description":"Days of the week when the maintenance window is active","safeType":"string[]","depth":1,"exampleValues":{"object":["MONDAY","WEDNESDAY","FRIDAY"],"json":"[\n  \"MONDAY\",\n  \"WEDNESDAY\",\n  \"FRIDAY\"\n]"},"shortDesc":"Days of the week when the maintenance window is active"},{"in":"body","schema":{"type":"array","items":{"type":"string"},"default":[],"example":["abc123","def456"],"description":"Array of uptime check IDs to associate with this maintenance window"},"name":"» checks","required":false,"description":"Array of uptime check IDs to associate with this maintenance window","safeType":"string[]","depth":1,"exampleValues":{"object":["abc123","def456"],"json":"[\n  \"abc123\",\n  \"def456\"\n]"},"shortDesc":"Array of uptime check IDs to associate with this maintenance window"},{"in":"body","schema":{"type":"array","items":{"type":"string"},"default":[],"example":["ghi789"],"description":"Array of heartbeat IDs to associate with this maintenance window"},"name":"» heartbeats","required":false,"description":"Array of heartbeat IDs to associate with this maintenance window","safeType":"string[]","depth":1,"exampleValues":{"object":["ghi789"],"json":"[\n  \"ghi789\"\n]"},"shortDesc":"Array of heartbeat IDs to associate with this maintenance window"}]} title="Body parameters" />

<h3 id="create-a-new-maintenance-window-with-associated-checks-and-heartbeats-responses">Responses</h3>

|Status|Meaning|Description|
|---|---|---|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|Returns the created maintenance window|
|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad Request - Invalid input (e.g., invalid check/heartbeat IDs, empty name)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized - Invalid or missing API token|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal Server Error|

<ResponseSchemas schemas={[{"status":"201","properties":[{"schema":{"allOf":[{"type":"object","properties":{"id":{"type":"string","example":"abc123def456","description":"Maintenance Window ID"},"name":{"type":"string","example":"Weekly Maintenance","description":"Name of the maintenance window"},"start_date":{"type":"string","example":"09:00","description":"Start time of the maintenance window (HH:MM format)"},"duration_minutes":{"type":"number","example":60,"description":"Duration of the maintenance window in minutes"},"timezone":{"type":"string","example":"America/New_York","description":"Timezone for the maintenance window"},"days_of_week":{"type":"array","items":{"type":"string","enum":["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]},"example":["MONDAY","WEDNESDAY","FRIDAY"],"description":"Days of the week when the maintenance window is active"},"status":{"type":"string","enum":["ENABLED","DISABLED"],"example":"ENABLED","description":"Whether the maintenance window is enabled or disabled"}},"required":["id","name","start_date","duration_minutes","timezone","days_of_week","status"]},{"type":"object","properties":{"checks":{"type":"array","items":{"type":"string"},"example":["abc123","def456"],"description":"IDs of uptime checks associated with this maintenance window"},"heartbeats":{"type":"array","items":{"type":"string"},"example":["ghi789"],"description":"IDs of heartbeats associated with this maintenance window"}},"required":["checks","heartbeats"]}]},"in":"body","name":"result","depth":1,"type":"any","safeType":"any","required":true,"displayName":"» result"},{"schema":{"type":"object","properties":{"id":{"type":"string","example":"abc123def456","description":"Maintenance Window ID"},"name":{"type":"string","example":"Weekly Maintenance","description":"Name of the maintenance window"},"start_date":{"type":"string","example":"09:00","description":"Start time of the maintenance window (HH:MM format)"},"duration_minutes":{"type":"number","example":60,"description":"Duration of the maintenance window in minutes"},"timezone":{"type":"string","example":"America/New_York","description":"Timezone for the maintenance window"},"days_of_week":{"type":"array","items":{"type":"string","enum":["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]},"example":["MONDAY","WEDNESDAY","FRIDAY"],"description":"Days of the week when the maintenance window is active"},"status":{"type":"string","enum":["ENABLED","DISABLED"],"example":"ENABLED","description":"Whether the maintenance window is enabled or disabled"}},"required":["id","name","start_date","duration_minutes","timezone","days_of_week","status"]},"in":"body","name":"*anonymous*","depth":2,"type":"object","safeType":"object","required":false,"displayName":"»» *anonymous*"},{"schema":{"type":"string","example":"abc123def456","description":"Maintenance Window ID"},"in":"body","name":"id","depth":3,"description":"Maintenance Window ID","type":"string","safeType":"string","required":true,"displayName":"»»» id"},{"schema":{"type":"string","example":"Weekly Maintenance","description":"Name of the maintenance window"},"in":"body","name":"name","depth":3,"description":"Name of the maintenance window","type":"string","safeType":"string","required":true,"displayName":"»»» name"},{"schema":{"type":"string","example":"09:00","description":"Start time of the maintenance window (HH:MM format)"},"in":"body","name":"start_date","depth":3,"description":"Start time of the maintenance window (HH:MM format)","type":"string","safeType":"string","required":true,"displayName":"»»» start_date"},{"schema":{"type":"number","example":60,"description":"Duration of the maintenance window in minutes"},"in":"body","name":"duration_minutes","depth":3,"description":"Duration of the maintenance window in minutes","type":"number","safeType":"number","required":true,"displayName":"»»» duration_minutes"},{"schema":{"type":"string","example":"America/New_York","description":"Timezone for the maintenance window"},"in":"body","name":"timezone","depth":3,"description":"Timezone for the maintenance window","type":"string","safeType":"string","required":true,"displayName":"»»» timezone"},{"schema":{"type":"array","items":{"type":"string","enum":["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]},"example":["MONDAY","WEDNESDAY","FRIDAY"],"description":"Days of the week when the maintenance window is active"},"in":"body","name":"days_of_week","depth":3,"description":"Days of the week when the maintenance window is active","type":"array","safeType":"string[]","required":true,"displayName":"»»» days_of_week"},{"schema":{"type":"string","enum":["ENABLED","DISABLED"],"example":"ENABLED","description":"Whether the maintenance window is enabled or disabled"},"in":"body","name":"status","depth":3,"description":"Whether the maintenance window is enabled or disabled","type":"string","safeType":"string","required":true,"displayName":"»»» status"},{"schema":{"type":"object","properties":{"checks":{"type":"array","items":{"type":"string"},"example":["abc123","def456"],"description":"IDs of uptime checks associated with this maintenance window"},"heartbeats":{"type":"array","items":{"type":"string"},"example":["ghi789"],"description":"IDs of heartbeats associated with this maintenance window"}},"required":["checks","heartbeats"]},"in":"body","name":"*anonymous*","depth":2,"type":"object","safeType":"object","required":false,"displayName":"»» *anonymous*"},{"schema":{"type":"array","items":{"type":"string"},"example":["abc123","def456"],"description":"IDs of uptime checks associated with this maintenance window"},"in":"body","name":"checks","depth":3,"description":"IDs of uptime checks associated with this maintenance window","type":"array","safeType":"string[]","required":true,"displayName":"»»» checks"},{"schema":{"type":"array","items":{"type":"string"},"example":["ghi789"],"description":"IDs of heartbeats associated with this maintenance window"},"in":"body","name":"heartbeats","depth":3,"description":"IDs of heartbeats associated with this maintenance window","type":"array","safeType":"string[]","required":true,"displayName":"»»» heartbeats"},{"schema":{"type":"boolean","default":true,"example":true,"description":"Whether the API call was successful"},"in":"body","name":"success","depth":1,"description":"Whether the API call was successful","type":"boolean","safeType":"boolean","required":true,"displayName":"» success"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"errors","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» errors"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"messages","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» messages"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"}]}]} />

</Col>

<Col sticky>

<CodeGroup title="Request" tag="POST" label="/v1/maintenance-windows">
```bash {{ title: 'cURL' }}
curl --request POST \
  --url https://api.onlineornot.com/v1/maintenance-windows \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}' \
  --header 'Content-Type: application/json' \
  --data '{"name":"Weekly Server Maintenance","start_date":"03:00","duration_minutes":60,"timezone":"America/New_York","days_of_week":["SUNDAY"]}'
```

```javascript
fetch("https://api.onlineornot.com/v1/maintenance-windows", {
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
  },
  "body": "{\"name\":\"Weekly Server Maintenance\",\"start_date\":\"03:00\",\"duration_minutes\":60,\"timezone\":\"America/New_York\",\"days_of_week\":[\"SUNDAY\"]}"
})
.then(response => {
  console.log(response);
})
.catch(err => {
  console.error(err);
});
```

```java
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"name\":\"Weekly Server Maintenance\",\"start_date\":\"03:00\",\"duration_minutes\":60,\"timezone\":\"America/New_York\",\"days_of_week\":[\"SUNDAY\"]}");
Request request = new Request.Builder()
  .url("https://api.onlineornot.com/v1/maintenance-windows")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "Bearer {access-token}")
  .build();

Response response = client.newCall(request).execute();
```

```php
<?php

$request = new HttpRequest();
$request->setUrl('https://api.onlineornot.com/v1/maintenance-windows');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders([
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
]);

$request->setBody('{"name":"Weekly Server Maintenance","start_date":"03:00","duration_minutes":60,"timezone":"America/New_York","days_of_week":["SUNDAY"]}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
```

```ruby
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.onlineornot.com/v1/maintenance-windows")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["Accept"] = 'application/json'
request["Authorization"] = 'Bearer {access-token}'
request.body = "{\"name\":\"Weekly Server Maintenance\",\"start_date\":\"03:00\",\"duration_minutes\":60,\"timezone\":\"America/New_York\",\"days_of_week\":[\"SUNDAY\"]}"

response = http.request(request)
puts response.read_body
```

```python
import requests

url = "https://api.onlineornot.com/v1/maintenance-windows"

payload = {
    "name": "Weekly Server Maintenance",
    "start_date": "03:00",
    "duration_minutes": 60,
    "timezone": "America/New_York",
    "days_of_week": ["SUNDAY"]
}
headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
```

</CodeGroup>

```json {{ title: 'Response' }}
{
  "result": {
    "id": "abc123def456",
    "name": "Weekly Maintenance",
    "start_date": "09:00",
    "duration_minutes": 60,
    "timezone": "America/New_York",
    "days_of_week": [
      "MONDAY",
      "WEDNESDAY",
      "FRIDAY"
    ],
    "status": "ENABLED",
    "checks": [
      "abc123",
      "def456"
    ],
    "heartbeats": [
      "ghi789"
    ]
  },
  "success": true,
  "errors": [],
  "messages": []
}
```

</Col>
</Row>

---

## Get a maintenance window by ID   {{ tag: 'GET', label: '/v1/maintenance-windows/{maintenance_window_id}' }}
<Row>
<Col>

<a id="opIdgetMaintenanceWindow"></a>

*Retrieve a maintenance window with associated checks and heartbeats*

### Security: Bearer Auth
Provide your bearer token in the Authorization header when making requests to protected resources.

Example: `Authorization: Bearer 123`

<ParameterTree parameters={[{"schema":{"type":"string","minLength":8,"example":"abc123def456","description":"Maintenance Window ID"},"required":true,"description":"Maintenance Window ID","name":"maintenance_window_id","in":"path","exampleValues":{"object":"abc123def456","json":"'abc123def456'"},"originalType":"string","safeType":"string","shortDesc":"Maintenance Window ID","style":"simple"}]} title="Path parameters" />

<h3 id="retrieve-a-maintenance-window-with-associated-checks-and-heartbeats-responses">Responses</h3>

|Status|Meaning|Description|
|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Returns a maintenance window with associated check and heartbeat IDs|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized - Invalid or missing API token|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|Not Found - Maintenance window does not exist or belongs to different organization|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal Server Error|

<ResponseSchemas schemas={[{"status":"200","properties":[{"schema":{"allOf":[{"type":"object","properties":{"id":{"type":"string","example":"abc123def456","description":"Maintenance Window ID"},"name":{"type":"string","example":"Weekly Maintenance","description":"Name of the maintenance window"},"start_date":{"type":"string","example":"09:00","description":"Start time of the maintenance window (HH:MM format)"},"duration_minutes":{"type":"number","example":60,"description":"Duration of the maintenance window in minutes"},"timezone":{"type":"string","example":"America/New_York","description":"Timezone for the maintenance window"},"days_of_week":{"type":"array","items":{"type":"string","enum":["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]},"example":["MONDAY","WEDNESDAY","FRIDAY"],"description":"Days of the week when the maintenance window is active"},"status":{"type":"string","enum":["ENABLED","DISABLED"],"example":"ENABLED","description":"Whether the maintenance window is enabled or disabled"}},"required":["id","name","start_date","duration_minutes","timezone","days_of_week","status"]},{"type":"object","properties":{"checks":{"type":"array","items":{"type":"string"},"example":["abc123","def456"],"description":"IDs of uptime checks associated with this maintenance window"},"heartbeats":{"type":"array","items":{"type":"string"},"example":["ghi789"],"description":"IDs of heartbeats associated with this maintenance window"}},"required":["checks","heartbeats"]}]},"in":"body","name":"result","depth":1,"type":"any","safeType":"any","required":true,"displayName":"» result"},{"schema":{"type":"object","properties":{"id":{"type":"string","example":"abc123def456","description":"Maintenance Window ID"},"name":{"type":"string","example":"Weekly Maintenance","description":"Name of the maintenance window"},"start_date":{"type":"string","example":"09:00","description":"Start time of the maintenance window (HH:MM format)"},"duration_minutes":{"type":"number","example":60,"description":"Duration of the maintenance window in minutes"},"timezone":{"type":"string","example":"America/New_York","description":"Timezone for the maintenance window"},"days_of_week":{"type":"array","items":{"type":"string","enum":["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]},"example":["MONDAY","WEDNESDAY","FRIDAY"],"description":"Days of the week when the maintenance window is active"},"status":{"type":"string","enum":["ENABLED","DISABLED"],"example":"ENABLED","description":"Whether the maintenance window is enabled or disabled"}},"required":["id","name","start_date","duration_minutes","timezone","days_of_week","status"]},"in":"body","name":"*anonymous*","depth":2,"type":"object","safeType":"object","required":false,"displayName":"»» *anonymous*"},{"schema":{"type":"string","example":"abc123def456","description":"Maintenance Window ID"},"in":"body","name":"id","depth":3,"description":"Maintenance Window ID","type":"string","safeType":"string","required":true,"displayName":"»»» id"},{"schema":{"type":"string","example":"Weekly Maintenance","description":"Name of the maintenance window"},"in":"body","name":"name","depth":3,"description":"Name of the maintenance window","type":"string","safeType":"string","required":true,"displayName":"»»» name"},{"schema":{"type":"string","example":"09:00","description":"Start time of the maintenance window (HH:MM format)"},"in":"body","name":"start_date","depth":3,"description":"Start time of the maintenance window (HH:MM format)","type":"string","safeType":"string","required":true,"displayName":"»»» start_date"},{"schema":{"type":"number","example":60,"description":"Duration of the maintenance window in minutes"},"in":"body","name":"duration_minutes","depth":3,"description":"Duration of the maintenance window in minutes","type":"number","safeType":"number","required":true,"displayName":"»»» duration_minutes"},{"schema":{"type":"string","example":"America/New_York","description":"Timezone for the maintenance window"},"in":"body","name":"timezone","depth":3,"description":"Timezone for the maintenance window","type":"string","safeType":"string","required":true,"displayName":"»»» timezone"},{"schema":{"type":"array","items":{"type":"string","enum":["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]},"example":["MONDAY","WEDNESDAY","FRIDAY"],"description":"Days of the week when the maintenance window is active"},"in":"body","name":"days_of_week","depth":3,"description":"Days of the week when the maintenance window is active","type":"array","safeType":"string[]","required":true,"displayName":"»»» days_of_week"},{"schema":{"type":"string","enum":["ENABLED","DISABLED"],"example":"ENABLED","description":"Whether the maintenance window is enabled or disabled"},"in":"body","name":"status","depth":3,"description":"Whether the maintenance window is enabled or disabled","type":"string","safeType":"string","required":true,"displayName":"»»» status"},{"schema":{"type":"object","properties":{"checks":{"type":"array","items":{"type":"string"},"example":["abc123","def456"],"description":"IDs of uptime checks associated with this maintenance window"},"heartbeats":{"type":"array","items":{"type":"string"},"example":["ghi789"],"description":"IDs of heartbeats associated with this maintenance window"}},"required":["checks","heartbeats"]},"in":"body","name":"*anonymous*","depth":2,"type":"object","safeType":"object","required":false,"displayName":"»» *anonymous*"},{"schema":{"type":"array","items":{"type":"string"},"example":["abc123","def456"],"description":"IDs of uptime checks associated with this maintenance window"},"in":"body","name":"checks","depth":3,"description":"IDs of uptime checks associated with this maintenance window","type":"array","safeType":"string[]","required":true,"displayName":"»»» checks"},{"schema":{"type":"array","items":{"type":"string"},"example":["ghi789"],"description":"IDs of heartbeats associated with this maintenance window"},"in":"body","name":"heartbeats","depth":3,"description":"IDs of heartbeats associated with this maintenance window","type":"array","safeType":"string[]","required":true,"displayName":"»»» heartbeats"},{"schema":{"type":"boolean","default":true,"example":true,"description":"Whether the API call was successful"},"in":"body","name":"success","depth":1,"description":"Whether the API call was successful","type":"boolean","safeType":"boolean","required":true,"displayName":"» success"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"errors","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» errors"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"messages","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» messages"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"}]}]} />

</Col>

<Col sticky>

<CodeGroup title="Request" tag="GET" label="/v1/maintenance-windows/{maintenance_window_id}">
```bash {{ title: 'cURL' }}
curl --request GET \
  --url https://api.onlineornot.com/v1/maintenance-windows/abc123def456 \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
```

```javascript
fetch("https://api.onlineornot.com/v1/maintenance-windows/abc123def456", {
  "method": "GET",
  "headers": {
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
  }
})
.then(response => {
  console.log(response);
})
.catch(err => {
  console.error(err);
});
```

```java
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.onlineornot.com/v1/maintenance-windows/abc123def456")
  .get()
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "Bearer {access-token}")
  .build();

Response response = client.newCall(request).execute();
```

```php
<?php

$request = new HttpRequest();
$request->setUrl('https://api.onlineornot.com/v1/maintenance-windows/abc123def456');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders([
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
```

```ruby
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.onlineornot.com/v1/maintenance-windows/abc123def456")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["Accept"] = 'application/json'
request["Authorization"] = 'Bearer {access-token}'

response = http.request(request)
puts response.read_body
```

```python
import requests

url = "https://api.onlineornot.com/v1/maintenance-windows/abc123def456"

headers = {
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
}

response = requests.request("GET", url, headers=headers)

print(response.text)
```

</CodeGroup>

```json {{ title: 'Response' }}
{
  "result": {
    "id": "abc123def456",
    "name": "Weekly Maintenance",
    "start_date": "09:00",
    "duration_minutes": 60,
    "timezone": "America/New_York",
    "days_of_week": [
      "MONDAY",
      "WEDNESDAY",
      "FRIDAY"
    ],
    "status": "ENABLED",
    "checks": [
      "abc123",
      "def456"
    ],
    "heartbeats": [
      "ghi789"
    ]
  },
  "success": true,
  "errors": [],
  "messages": []
}
```

</Col>
</Row>

---

## Update a maintenance window   {{ tag: 'PATCH', label: '/v1/maintenance-windows/{maintenance_window_id}' }}
<Row>
<Col>

<a id="opIdupdateMaintenanceWindow"></a>

*Update a maintenance window. All fields are optional - only provided fields will be updated. Updating checks or heartbeats replaces existing associations.*

### Security: Bearer Auth
Provide your bearer token in the Authorization header when making requests to protected resources.

Example: `Authorization: Bearer 123`

<ParameterTree parameters={[{"schema":{"type":"string","minLength":8,"example":"abc123def456","description":"Maintenance Window ID"},"required":true,"description":"Maintenance Window ID","name":"maintenance_window_id","in":"path","exampleValues":{"object":"abc123def456","json":"'abc123def456'"},"originalType":"string","safeType":"string","shortDesc":"Maintenance Window ID","style":"simple"}]} title="Path parameters" />

<ParameterTree parameters={[{"in":"body","schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"example":"Weekly Maintenance","description":"Name of the maintenance window"},"start_date":{"type":"string","example":"09:00","description":"Start time of the maintenance window (HH:MM format)"},"duration_minutes":{"type":"integer","exclusiveMinimum":0,"example":60,"description":"Duration of the maintenance window in minutes"},"timezone":{"type":"string","example":"America/New_York","description":"Timezone for the maintenance window"},"days_of_week":{"type":"array","items":{"type":"string","enum":["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]},"minItems":1,"example":["MONDAY","WEDNESDAY","FRIDAY"],"description":"Days of the week when the maintenance window is active"},"status":{"type":"string","enum":["ENABLED","DISABLED"],"example":"ENABLED","description":"Whether the maintenance window is enabled or disabled"},"checks":{"type":"array","items":{"type":"string"},"example":["abc123","def456"],"description":"Array of uptime check IDs to associate (replaces existing associations)"},"heartbeats":{"type":"array","items":{"type":"string"},"example":["ghi789"],"description":"Array of heartbeat IDs to associate (replaces existing associations)"}}},"name":"body","required":true,"exampleValues":{"object":{"name":"Weekly Maintenance","start_date":"09:00","duration_minutes":60,"timezone":"America/New_York","days_of_week":["MONDAY","WEDNESDAY","FRIDAY"],"status":"ENABLED","checks":["abc123","def456"],"heartbeats":["ghi789"]},"json":"{\n  \"name\": \"Weekly Maintenance\",\n  \"start_date\": \"09:00\",\n  \"duration_minutes\": 60,\n  \"timezone\": \"America/New_York\",\n  \"days_of_week\": [\n    \"MONDAY\",\n    \"WEDNESDAY\",\n    \"FRIDAY\"\n  ],\n  \"status\": \"ENABLED\",\n  \"checks\": [\n    \"abc123\",\n    \"def456\"\n  ],\n  \"heartbeats\": [\n    \"ghi789\"\n  ]\n}"},"originalType":"object","safeType":"object"},{"in":"body","schema":{"type":"string","minLength":1,"example":"Weekly Maintenance","description":"Name of the maintenance window"},"name":"» name","required":false,"description":"Name of the maintenance window","safeType":"string","depth":1,"exampleValues":{"object":"Weekly Maintenance","json":"'Weekly Maintenance'"},"shortDesc":"Name of the maintenance window"},{"in":"body","schema":{"type":"string","example":"09:00","description":"Start time of the maintenance window (HH:MM format)"},"name":"» start_date","required":false,"description":"Start time of the maintenance window (HH:MM format)","safeType":"string","depth":1,"exampleValues":{"object":"09:00","json":"'09:00'"},"shortDesc":"Start time of the maintenance window (HH:MM format)"},{"in":"body","schema":{"type":"integer","exclusiveMinimum":0,"example":60,"description":"Duration of the maintenance window in minutes"},"name":"» duration_minutes","required":false,"description":"Duration of the maintenance window in minutes","safeType":"integer","depth":1,"exampleValues":{"object":60,"json":"'60'"},"shortDesc":"Duration of the maintenance window in minutes"},{"in":"body","schema":{"type":"string","example":"America/New_York","description":"Timezone for the maintenance window"},"name":"» timezone","required":false,"description":"Timezone for the maintenance window","safeType":"string","depth":1,"exampleValues":{"object":"America/New_York","json":"'America/New_York'"},"shortDesc":"Timezone for the maintenance window"},{"in":"body","schema":{"type":"array","items":{"type":"string","enum":["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]},"minItems":1,"example":["MONDAY","WEDNESDAY","FRIDAY"],"description":"Days of the week when the maintenance window is active"},"name":"» days_of_week","required":false,"description":"Days of the week when the maintenance window is active","safeType":"string[]","depth":1,"exampleValues":{"object":["MONDAY","WEDNESDAY","FRIDAY"],"json":"[\n  \"MONDAY\",\n  \"WEDNESDAY\",\n  \"FRIDAY\"\n]"},"shortDesc":"Days of the week when the maintenance window is active"},{"in":"body","schema":{"type":"string","enum":["ENABLED","DISABLED"],"example":"ENABLED","description":"Whether the maintenance window is enabled or disabled"},"name":"» status","required":false,"description":"Whether the maintenance window is enabled or disabled","safeType":"string","depth":1,"exampleValues":{"object":"ENABLED","json":"'ENABLED'"},"shortDesc":"Whether the maintenance window is enabled or disabled"},{"in":"body","schema":{"type":"array","items":{"type":"string"},"example":["abc123","def456"],"description":"Array of uptime check IDs to associate (replaces existing associations)"},"name":"» checks","required":false,"description":"Array of uptime check IDs to associate (replaces existing associations)","safeType":"string[]","depth":1,"exampleValues":{"object":["abc123","def456"],"json":"[\n  \"abc123\",\n  \"def456\"\n]"},"shortDesc":"Array of uptime check IDs to associate (replaces existing associations)"},{"in":"body","schema":{"type":"array","items":{"type":"string"},"example":["ghi789"],"description":"Array of heartbeat IDs to associate (replaces existing associations)"},"name":"» heartbeats","required":false,"description":"Array of heartbeat IDs to associate (replaces existing associations)","safeType":"string[]","depth":1,"exampleValues":{"object":["ghi789"],"json":"[\n  \"ghi789\"\n]"},"shortDesc":"Array of heartbeat IDs to associate (replaces existing associations)"}]} title="Body parameters" />

<h3 id="update-a-maintenance-window.-all-fields-are-optional---only-provided-fields-will-be-updated.-updating-checks-or-heartbeats-replaces-existing-associations.-responses">Responses</h3>

|Status|Meaning|Description|
|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Returns the updated maintenance window|
|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad Request - Invalid input (e.g., invalid check/heartbeat IDs, no fields to update)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized - Invalid or missing API token|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|Not Found - Maintenance window does not exist or belongs to different organization|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal Server Error|

<ResponseSchemas schemas={[{"status":"200","properties":[{"schema":{"allOf":[{"type":"object","properties":{"id":{"type":"string","example":"abc123def456","description":"Maintenance Window ID"},"name":{"type":"string","example":"Weekly Maintenance","description":"Name of the maintenance window"},"start_date":{"type":"string","example":"09:00","description":"Start time of the maintenance window (HH:MM format)"},"duration_minutes":{"type":"number","example":60,"description":"Duration of the maintenance window in minutes"},"timezone":{"type":"string","example":"America/New_York","description":"Timezone for the maintenance window"},"days_of_week":{"type":"array","items":{"type":"string","enum":["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]},"example":["MONDAY","WEDNESDAY","FRIDAY"],"description":"Days of the week when the maintenance window is active"},"status":{"type":"string","enum":["ENABLED","DISABLED"],"example":"ENABLED","description":"Whether the maintenance window is enabled or disabled"}},"required":["id","name","start_date","duration_minutes","timezone","days_of_week","status"]},{"type":"object","properties":{"checks":{"type":"array","items":{"type":"string"},"example":["abc123","def456"],"description":"IDs of uptime checks associated with this maintenance window"},"heartbeats":{"type":"array","items":{"type":"string"},"example":["ghi789"],"description":"IDs of heartbeats associated with this maintenance window"}},"required":["checks","heartbeats"]}]},"in":"body","name":"result","depth":1,"type":"any","safeType":"any","required":true,"displayName":"» result"},{"schema":{"type":"object","properties":{"id":{"type":"string","example":"abc123def456","description":"Maintenance Window ID"},"name":{"type":"string","example":"Weekly Maintenance","description":"Name of the maintenance window"},"start_date":{"type":"string","example":"09:00","description":"Start time of the maintenance window (HH:MM format)"},"duration_minutes":{"type":"number","example":60,"description":"Duration of the maintenance window in minutes"},"timezone":{"type":"string","example":"America/New_York","description":"Timezone for the maintenance window"},"days_of_week":{"type":"array","items":{"type":"string","enum":["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]},"example":["MONDAY","WEDNESDAY","FRIDAY"],"description":"Days of the week when the maintenance window is active"},"status":{"type":"string","enum":["ENABLED","DISABLED"],"example":"ENABLED","description":"Whether the maintenance window is enabled or disabled"}},"required":["id","name","start_date","duration_minutes","timezone","days_of_week","status"]},"in":"body","name":"*anonymous*","depth":2,"type":"object","safeType":"object","required":false,"displayName":"»» *anonymous*"},{"schema":{"type":"string","example":"abc123def456","description":"Maintenance Window ID"},"in":"body","name":"id","depth":3,"description":"Maintenance Window ID","type":"string","safeType":"string","required":true,"displayName":"»»» id"},{"schema":{"type":"string","example":"Weekly Maintenance","description":"Name of the maintenance window"},"in":"body","name":"name","depth":3,"description":"Name of the maintenance window","type":"string","safeType":"string","required":true,"displayName":"»»» name"},{"schema":{"type":"string","example":"09:00","description":"Start time of the maintenance window (HH:MM format)"},"in":"body","name":"start_date","depth":3,"description":"Start time of the maintenance window (HH:MM format)","type":"string","safeType":"string","required":true,"displayName":"»»» start_date"},{"schema":{"type":"number","example":60,"description":"Duration of the maintenance window in minutes"},"in":"body","name":"duration_minutes","depth":3,"description":"Duration of the maintenance window in minutes","type":"number","safeType":"number","required":true,"displayName":"»»» duration_minutes"},{"schema":{"type":"string","example":"America/New_York","description":"Timezone for the maintenance window"},"in":"body","name":"timezone","depth":3,"description":"Timezone for the maintenance window","type":"string","safeType":"string","required":true,"displayName":"»»» timezone"},{"schema":{"type":"array","items":{"type":"string","enum":["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]},"example":["MONDAY","WEDNESDAY","FRIDAY"],"description":"Days of the week when the maintenance window is active"},"in":"body","name":"days_of_week","depth":3,"description":"Days of the week when the maintenance window is active","type":"array","safeType":"string[]","required":true,"displayName":"»»» days_of_week"},{"schema":{"type":"string","enum":["ENABLED","DISABLED"],"example":"ENABLED","description":"Whether the maintenance window is enabled or disabled"},"in":"body","name":"status","depth":3,"description":"Whether the maintenance window is enabled or disabled","type":"string","safeType":"string","required":true,"displayName":"»»» status"},{"schema":{"type":"object","properties":{"checks":{"type":"array","items":{"type":"string"},"example":["abc123","def456"],"description":"IDs of uptime checks associated with this maintenance window"},"heartbeats":{"type":"array","items":{"type":"string"},"example":["ghi789"],"description":"IDs of heartbeats associated with this maintenance window"}},"required":["checks","heartbeats"]},"in":"body","name":"*anonymous*","depth":2,"type":"object","safeType":"object","required":false,"displayName":"»» *anonymous*"},{"schema":{"type":"array","items":{"type":"string"},"example":["abc123","def456"],"description":"IDs of uptime checks associated with this maintenance window"},"in":"body","name":"checks","depth":3,"description":"IDs of uptime checks associated with this maintenance window","type":"array","safeType":"string[]","required":true,"displayName":"»»» checks"},{"schema":{"type":"array","items":{"type":"string"},"example":["ghi789"],"description":"IDs of heartbeats associated with this maintenance window"},"in":"body","name":"heartbeats","depth":3,"description":"IDs of heartbeats associated with this maintenance window","type":"array","safeType":"string[]","required":true,"displayName":"»»» heartbeats"},{"schema":{"type":"boolean","default":true,"example":true,"description":"Whether the API call was successful"},"in":"body","name":"success","depth":1,"description":"Whether the API call was successful","type":"boolean","safeType":"boolean","required":true,"displayName":"» success"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"errors","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» errors"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"messages","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» messages"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"}]}]} />

</Col>

<Col sticky>

<CodeGroup title="Request" tag="PATCH" label="/v1/maintenance-windows/{maintenance_window_id}">
```bash {{ title: 'cURL' }}
curl --request PATCH \
  --url https://api.onlineornot.com/v1/maintenance-windows/abc123def456 \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}' \
  --header 'Content-Type: application/json' \
  --data '{"name":"Updated Maintenance Window"}'
```

```javascript
fetch("https://api.onlineornot.com/v1/maintenance-windows/abc123def456", {
  "method": "PATCH",
  "headers": {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
  },
  "body": "{\"name\":\"Updated Maintenance Window\"}"
})
.then(response => {
  console.log(response);
})
.catch(err => {
  console.error(err);
});
```

```java
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"name\":\"Updated Maintenance Window\"}");
Request request = new Request.Builder()
  .url("https://api.onlineornot.com/v1/maintenance-windows/abc123def456")
  .patch(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "Bearer {access-token}")
  .build();

Response response = client.newCall(request).execute();
```

```php
<?php

HttpRequest::methodRegister('PATCH');
$request = new HttpRequest();
$request->setUrl('https://api.onlineornot.com/v1/maintenance-windows/abc123def456');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);

$request->setHeaders([
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
]);

$request->setBody('{"name":"Updated Maintenance Window"}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
```

```ruby
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.onlineornot.com/v1/maintenance-windows/abc123def456")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request["Accept"] = 'application/json'
request["Authorization"] = 'Bearer {access-token}'
request.body = "{\"name\":\"Updated Maintenance Window\"}"

response = http.request(request)
puts response.read_body
```

```python
import requests

url = "https://api.onlineornot.com/v1/maintenance-windows/abc123def456"

payload = {"name": "Updated Maintenance Window"}
headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
}

response = requests.request("PATCH", url, json=payload, headers=headers)

print(response.text)
```

</CodeGroup>

```json {{ title: 'Response' }}
{
  "result": {
    "id": "abc123def456",
    "name": "Weekly Maintenance",
    "start_date": "09:00",
    "duration_minutes": 60,
    "timezone": "America/New_York",
    "days_of_week": [
      "MONDAY",
      "WEDNESDAY",
      "FRIDAY"
    ],
    "status": "ENABLED",
    "checks": [
      "abc123",
      "def456"
    ],
    "heartbeats": [
      "ghi789"
    ]
  },
  "success": true,
  "errors": [],
  "messages": []
}
```

</Col>
</Row>

---

## Delete a maintenance window   {{ tag: 'DELETE', label: '/v1/maintenance-windows/{maintenance_window_id}' }}
<Row>
<Col>

<a id="opIddeleteMaintenanceWindow"></a>

*Delete a maintenance window and all its associations with checks and heartbeats*

### Security: Bearer Auth
Provide your bearer token in the Authorization header when making requests to protected resources.

Example: `Authorization: Bearer 123`

<ParameterTree parameters={[{"schema":{"type":"string","minLength":8,"example":"abc123def456","description":"Maintenance Window ID"},"required":true,"description":"Maintenance Window ID","name":"maintenance_window_id","in":"path","exampleValues":{"object":"abc123def456","json":"'abc123def456'"},"originalType":"string","safeType":"string","shortDesc":"Maintenance Window ID","style":"simple"}]} title="Path parameters" />

<h3 id="delete-a-maintenance-window-and-all-its-associations-with-checks-and-heartbeats-responses">Responses</h3>

|Status|Meaning|Description|
|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Returns the deleted maintenance window ID|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized - Invalid or missing API token|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|Not Found - Maintenance window does not exist or belongs to different organization|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal Server Error|

<ResponseSchemas schemas={[{"status":"200","properties":[{"schema":{"type":"object","properties":{"id":{"type":"string","example":"abc123def456","description":"ID of the deleted maintenance window"}},"required":["id"]},"in":"body","name":"result","depth":1,"type":"object","safeType":"object","required":true,"displayName":"» result"},{"schema":{"type":"string","example":"abc123def456","description":"ID of the deleted maintenance window"},"in":"body","name":"id","depth":2,"description":"ID of the deleted maintenance window","type":"string","safeType":"string","required":true,"displayName":"»» id"},{"schema":{"type":"boolean","default":true,"example":true,"description":"Whether the API call was successful"},"in":"body","name":"success","depth":1,"description":"Whether the API call was successful","type":"boolean","safeType":"boolean","required":true,"displayName":"» success"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"errors","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» errors"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"messages","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» messages"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"}]}]} />

</Col>

<Col sticky>

<CodeGroup title="Request" tag="DELETE" label="/v1/maintenance-windows/{maintenance_window_id}">
```bash {{ title: 'cURL' }}
curl --request DELETE \
  --url https://api.onlineornot.com/v1/maintenance-windows/abc123def456 \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
```

```javascript
fetch("https://api.onlineornot.com/v1/maintenance-windows/abc123def456", {
  "method": "DELETE",
  "headers": {
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
  }
})
.then(response => {
  console.log(response);
})
.catch(err => {
  console.error(err);
});
```

```java
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.onlineornot.com/v1/maintenance-windows/abc123def456")
  .delete(null)
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "Bearer {access-token}")
  .build();

Response response = client.newCall(request).execute();
```

```php
<?php

$request = new HttpRequest();
$request->setUrl('https://api.onlineornot.com/v1/maintenance-windows/abc123def456');
$request->setMethod(HTTP_METH_DELETE);

$request->setHeaders([
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
```

```ruby
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.onlineornot.com/v1/maintenance-windows/abc123def456")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["Accept"] = 'application/json'
request["Authorization"] = 'Bearer {access-token}'

response = http.request(request)
puts response.read_body
```

```python
import requests

url = "https://api.onlineornot.com/v1/maintenance-windows/abc123def456"

headers = {
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
}

response = requests.request("DELETE", url, headers=headers)

print(response.text)
```

</CodeGroup>

```json {{ title: 'Response' }}
{
  "result": {
    "id": "abc123def456"
  },
  "success": true,
  "errors": [],
  "messages": []
}
```

</Col>
</Row>

---

