# <a id="bitdrift.public.unary.alerts.v1.AlertsService"></a>AlertsService

**Source definition:** [`src/bitdrift/public/unary/alerts/v1/alerts.proto#L492-L505`](<https://github.com/bitdriftlabs/api/blob/main/src/bitdrift/public/unary/alerts/v1/alerts.proto#L492-L505>)

Provides workflow alert configuration, listing, and history operations.

### <a id="GetAlertConfig"></a>GetAlertConfig

Gets alert configuration for a workflow chart.

<section class="proto-service-table" markdown>

| Request | Response |
| - | - |
| <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">alerts</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">GetAlertConfigRequest</i>](bitdrift_public_unary_alerts_v1_GetAlertConfigRequest.md "bitdrift.public.unary.alerts.v1.GetAlertConfigRequest")</span> | <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">alerts</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">GetAlertConfigResponse</i>](bitdrift_public_unary_alerts_v1_GetAlertConfigResponse.md "bitdrift.public.unary.alerts.v1.GetAlertConfigResponse")</span> |

</section>

<p class="h4">Example Request</p>
**URL:** `https://api-public.bitdrift.io/bitdrift.public.unary.alerts.v1.AlertsService/GetAlertConfig`

See [calling the API](../api-guide/calling-the-api.md) for authentication and request details.

```json
{
  "chart_rule_id": "_i1yUnHjKfmWpCaD5Tazo",
  "workflow_id": "checkout-errors"
}
```

<p class="h4">Example Response</p>
```json
{
  "alert_configs": [
    {
      "aggregated_action_id": "count/fkQ1PfAZhdYvJexzY6DYuoYCZTEaWO0Y7spxwjr7akc",
      "config": {
        "basic_alert": {
          "condition": "ABOVE",
          "consecutive_data_points": 3,
          "histogram_configuration": {
            "percentile": 1.0,
            "percentiles": [
              1.0
            ]
          },
          "limit_strategy": {
            "exclusions": {
              "dimension_identifiers": [
                {
                  "id": "time_series_id_opaque_example",
                  "labels": [
                    {
                      "name": "name",
                      "value": "value"
                    }
                  ]
                }
              ],
              "return_other": false
            },
            "sort_order": "MAX",
            "top_k_limit": {
              "top_k": 5
            }
          },
          "threshold": 0.75,
          "unique_device_threshold": 50,
          "window": "3600s"
        },
        "common_config": {
          "custom_notification_text": "@checkout-oncall Please investigate.",
          "description": "Triggers when the checkout workflow error rate exceeds the configured threshold.",
          "labels": {
            "key": ""
          },
          "name": "Checkout error rate",
          "notifications": [
            {
              "min_time_between_notifications": "3600s",
              "notification_config": {
                "disabled": false,
                "notification_group": {
                  "name": "engineering-oncall"
                }
              }
            }
          ]
        }
      },
      "disabled": false,
      "id": 123,
      "owner": {
        "email": "user@example.com",
        "id": "usr_abc123",
        "name": "Jane Doe"
      }
    }
  ]
}
```

### <a id="GetAlertHistory"></a>GetAlertHistory

Gets history for a single workflow alert.

<section class="proto-service-table" markdown>

| Request | Response |
| - | - |
| <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">alerts</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">GetAlertHistoryRequest</i>](bitdrift_public_unary_alerts_v1_GetAlertHistoryRequest.md "bitdrift.public.unary.alerts.v1.GetAlertHistoryRequest")</span> | <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">alerts</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">GetAlertHistoryResponse</i>](bitdrift_public_unary_alerts_v1_GetAlertHistoryResponse.md "bitdrift.public.unary.alerts.v1.GetAlertHistoryResponse")</span> |

</section>

<p class="h4">Example Request</p>
**URL:** `https://api-public.bitdrift.io/bitdrift.public.unary.alerts.v1.AlertsService/GetAlertHistory`

See [calling the API](../api-guide/calling-the-api.md) for authentication and request details.

```json
{
  "alert_id": 123,
  "end_time": "2024-01-15T09:30:00Z",
  "limit": 25,
  "offset": 0,
  "start_time": "2024-01-15T09:30:00Z"
}
```

<p class="h4">Example Response</p>
```json
{
  "history": [
    {
      "details": {
        "alert_config": {
          "basic_alert": {
            "condition": "ABOVE",
            "consecutive_data_points": 3,
            "histogram_configuration": {
              "percentile": 1.0,
              "percentiles": [
                1.0
              ]
            },
            "limit_strategy": {
              "exclusions": {
                "dimension_identifiers": [
                  {
                    "id": "time_series_id_opaque_example",
                    "labels": [
                      {
                        "name": "name",
                        "value": "value"
                      }
                    ]
                  }
                ],
                "return_other": false
              },
              "sort_order": "MAX",
              "top_k_limit": {
                "top_k": 5
              }
            },
            "threshold": 0.75,
            "unique_device_threshold": 50,
            "window": "3600s"
          },
          "common_config": {
            "custom_notification_text": "@checkout-oncall Please investigate.",
            "description": "Triggers when the checkout workflow error rate exceeds the configured threshold.",
            "labels": {
              "key": ""
            },
            "name": "Checkout error rate",
            "notifications": [
              {
                "min_time_between_notifications": "3600s",
                "notification_config": {
                  "disabled": false,
                  "notification_group": {
                    "name": "engineering-oncall"
                  }
                }
              }
            ]
          }
        },
        "contributing_data": [
          {
            "basic": {
              "data_points": [
                {
                  "rate_details": {
                    "denominator_count": 42,
                    "numerator_count": 42
                  },
                  "timestamp": "2024-01-15T09:30:00Z",
                  "unique_devices": 1,
                  "value": 1.0
                }
              ]
            }
          }
        ],
        "group_by_dimensions": [
          "region:us-east-1"
        ],
        "notification_failures": [
          "PagerDuty returned an authentication error"
        ]
      },
      "resolved_at": "2024-01-15T09:30:00Z",
      "triggered_at": "2024-01-15T09:30:00Z"
    }
  ],
  "total_alert_history": 8
}
```

### <a id="GetAllAlerts"></a>GetAllAlerts

Lists workflow alerts for the organization.

<section class="proto-service-table" markdown>

| Request | Response |
| - | - |
| <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">alerts</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">GetAllAlertsRequest</i>](bitdrift_public_unary_alerts_v1_GetAllAlertsRequest.md "bitdrift.public.unary.alerts.v1.GetAllAlertsRequest")</span> | <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">alerts</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">GetAllAlertsResponse</i>](bitdrift_public_unary_alerts_v1_GetAllAlertsResponse.md "bitdrift.public.unary.alerts.v1.GetAllAlertsResponse")</span> |

</section>

<p class="h4">Example Request</p>
**URL:** `https://api-public.bitdrift.io/bitdrift.public.unary.alerts.v1.AlertsService/GetAllAlerts`

See [calling the API](../api-guide/calling-the-api.md) for authentication and request details.

```json
{
  "filters": [
    {
      "owned": {}
    }
  ],
  "limit": 25,
  "offset": 0,
  "sort": [
    {
      "direction": "DESCENDING",
      "key": "ALERT_NAME"
    }
  ],
  "sort_by": [
    {}
  ]
}
```

<p class="h4">Example Response</p>
```json
{
  "items": [
    {
      "aggregated_action_id": "count/fkQ1PfAZhdYvJexzY6DYuoYCZTEaWO0Y7spxwjr7akc",
      "alert_id": 123,
      "alert_name": "Checkout error rate",
      "alert_type": "BASIC",
      "chart_rule_id": "_i1yUnHjKfmWpCaD5Tazo",
      "disabled": false,
      "last_resolved_at": "2024-01-15T09:30:00Z",
      "last_triggered_at": "2024-01-15T09:30:00Z",
      "owner": {
        "email": "user@example.com",
        "id": "usr_abc123",
        "name": "Jane Doe"
      },
      "workflow_id": "checkout-errors"
    }
  ],
  "total_alerts": 8
}
```

### <a id="UpsertAlertConfig"></a>UpsertAlertConfig

Upserts alert configuration for a workflow chart.

<section class="proto-service-table" markdown>

| Request | Response |
| - | - |
| <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">alerts</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">UpsertAlertConfigRequest</i>](bitdrift_public_unary_alerts_v1_UpsertAlertConfigRequest.md "bitdrift.public.unary.alerts.v1.UpsertAlertConfigRequest")</span> | <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">alerts</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">UpsertAlertConfigResponse</i>](bitdrift_public_unary_alerts_v1_UpsertAlertConfigResponse.md "bitdrift.public.unary.alerts.v1.UpsertAlertConfigResponse")</span> |

</section>

<p class="h4">Example Request</p>
**URL:** `https://api-public.bitdrift.io/bitdrift.public.unary.alerts.v1.AlertsService/UpsertAlertConfig`

See [calling the API](../api-guide/calling-the-api.md) for authentication and request details.

```json
{
  "aggregated_action_id": "count/fkQ1PfAZhdYvJexzY6DYuoYCZTEaWO0Y7spxwjr7akc",
  "alert_config": {
    "basic_alert": {
      "condition": "ABOVE",
      "consecutive_data_points": 3,
      "histogram_configuration": {
        "percentile": 1.0,
        "percentiles": [
          1.0
        ]
      },
      "limit_strategy": {
        "exclusions": {
          "dimension_identifiers": [
            {
              "id": "time_series_id_opaque_example",
              "labels": [
                {
                  "name": "name",
                  "value": "value"
                }
              ]
            }
          ],
          "return_other": false
        },
        "sort_order": "MAX",
        "top_k_limit": {
          "top_k": 5
        }
      },
      "threshold": 0.75,
      "unique_device_threshold": 50,
      "window": "3600s"
    },
    "common_config": {
      "custom_notification_text": "@checkout-oncall Please investigate.",
      "description": "Triggers when the checkout workflow error rate exceeds the configured threshold.",
      "labels": {
        "key": ""
      },
      "name": "Checkout error rate",
      "notifications": [
        {
          "min_time_between_notifications": "3600s",
          "notification_config": {
            "disabled": false,
            "notification_group": {
              "name": "engineering-oncall"
            }
          }
        }
      ]
    }
  },
  "chart_rule_id": "_i1yUnHjKfmWpCaD5Tazo",
  "disabled": false,
  "id": 123,
  "workflow_id": "checkout-errors"
}
```

<p class="h4">Example Response</p>
```json
{
  "id": 123
}
```

