---
title: Create a maintenance window
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Case Management
---

# Create a maintenance window{% #create-a-maintenance-window %}
Copy pageCopied
{% tab title="v2" %}
**Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
| Datadog site      | API endpoint                                                  |
| ----------------- | ------------------------------------------------------------- |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/maintenance_windows |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/maintenance_windows |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/maintenance_windows      |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/maintenance_windows      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/maintenance_windows  |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/maintenance_windows     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/maintenance_windows |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/maintenance_windows |

### Overview

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

OAuth apps require the `event_correlation_config_write` authorization [scope](https://docs.datadoghq.com/api/latest/scopes.md#case-management) to access this endpoint.



### Request

#### Body Data (required)

Maintenance window payload.

{% tab title="Model" %}

| Parent field | Field                        | Type      | Description                                                                               |
| ------------ | ---------------------------- | --------- | ----------------------------------------------------------------------------------------- |
|              | data [*required*]       | object    | Data object for creating a maintenance window.                                            |
| data         | attributes [*required*] | object    | Attributes required to create a maintenance window.                                       |
| attributes   | end_at [*required*]     | date-time | The end time of the maintenance window.                                                   |
| attributes   | name [*required*]       | string    | The name of the maintenance window.                                                       |
| attributes   | query [*required*]      | string    | The query to filter event management cases for this maintenance window.                   |
| attributes   | start_at [*required*]   | date-time | The start time of the maintenance window.                                                 |
| data         | type [*required*]       | enum      | JSON:API resource type for maintenance windows. Allowed enum values: `maintenance_window` |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "end_at": "2026-06-01T06:00:00Z",
      "name": "Weekly maintenance",
      "query": "project:SEC",
      "start_at": "2026-06-01T00:00:00Z"
    },
    "type": "maintenance_window"
  }
}
```

{% /tab %}

### Response

{% tab title="201" %}
Created
{% tab title="Model" %}
Response containing a single maintenance window.

| Parent field | Field                        | Type      | Description                                                                                                                                                                                                 |
| ------------ | ---------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|              | data [*required*]       | object    | 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. |
| data         | attributes [*required*] | object    | Attributes of a maintenance window, including its schedule and the query that determines which cases are affected.                                                                                          |
| attributes   | created_by                   | string    | The UUID of the user who created this maintenance window. Read-only.                                                                                                                                        |
| attributes   | end_at [*required*]     | date-time | The ISO 8601 timestamp when the maintenance window ends and normal notification behavior resumes.                                                                                                           |
| attributes   | name [*required*]       | string    | A human-readable name for the maintenance window (for example, `Database migration - Dec 15`).                                                                                                              |
| attributes   | query [*required*]      | string    | A case search query that determines which cases are affected during the maintenance window. Uses the same syntax as the Case Management search bar.                                                         |
| attributes   | start_at [*required*]   | date-time | The ISO 8601 timestamp when the maintenance window begins and notifications start being suppressed.                                                                                                         |
| attributes   | updated_by                   | string    | The UUID of the user who last modified this maintenance window. Read-only.                                                                                                                                  |
| data         | id [*required*]         | string    | The maintenance window's identifier.                                                                                                                                                                        |
| data         | type [*required*]       | enum      | JSON:API resource type for maintenance windows. Allowed enum values: `maintenance_window`                                                                                                                   |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "created_by": "string",
      "end_at": "2026-06-01T06:00:00Z",
      "name": "Weekly maintenance",
      "query": "project:SEC",
      "start_at": "2026-06-01T00:00:00Z",
      "updated_by": "string"
    },
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "type": "maintenance_window"
  }
}
```

{% /tab %}

{% /tab %}

{% tab title="400" %}
Bad Request
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="401" %}
Unauthorized
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="403" %}
Forbidden
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="404" %}
Not Found
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="429" %}
Too many requests
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

### Code Example

##### 
                  \## default
# 
 \# Curl command curl -X POST "https://api.datadoghq.com/api/v2/maintenance_windows" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "end_at": "2026-06-01T06:00:00Z",
      "name": "Weekly maintenance",
      "query": "project:SEC",
      "start_at": "2026-06-01T00:00:00Z"
    },
    "type": "maintenance_window"
  }
}
EOF 
                
{% /tab %}
