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

# Update an Alert Grouping Setting

`PUT https://api.pagerduty.com/alert_grouping_settings/{id}`

Update an Alert Grouping Setting.

The settings part of Alert Grouper service allows us to create Alert Grouping Settings and configs that are required to be used during grouping of the alerts.

if `services` are not provided in the request, then the existing services will not be removed from the setting.

Scoped OAuth requires: `services.write`

## Authorization

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

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | The ID of the resource. |

## 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`. |

## Request body (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `alert_grouping_setting` | object | yes | Defines how alerts will be automatically grouped into incidents based on the configurations defined. Note that the Alert Grouping Setting features are available only on certain plans. |
| `alert_grouping_setting.id` | string |  | Read-only. |
| `alert_grouping_setting.name` | string \| null |  | An optional short-form string that provides succinct information about an AlertGroupingSetting object suitable for primary labeling of the entity. It is not intended to be an identifier. |
| `alert_grouping_setting.description` | string \| null |  | An optional description in string that provides more information about an AlertGroupingSetting object. |
| `alert_grouping_setting.type` | string |  | One of: `content_based`, `content_based_intelligent`, `intelligent`, `time`. |
| `alert_grouping_setting.config` | one of: object \| object \| object \| object |  |  |
| `alert_grouping_setting.config.aggregate` | string |  | (Content Only Grouping) Whether Alerts should be grouped if `all` or `any` specified fields match. If `all` is selected, an exact match on every specified field name must occur for Alerts to be grouped. If `any` is selected, Alerts will be grouped when there is an exact match on at least one of the specified fields. One of: `all, any`. |
| `alert_grouping_setting.config.fields` | array of string |  | (Content Only Grouping) An array of strings which represent the fields with which to group against. Depending on the aggregate, Alerts will group if some or all the fields match. |
| `alert_grouping_setting.config.time_window` | integer |  | (Content Only Grouping) The maximum amount of time allowed between Alerts. Any Alerts arriving greater than `time_window` seconds apart will not be grouped together. This is a rolling time window up to 24 hours and is counted from the most recently grouped alert. The window is extended every time a new alert is added to the group, up to 24 hours (24 hours only applies to single-service settings). To use the "recommended_time_window," set the value to 0, otherwise the value must be between 300 <= time_window <= 3600 or 86400(i.e. 24 hours). Minimum: 300. Maximum: 86400. |
| `alert_grouping_setting.config.recommended_time_window` | integer |  | (Content Only Grouping) In order to ensure your Service has the optimal grouping window, we use data science to calculate your Service's average Alert inter-arrival time. We encourage customers to use this value. Please set `time_window` to 0 to use the `recommended_time_window`. Read-only. |
| `alert_grouping_setting.config.aggregate` | string |  | (Content and Intelligent Grouping) Whether Alerts should be grouped if `all` or `any` specified fields match. If `all` is selected, an exact match on every specified field name must occur for Alerts to be grouped. If `any` is selected, Alerts will be grouped when there is an exact match on at least one of the specified fields. One of: `all, any`. |
| `alert_grouping_setting.config.fields` | array of string |  | (Content and Intelligent Grouping) An array of strings which represent the fields with which to group against. Depending on the aggregate, Alerts will group if some or all the fields match. |
| `alert_grouping_setting.config.time_window` | integer |  | (Content and Intelligent Grouping) The maximum amount of time allowed between Alerts. Any Alerts arriving greater than `time_window` seconds apart will not be grouped together. This is a rolling time window up to 24 hours and is counted from the most recently grouped alert. The window is extended every time a new alert is added to the group, up to 24 hours (24 hours only applies to single-service settings). To use the "recommended_time_window," set the value to 0, otherwise the value must be between 300 <= time_window <= 3600. Minimum: 300. Maximum: 3600. |
| `alert_grouping_setting.config.recommended_time_window` | integer |  | (Content and Intelligent Grouping) In order to ensure your Service has the optimal grouping window, we use data science to calculate your Service's average Alert inter-arrival time. We encourage customers to use this value. Please set `time_window` to 0 to use the `recommended_time_window`. Read-only. |
| `alert_grouping_setting.config.timeout` | integer |  | (Time Grouping) The duration in seconds within which to automatically group incoming Alerts. To continue grouping Alerts until the Incident is resolved, set this value to 0. Minimum: 60. Maximum: 86400. |
| `alert_grouping_setting.config.time_window` | integer |  | (Intelligent Grouping) The maximum amount of time allowed between Alerts. Any Alerts arriving greater than `time_window` seconds apart will not be grouped together. This is a rolling time window up to 24 hours and is counted from the most recently grouped alert. The window is extended every time a new alert is added to the group, up to 24 hours (24 hours only applies to single-service settings). To use the "recommended_time_window," set the value to 0, otherwise the value must be between 300 <= time_window <= 3600. Minimum: 300. Maximum: 3600. |
| `alert_grouping_setting.config.recommended_time_window` | integer |  | (Intelligent Grouping) In order to ensure your Service has the optimal grouping window, we use data science to calculate your Service's average Alert inter-arrival time. We encourage customers to use this value. Please set `time_window` to 0 to use the `recommended_time_window`. Read-only. |
| `alert_grouping_setting.config.iag_fields` | array of string |  | (Intelligent Grouping) An array of strings which represent the iag fields with which to intelligently group against. Default: `["summary"]`. |
| `alert_grouping_setting.services` | array of object |  | The array of one or many Services with just ServiceID/name that the AlertGroupingSetting applies to. Type of content_based_intelligent allows for only one service in the array. |
| `alert_grouping_setting.services[].id` | string | yes | Read-only. |
| `alert_grouping_setting.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. |
| `alert_grouping_setting.services[].type` | string | yes | One of: `service_reference`. |
| `alert_grouping_setting.services[].self` | string \| null (url) |  | the API show URL at which the object is accessible. Read-only. |
| `alert_grouping_setting.services[].html_url` | string \| null (url) |  | a URL at which the entity is uniquely displayed in the Web app. Read-only. |
| `alert_grouping_setting.created_at` | string (date-time) |  | The ISO8601 date/time an AlertGroupingSetting got created at. Read-only. |
| `alert_grouping_setting.updated_at` | string (date-time) |  | The ISO8601 date/time an AlertGroupingSetting last got updated at. Read-only. |

Example: Request Example

```json
{
  "alert_grouping_setting": {
    "id": "PZC4OM1",
    "name": "Example of Alert Grouping Setting",
    "description": "This Alert Grouping Setting is an example",
    "type": "content_based",
    "config": {
      "time_window": 900,
      "aggregate": "all",
      "fields": [
        "summary",
        "component",
        "custom_details.host",
        "custom_details.field1.field2"
      ]
    },
    "services": [
      {
        "id": "P0KJZ0A"
      },
      {
        "id": "PA15YRT"
      }
    ]
  }
}
```

## Response 200

The updated Alert Grouping Setting.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `alert_grouping_setting` | object | yes | Defines how alerts will be automatically grouped into incidents based on the configurations defined. Note that the Alert Grouping Setting features are available only on certain plans. Same fields as `alert_grouping_setting` above. |

Example: Response Example

```json
{
  "alert_grouping_setting": {
    "id": "PZC4OM1",
    "name": "Example of Alert Grouping Setting",
    "description": "This Alert Grouping Setting is an example",
    "type": "content_based",
    "config": {
      "time_window": 900,
      "aggregate": "all",
      "fields": [
        "summary",
        "component",
        "custom_details.host",
        "custom_details.field1.field2"
      ]
    },
    "services": [
      {
        "id": "P0KJZ0A",
        "name": "Payment Service"
      },
      {
        "id": "PA15YRT",
        "name": "Checkout Service"
      }
    ],
    "created_at": "2022-12-13T19:55:01.171Z",
    "updated_at": "2023-08-24T18:29:35.630Z"
  }
}
```

## 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 404

The requested resource was not found.

### `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).
