# List alert statuses for an alert

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


[Eventually Consistent](/docs/api/read-consistency)

Returns the runtime state of a specific [alert](/docs/api/alerts) across all impacted subscriptions. Each entry indicates whether a subscription is `within_limit` or `in_alarm` for the given alert.

Use this endpoint to monitor which subscriptions are currently breaching a threshold, for example when building internal dashboards or CSM workflows.

### Prerequisites & Constraints

-   The `alert_id` must reference a global alert. Subscription-scoped alerts return a 400 error since they apply to only one subscription — use [List alert statuses for a subscription](/docs/api/alert_statuses/list-alert-statuses-for-a-subscription) instead.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/alerts/alert___dev__3Nl7purV3LwbKYH/alert_statuses \
     -G  \
     -u {site_api_key}:\
     --data-urlencode limit=25 \
     --data-urlencode "alarm_status[is]"="IN_ALARM"
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;
using ChargeBee.Models.Enums;

ApiConfig.Configure("{site}","{site_api_key}");
ListResult result = AlertStatus.AlertStatusesForAlert("alert___dev__3Nl7purV3LwbKYH")
		.Limit(25)
		.AlarmStatus().Is(AlarmStatusEnum.InAlarm)
		.Request();

foreach (var listItem in result.List){
  AlertStatus alertStatus = listItem.AlertStatus;
}
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    "github.com/chargebee/chargebee-go/v3/filter"
    alertstatusAction "github.com/chargebee/chargebee-go/v3/actions/alertstatus"
    "github.com/chargebee/chargebee-go/v3/models/alertstatus"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := alertstatusAction.AlertStatusesForAlert("alert___dev__3Nl7purV3LwbKYH", &alertstatus.AlertStatusesForAlertRequestParams{
        Limit : chargebee.Int32(25),
        AlarmStatus : &filter.EnumFilter{
            Is : "in_alarm",
        },
    }).ListRequest()
    if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            AlertStatus := res.List[idx].AlertStatus
        }
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.AlertStatusAlertStatusesForAlertRequest{
    Limit : chargebee.Int32(25),
    AlarmStatus : &chargebee.EnumFilter{
        Is : "in_alarm",
    },
}
  res, err := client.AlertStatus.AlertStatusesForAlert("alert___dev__3Nl7purV3LwbKYH", req)
      if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            AlertStatus := res.List[idx].AlertStatus
        }
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import com.chargebee.models.AlertStatus;
import java.io.IOException;
import java.util.List;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        ListResult result = AlertStatus.alertStatusesForAlert("alert___dev__3Nl7purV3LwbKYH")
            .limit(25)
            .alarmStatus().is(AlarmStatus.IN_ALARM)
            .request();

        for (ListResult.Entry entry : result) {
            AlertStatus alertStatus = entry.alertStatus();
        }
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.alertStatus.AlertStatus;
import com.chargebee.v4.models.alertStatus.params.AlertStatusesForAlertParams;
import com.chargebee.v4.models.alertStatus.responses.AlertStatusesForAlertResponse;
import java.util.List;

public class AlertStatusesForAlert {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        AlertStatusesForAlertParams params = AlertStatusesForAlertParams.builder()
            .limit(25)
            .alarmStatus()
            .is(AlertStatusesForAlertParams.AlarmStatus.IN_ALARM)
            .build();

        AlertStatusesForAlertResponse response = client
            .alertStatuses()
            .alertStatusesForAlert("alert___dev__3Nl7purV3LwbKYH", params);
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.alertStatus.alert_statusesForAlert("alert___dev__3Nl7purV3LwbKYH", {
        limit: 25,
        alarm_status: {
            is: "in_alarm"
        }
    });
    result.list.forEach((entry) => {
        console.log(entry);
        const alertStatus = entry.alert_status;
    });
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->alertStatus()->alertStatusesForAlert("alert___dev__3Nl7purV3LwbKYH", [
    "limit" => 25,
    "alarm_status" => [
        "is" => "in_alarm"
    ]
]);
foreach($result->list as $entry) {
    $alertStatus = $entry->alert_status;
}
```

#### Python

```python
import chargebee
from chargebee import Chargebee, Filters

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
entries = cb_client.AlertStatus.alert_statuses_for_alert("alert___dev__3Nl7purV3LwbKYH",
    cb_client.AlertStatus.AlertStatusesForAlertParams(
        limit=25,
        alarm_status=Filters.EnumFilter(IS=chargebee.AlarmStatus.IN_ALARM)
    )
)
for entry in entries.list:
    alert_status = entry.alert_status
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

list = ChargeBee::AlertStatus.alert_statuses_for_alert("alert___dev__3Nl7purV3LwbKYH",{
  :limit => 25,
  "alarm_status[is]" => "in_alarm"
})

list.each do |entry|
  alert_status = entry.alert_status
end
```

## Sample Response

```json
{
  "list": [
    {
      "alert_status": {
        "alert_id": "alert___dev__3Nl7purV3LwbKYH",
        "subscription_id": "sub_KyV2S7Qm8tL7p",
        "alarm_status": "in_alarm",
        "alarm_triggered_at": 1763885000,
        "object": "alert_status",
        "resource_version": 1763885000000
      }
    },
    {..}
  ]
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/alerts/{alert-id}/alert_statuses

## Input Parameters

- `limit` (optional, integer, default=10, min=1, max=100)
  optional, integer
  
  Maximum number of results to return.
  
  **Example →** _limit = 25_

- `offset` (optional, string, max chars=1000)
  optional, string
  
  Pagination cursor returned by a previous list call. Use the `next_offset` value from the previous response.

## Returns

- `next_offset` (optional, string, max chars=1000)
  Returned only if more results are available. Pass this value as `offset` in the next request to fetch the next page.

- `alert_status` (Alert status object)
  Resource object representing alert\_status
