Maintenance Windows API

Maintenance windows allow you to schedule planned downtime for your monitors. During a maintenance window, the monitor will not trigger alerts even if it goes down.

All maintenance window endpoints require authentication. Include the Authorization: Bearer {token} header with all requests.

Maintenance Window Status

StatusDescription
SCHEDULEDMaintenance window is scheduled but hasn't started yet
IN_PROGRESSMaintenance window is currently active
COMPLETEDMaintenance window has ended
CANCELLEDMaintenance window was cancelled before completion

List Maintenance Windows

GET/api/maintenance-windows

Retrieve all maintenance windows for the authenticated user's monitors

Headers:

HeaderValue
AuthorizationBearer {access_token}

Success Response (200 OK):

{
  "maintenanceWindows": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "monitor_id": "monitor-uuid",
      "monitor_name": "Production API",
      "title": "Database Migration",
      "start_time": "2024-01-20T02:00:00Z",
      "end_time": "2024-01-20T04:00:00Z",
      "status": "SCHEDULED",
      "created_by": "user-uuid",
      "created_at": "2024-01-15T10:00:00Z"
    },
    {
      "id": "660e8400-e29b-41d4-a716-446655440001",
      "monitor_id": "monitor-uuid-2",
      "monitor_name": "Database Server",
      "title": "Security Patch Update",
      "start_time": "2024-01-18T00:00:00Z",
      "end_time": "2024-01-18T01:00:00Z",
      "status": "COMPLETED",
      "created_by": "user-uuid",
      "created_at": "2024-01-14T08:00:00Z"
    }
  ]
}

Maintenance windows are sorted by start time in descending order (most recent first).


Create Maintenance Window

POST/api/maintenance-windows

Schedule a new maintenance window

Headers:

HeaderValue
AuthorizationBearer {access_token}
Content-Typeapplication/json

Request Body:

FieldTypeRequiredValidation
monitor_idUUIDYesMust be a monitor owned by the user
titlestringYes1-200 characters
start_timeISO 8601YesValid datetime
end_timeISO 8601YesMust be after start_time

Request Example:

{
  "monitor_id": "550e8400-e29b-41d4-a716-446655440000",
  "title": "Database Migration - v2.5",
  "start_time": "2024-01-20T02:00:00Z",
  "end_time": "2024-01-20T04:00:00Z"
}

Success Response (201 Created):

{
  "maintenanceWindow": {
    "id": "770e8400-e29b-41d4-a716-446655440002",
    "monitor_id": "550e8400-e29b-41d4-a716-446655440000",
    "title": "Database Migration - v2.5",
    "start_time": "2024-01-20T02:00:00Z",
    "end_time": "2024-01-20T04:00:00Z",
    "status": "SCHEDULED",
    "created_by": "user-uuid",
    "created_at": "2024-01-15T10:00:00Z"
  }
}

If the current time is within the maintenance window (start_time has passed but end_time hasn't), the status is automatically set to IN_PROGRESS.

Error Responses:

StatusErrorDescription
400Validation errorsInvalid request body
400End time must be after start timeInvalid time range
404Monitor not foundMonitor doesn't exist or not owned by user

Cancel Maintenance Window

PUT/api/maintenance-windows/:id/cancel

Cancel a scheduled or in-progress maintenance window

Path Parameters:

ParameterTypeDescription
idUUIDMaintenance window ID

Headers:

HeaderValue
AuthorizationBearer {access_token}

Success Response (200 OK):

{
  "maintenanceWindow": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "monitor_id": "monitor-uuid",
    "title": "Database Migration - v2.5",
    "start_time": "2024-01-20T02:00:00Z",
    "end_time": "2024-01-20T04:00:00Z",
    "status": "CANCELLED",
    "created_by": "user-uuid",
    "created_at": "2024-01-15T10:00:00Z"
  }
}

Error Responses:

StatusErrorDescription
404Maintenance window not found or already completedInvalid ID, not owned by user, or status is COMPLETED

Only maintenance windows with status SCHEDULED or IN_PROGRESS can be cancelled. Completed maintenance windows cannot be cancelled.


Delete Maintenance Window

DELETE/api/maintenance-windows/:id

Permanently delete a maintenance window

Path Parameters:

ParameterTypeDescription
idUUIDMaintenance window ID

Headers:

HeaderValue
AuthorizationBearer {access_token}

Success Response (200 OK):

{
  "success": true
}

Error Responses:

StatusErrorDescription
404Maintenance window not foundInvalid ID or not owned by user

How Maintenance Windows Work

Alert Suppression

During an active maintenance window:

  1. The monitor continues to run checks as normal
  2. If the monitor goes down, no alerts are sent
  3. Incidents are still created for tracking purposes
  4. The status page shows the monitor as "Under Maintenance"

Status Transitions

SCHEDULED → IN_PROGRESS → COMPLETED
         ↘             ↙
           CANCELLED
TransitionTrigger
SCHEDULED → IN_PROGRESSstart_time is reached
IN_PROGRESS → COMPLETEDend_time is reached
SCHEDULED → CANCELLEDUser cancels
IN_PROGRESS → CANCELLEDUser cancels during maintenance

Best Practices

  1. Schedule in advance - Create maintenance windows well before the planned work
  2. Be conservative with timing - Add buffer time before and after actual work
  3. Use descriptive titles - Include version numbers, ticket IDs, or brief descriptions
  4. Cancel if not needed - Don't leave unnecessary maintenance windows active

Example Workflows

Schedule Weekly Maintenance

// Schedule every Sunday at 3 AM UTC for 2 hours
const response = await fetch('/api/maintenance-windows', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + token,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    monitor_id: 'your-monitor-uuid',
    title: 'Weekly Maintenance - Week 3',
    start_time: '2024-01-21T03:00:00Z',
    end_time: '2024-01-21T05:00:00Z'
  })
});

Cancel Due to Postponement

// Cancel a maintenance window if work is postponed
const response = await fetch('/api/maintenance-windows/' + maintenanceId + '/cancel', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer ' + token
  }
});

Error Responses Summary

StatusErrorDescription
400Validation errorsInvalid request body
400End time must be after start timeInvalid time range
404Monitor not foundMonitor doesn't exist or not owned
404Maintenance window not foundWindow doesn't exist or not owned
404Maintenance window not found or already completedCan't cancel completed windows
500Failed to create/cancel/delete maintenance windowServer error