> Documentation index for AI agents: https://docs.pagerduty.com/llms.txt

# Create a maintenance window

`POST https://api.pagerduty.com/maintenance_windows`

Create a new maintenance window for the specified services. No new incidents will be created for a service that is in maintenance.

A Maintenance Window is used to temporarily disable one or more Services for a set period of time.

For more information see the [API Concepts Document](https://docs.pagerduty.com/developer/api-concepts#maintenance-windows)

Scoped OAuth requires: `services.write`

## Authorization

- **api_key** (apiKey) — `Authorization` header. The API Key with format `Token token=<API_KEY>`

## Header parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Accept` | string | yes | The `Accept` header is used as a versioning header. Default: `application/vnd.pagerduty+json;version=2`. |
| `From` | string (email) | yes | The email address of a valid user associated with the account making the request. |

## Request body (`application/json`)

The maintenance window object.

| Field | Type | Required | Description |
|---|---|---|---|
| `maintenance_window` | object | yes |  |
| `maintenance_window.id` | string |  | Read-only. |
| `maintenance_window.summary` | string \| null |  | A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `maintenance_window.type` | string | yes | The type of object being created. One of: `maintenance_window`. Default: `maintenance_window`. |
| `maintenance_window.self` | string \| null (url) |  | the API show URL at which the object is accessible. Read-only. |
| `maintenance_window.html_url` | string \| null (url) |  | a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `maintenance_window.sequence_number` | integer |  | The order in which the maintenance window was created. Read-only. |
| `maintenance_window.start_time` | string (date-time) | yes | This maintenance window's start time. This is when the services will stop creating incidents. If this date is in the past, it will be updated to be the current time. |
| `maintenance_window.end_time` | string (date-time) | yes | This maintenance window's end time. This is when the services will start creating incidents again. This date must be in the future and after the `start_time`. |
| `maintenance_window.description` | string |  | A description for this maintenance window. |
| `maintenance_window.created_by` | object |  |  |
| `maintenance_window.created_by.id` | string | yes | Read-only. |
| `maintenance_window.created_by.summary` | string \| null |  | A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `maintenance_window.created_by.type` | string | yes | One of: `user_reference`. |
| `maintenance_window.created_by.self` | string \| null (url) |  | the API show URL at which the object is accessible. Read-only. |
| `maintenance_window.created_by.html_url` | string \| null (url) |  | a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `maintenance_window.services` | array of object | yes |  |
| `maintenance_window.services[].id` | string | yes | Read-only. |
| `maintenance_window.services[].summary` | string \| null |  | A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `maintenance_window.services[].type` | string | yes | One of: `service_reference`. |
| `maintenance_window.services[].self` | string \| null (url) |  | the API show URL at which the object is accessible. Read-only. |
| `maintenance_window.services[].html_url` | string \| null (url) |  | a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `maintenance_window.teams` | array of object |  | Read-only. |
| `maintenance_window.teams[].id` | string | yes | Read-only. |
| `maintenance_window.teams[].summary` | string \| null |  | A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to `name`, though it is not intended to be an identifier. Read-only. |
| `maintenance_window.teams[].type` | string | yes | One of: `team_reference`. |
| `maintenance_window.teams[].self` | string \| null (url) |  | the API show URL at which the object is accessible. Read-only. |
| `maintenance_window.teams[].html_url` | string \| null (url) |  | a URL at which the entity is uniquely displayed in the Web app. Read-only. |

Example: Request Example

```json
{
  "maintenance_window": {
    "type": "maintenance_window",
    "start_time": "2015-11-09T20:00:00-05:00",
    "end_time": "2015-11-09T22:00:00-05:00",
    "description": "Immanentizing the eschaton",
    "services": [
      {
        "id": "PIJ90N7",
        "type": "service_reference"
      }
    ]
  }
}
```

## Response 201

The maintenance window that was created.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `maintenance_window` | object | yes | Same fields as `maintenance_window` above. |

Example: Response Example

```json
{
  "maintenance_window": {
    "id": "PW98YIO",
    "type": "maintenance_window",
    "summary": "Immanentizing the eschaton",
    "self": "https://api.pagerduty.com/maintenance_windows/PW98YIO",
    "html_url": "https://subdomain.pagerduty.com/service-directory/maintenance-windows/PW98YIO",
    "sequence_number": 1,
    "start_time": "2015-11-09T20:00:00-05:00",
    "end_time": "2015-11-09T22:00:00-05:00",
    "description": "Immanentizing the eschaton",
    "services": [
      {
        "id": "PIJ90N7",
        "type": "service_reference",
        "summary": "My Mail Service",
        "self": "https://api.pagerduty.com/services/PIJ90N7",
        "html_url": "https://subdomain.pagerduty.com/service-directory/PIJ90N7"
      }
    ],
    "teams": [
      {
        "id": "PQ9K7I8",
        "type": "team_reference",
        "summary": "Engineering",
        "self": "https://api.pagerduty.com/teams/PQ9K7I8",
        "html_url": "https://subdomain.pagerduty.com/teams/PQ9K7I8"
      }
    ],
    "created_by": {
      "id": "PXPGF42",
      "type": "user_reference",
      "summary": "Earline Greenholt",
      "self": "https://api.pagerduty.com/users/PXPGF42",
      "html_url": "https://subdomain.pagerduty.com/users/PXPGF42"
    }
  }
}
```

## Response 400

Caller provided invalid arguments. Please review the response for error details. Retrying with the same arguments will *not* work.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 401

Caller did not supply credentials or did not provide the correct credentials.
If you are using an API key, it may be invalid or your Authorization header may be malformed.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 403

Caller is not authorized to view the requested resource.
While your authentication is valid, the authenticated user or token does not have permission to perform this action.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 429

Too many requests have been made, the rate limit has been reached.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Developer Agreement

Your access to and use of the PagerDuty Developer Services is governed by the [PagerDuty Developer Agreement](https://docs.pagerduty.com/developer/pagerduty-developer-agreement).
