---
title: "Create a maintenance window"
method: POST
path: "/api/v2/maintenance_windows"
tags: ["Case Management"]
---

# Create a maintenance window

`POST /api/v2/maintenance_windows`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/maintenance_windows`
- Auth: one of:
  - API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`
  - OAuth 2
    - Authorization code: `/oauth2/v1/authorize`
    - Token URL: `/oauth2/v1/token` scopes: `event_correlation_config_write`

Creates a maintenance window for event management cases with a name, case filter query, and time range (start and end).

## Request body

- MaintenanceWindowCreateRequest: Request payload for creating a maintenance window.
  - `data` MaintenanceWindowCreate, required: Data object for creating a maintenance window.
    - `attributes` MaintenanceWindowCreateAttributes, required: Attributes required to create a maintenance window.
      - `end_at` string, date-time, required: The end time of the maintenance window.
      - `name` string, required: The name of the maintenance window.
      - `query` string, required: The query to filter event management cases for this maintenance window.
      - `start_at` string, date-time, required: The start time of the maintenance window.
    - `type` 'maintenance_window', required: JSON:API resource type for maintenance windows.

## Response `201`

Created

- MaintenanceWindowResponse: Response containing a single maintenance window.
  - `data` MaintenanceWindow, required: A maintenance window that defines a scheduled time period during which case-related notifications and automation rules are suppressed. Each maintenance window applies to cases matching a specified query.
    - `attributes` MaintenanceWindowAttributes, required: Attributes of a maintenance window, including its schedule and the query that determines which cases are affected.
      - `created_by` string: The UUID of the user who created this maintenance window. Read-only.
      - `end_at` string, date-time, required: The ISO 8601 timestamp when the maintenance window ends and normal notification behavior resumes.
      - `name` string, required: A human-readable name for the maintenance window (for example, `Database migration - Dec 15`).
      - `query` string, required: A case search query that determines which cases are affected during the maintenance window. Uses the same syntax as the Case Management search bar.
      - `start_at` string, date-time, required: The ISO 8601 timestamp when the maintenance window begins and notifications start being suppressed.
      - `updated_by` string: The UUID of the user who last modified this maintenance window. Read-only.
    - `id` string, required: The maintenance window's identifier.
    - `type` 'maintenance_window', required: JSON:API resource type for maintenance windows.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `429`: Too many requests

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/da68bf029e4c?raw)
