# List alerts

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


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

Returns a list of alert configurations meeting **all** the conditions specified in the filter parameters below. Results include both global and subscription-scoped alerts.

**Note:** To retrieve only the alerts that are in effect for a specific subscription (after resolving global rules and overrides), use [List applicable alerts](/docs/api/alerts/list-applicable-alerts-for-a-subscription) instead.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/alerts \
     -G  \
     -u {site_api_key}:\
     --data-urlencode "status[is]"="ENABLED" \
     --data-urlencode limit=10
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
ListResult result = Alert.List()
		.Limit(10)
		.Status().Is(Alert.StatusEnum.Enabled)
		.Request();

foreach (var listItem in result.List){
  Alert alert = listItem.Alert;
}
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    "github.com/chargebee/chargebee-go/v3/filter"
    alertAction "github.com/chargebee/chargebee-go/v3/actions/alert"
    "github.com/chargebee/chargebee-go/v3/models/alert"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := alertAction.List(&alert.ListRequestParams{
        Limit : chargebee.Int32(10),
        Status : &filter.EnumFilter{
            Is : "enabled",
        },
    }).ListRequest()
    if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            Alert := res.List[idx].Alert
        }
    }
}
```

#### 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.AlertListRequest{
    Limit : chargebee.Int32(10),
    Status : &chargebee.EnumFilter{
        Is : "enabled",
    },
}
  res, err := client.Alert.List(req)
      if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            Alert := res.List[idx].Alert
        }
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
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 = Alert.list()
            .limit(10)
            .status().is(Alert.Status.ENABLED)
            .request();

        for (ListResult.Entry entry : result) {
            Alert alert = entry.alert();
        }
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.alert.Alert;
import com.chargebee.v4.models.alert.params.AlertListParams;
import com.chargebee.v4.models.alert.responses.AlertListResponse;
import java.util.List;

public class AlertList {

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

        AlertListParams params = AlertListParams.builder()
            .limit(10)
            .status()
            .is(AlertListParams.Status.ENABLED)
            .build();

        AlertListResponse response = client.alerts().list(params);
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.alert.list({
        status: {
            is: "enabled"
        },
        limit: 10
    });
    result.list.forEach((entry) => {
        console.log(entry);
        const alert = entry.alert;
    });
} 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->alert()->all([
    "status" => [
        "is" => "enabled"
    ],
    "limit" => 10
]);
foreach($result->list as $entry) {
    $alert = $entry->alert;
}
```

#### Python

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

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
entries = cb_client.Alert.list(
    cb_client.Alert.ListParams(
        limit=10,
        status=Filters.EnumFilter(IS=chargebee.Alert.Status.ENABLED)
    )
)
for entry in entries.list:
    alert = entry.alert
```

#### Ruby

```ruby
require 'chargebee'

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

list = ChargeBee::Alert.list({
  :limit => 10,
  "status[is]" => "enabled"
})

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

## Sample Response

```json
{
  "list": [
    {
      "alert": {
        "id": "alert___dev__3Nl7purV3LwbKYH",
        "name": "GPT-4o usage threshold",
        "description": "Notify when usage crosses 90% of quota",
        "type": "usage_exceeded",
        "metered_feature_id": "gpt4o-usage",
        "threshold": {
          "mode": "percentage",
          "value": 90
        },
        "filter_conditions": [
          {
            "field": "plan_price_id",
            "operator": "equals",
            "value": "enterprise"
          },
          {..}
        ],
        "subscription_id": null,
        "status": "enabled",
        "object": "alert",
        "resource_version": 1763879971000,
        "created_at": 1763879971,
        "updated_at": 1763879971
      }
    },
    {..}
  ]
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/alerts

## Input Parameters

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

- `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.
  
  **Example →** _offset = "MjAyNC0xMi0yMFQxMjozMjo1MSswMDowMHw5OTk5OTk5OTk="_

## 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` (Alert object)
  Resource object representing alert
