---
title: "Update an alert"
method: PATCH
path: "/analytics/v1/alerts/{id}"
tags: ["Alerts"]
---

# Update an alert

`PATCH /analytics/v1/alerts/{id}`

Updates the alert specified by the Id.

## Path parameters

- `id` string, required

## Request body

- AlertUpdateRequest — Request body for modifying an existing alert.
  - `name` string — Alert name
  - `config` AlertConfig, required — Parameters that define when and how an alert is evaluated.
    - `dataSource` 'billing' | 'billing-datahub' — Data source used to query data for the alert. Affects which dimensions and metrics are available.
    - `scopes` ExternalConfigFilter[] — The filters that define the scope of the alert. Each item is a Cloud Analytics filter (same idea as report filters). Note: Only the first scope in the array is currently applied; any additional scopes are validated but ignored. If additional scopes are malformed the call will fail silently. Use a single, well-chosen filter, or dataSource plus evaluateForEach to slice spend instead.
      - `id` string, required — Dimension key to filter on. Must pair with `type` and match a dimension returned by `GET /analytics/v1/dimensions` (for example, `service_description` with `type: fixed`). For `allocation_rule`, use `allocation_rule`. For `allocation`, use the allocation group ID. See `DimensionsTypes` for how each `type` uses `id`.
      - `type` 'datetime' | 'fixed' | 'optional' | 'label' | 'tag' | 'project_label' | 'system_label' | 'attribution' | 'attribution_group' | 'allocation' | 'allocation_rule' | 'gke' | 'gke_label', required — Dimension filter type. Always pair `type` with `id` on scope filters. Discover valid `id` + `type` pairs for your account with `GET /analytics/v1/dimensions`. `allocation_rule` replaces `attribution`; `allocation` replaces `attribution_group`.
      - `values` string[] — List of values to include or exclude. Must match exact strings from your billing or DataHub data for the dimension (for example, `Amazon Simple Storage Service` for AWS S3 on `service_description`). For `allocation_rule`, use allocation rule IDs.
      - `mode` 'is' | 'starts_with' | 'ends_with' | 'contains' | 'regexp' — Controls how the dimension’s `values` are matched when the alert query runs. If mode is omitted, behavior defaults to is.
      - `inverse` boolean — Set to `true` to exclude the set values. If inverse is omitted, behavior defaults to `false`.
      - `caseInsensitive` boolean — If true, string matching is case-insensitive. Effective only for starts_with, ends_with, and contains modes; ignored otherwise.
      - `includeNull` boolean — Include rows where the dimension is null. If includeNull is omitted, behavior defaults to `false`.
    - `metric` MetricConfig, required — Define how metrics are selected and filtered in reports.
      - `type` string, required — Identifier for metric type (e.g., basic, custom, extended).
      - `value` string, required
    - `currency` 'USD' | 'ILS' | 'EUR' | 'AUD' | 'CAD' | 'GBP' | 'DKK' | 'NOK' | 'SEK' | 'BRL' | 'SGD' | 'MXN' | 'CHF' | 'MYR' | 'TWD' | 'EGP' | 'ZAR' | 'JPY' | 'IDR' | 'AED' | 'THB' | 'COP' — Currency code for monetary values.
    - `timeInterval` 'day' | 'week' | 'month' | 'quarter' | 'year', required — The period each evaluation looks at.
    - `condition` 'value' | 'percentage-change' | 'forecast' — Type of comparison for the alert threshold (used with `operator` and `value`). If omitted on create, defaults to `percentage-change`.
    - `operator` 'gt' | 'lt' — Text/operator used to filter metric values in metric filters (gt = greater than, lt = less than).
    - `value` number, double, required — The `condition` threshold value. For example, actual metric threshold value for the `value` condition, or percentage change threshold value for the `percentage-change` condition.
    - `evaluateForEach` string — Add a dimension to break down the evaluation of the condition. For example, evaluate a condition over an attribution for each "Service". Must be a dimension key returned by GET /analytics/v1/dimensions. Not allowed with condition: `forecast`. Used when you Investigate an alert, the dimension becomes the report grouping.
    - `attributions` string[] — Use 'scopes' instead. The attributions selected define the scope to monitor.
  - `recipients` string[] — List of emails to notify when the alert is triggered.

## Response `200`

OK - Alert updated.

- Alert — Configuration and runtime metadata of an alert.
  - `id` string — Alert ID.
  - `name` string, required — Alert Name.
  - `createTime` integer — The time when the alert was created (in UNIX timestamp).
  - `updateTime` integer — Last time the alert was modified (in UNIX timestamp).
  - `lastAlerted` integer — Last time the alert was triggered (in UNIX timestamp).
  - `recipients` string[] — List of emails that will be notified when the alert is triggered.
  - `config` AlertConfig — Parameters that define when and how an alert is evaluated.
    - `dataSource` 'billing' | 'billing-datahub' — Data source used to query data for the alert. Affects which dimensions and metrics are available.
    - `scopes` ExternalConfigFilter[] — The filters that define the scope of the alert. Each item is a Cloud Analytics filter (same idea as report filters). Note: Only the first scope in the array is currently applied; any additional scopes are validated but ignored. If additional scopes are malformed the call will fail silently. Use a single, well-chosen filter, or dataSource plus evaluateForEach to slice spend instead.
      - `id` string, required — Dimension key to filter on. Must pair with `type` and match a dimension returned by `GET /analytics/v1/dimensions` (for example, `service_description` with `type: fixed`). For `allocation_rule`, use `allocation_rule`. For `allocation`, use the allocation group ID. See `DimensionsTypes` for how each `type` uses `id`.
      - `type` 'datetime' | 'fixed' | 'optional' | 'label' | 'tag' | 'project_label' | 'system_label' | 'attribution' | 'attribution_group' | 'allocation' | 'allocation_rule' | 'gke' | 'gke_label', required — Dimension filter type. Always pair `type` with `id` on scope filters. Discover valid `id` + `type` pairs for your account with `GET /analytics/v1/dimensions`. `allocation_rule` replaces `attribution`; `allocation` replaces `attribution_group`.
      - `values` string[] — List of values to include or exclude. Must match exact strings from your billing or DataHub data for the dimension (for example, `Amazon Simple Storage Service` for AWS S3 on `service_description`). For `allocation_rule`, use allocation rule IDs.
      - `mode` 'is' | 'starts_with' | 'ends_with' | 'contains' | 'regexp' — Controls how the dimension’s `values` are matched when the alert query runs. If mode is omitted, behavior defaults to is.
      - `inverse` boolean — Set to `true` to exclude the set values. If inverse is omitted, behavior defaults to `false`.
      - `caseInsensitive` boolean — If true, string matching is case-insensitive. Effective only for starts_with, ends_with, and contains modes; ignored otherwise.
      - `includeNull` boolean — Include rows where the dimension is null. If includeNull is omitted, behavior defaults to `false`.
    - `metric` MetricConfig, required — Define how metrics are selected and filtered in reports.
      - `type` string, required — Identifier for metric type (e.g., basic, custom, extended).
      - `value` string, required
    - `currency` 'USD' | 'ILS' | 'EUR' | 'AUD' | 'CAD' | 'GBP' | 'DKK' | 'NOK' | 'SEK' | 'BRL' | 'SGD' | 'MXN' | 'CHF' | 'MYR' | 'TWD' | 'EGP' | 'ZAR' | 'JPY' | 'IDR' | 'AED' | 'THB' | 'COP' — Currency code for monetary values.
    - `timeInterval` 'day' | 'week' | 'month' | 'quarter' | 'year', required — The period each evaluation looks at.
    - `condition` 'value' | 'percentage-change' | 'forecast' — Type of comparison for the alert threshold (used with `operator` and `value`). If omitted on create, defaults to `percentage-change`.
    - `operator` 'gt' | 'lt' — Text/operator used to filter metric values in metric filters (gt = greater than, lt = less than).
    - `value` number, double, required — The `condition` threshold value. For example, actual metric threshold value for the `value` condition, or percentage change threshold value for the `percentage-change` condition.
    - `evaluateForEach` string — Add a dimension to break down the evaluation of the condition. For example, evaluate a condition over an attribution for each "Service". Must be a dimension key returned by GET /analytics/v1/dimensions. Not allowed with condition: `forecast`. Used when you Investigate an alert, the dimension becomes the report grouping.
    - `attributions` string[] — Use 'scopes' instead. The attributions selected define the scope to monitor.

## Other responses

- `400` — Bad Request - The server cannot process the request, often due to a malformed request.
- `401` — Unauthorized - Invalid API key.
- `403` — Forbidden - The client is not authorized to perform the request.
- `404` — Not Found - The requested resource does not exist.

---

[API](https://skmtc.dev/doit/apis/doit-cloud-intelligence.md) · [All operations](https://skmtc.dev/doit/apis/doit-cloud-intelligence/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/doit/doit-cloud-intelligence/revisions/9416402fc119/schema)
