---
title: Alert Types
slug: X4oToPpu9k_AF_InxYgfa
docTags: 
createdAt: 2024-07-18T13:58:24.988Z
---

The following alert (aka. notification) types can be created using the [Alerts UI Dashboard](https://ui.amberflo.io/alerts) or [Alerts API](docId\:TXaVag-nUfaH_djTdJXlS)&#x20;

## Usage

Usage alerts are **scheduled** checks that trigger based on meter consumption.&#x20;

1. Specify using a **cron&#x20;**&#x65;xpression ([some cron examples](https://crontab.guru/examples.html)).
2. Set the **range&#x20;**(`hour`, `day`, `week`, `month`).
3. Select the meter by setting the **meterId.&#x20;**&#x49;t can found by calling the \[Meter Definition API].([Get a list of meters](docId\:i66o22RFPYjUNKud2fZ6i)) or [UI Dashboard](https://ui.amberflo.io/meters)
4. Select the **thresholdCondition&#x20;**&#x61;nd set the **thresholdValue**

At the defined schedule, Amberflo calls the [Usage API](docId\:ARr7X-fDEquk7pUKn3VU_)  to evaluate the condition against the current usage. If the condition is met for a customer, the alert is triggered.

```curl
curl --location --request POST 'https://app.amberflo.io/notification' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: xyz' \
--data-raw '{
    "name": "usage-alert",
    "meterId" : "4d1ca680-4974-11ec-ad9b-e1ce3f8b2ad3",
    "cron": "0 0 * * 0",
    "webhookUrl": "https://hooks.slack.com/services/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3",
    "email":"batman@amberflo.io",
    "thresholdCondition": "greater-than",
    "thresholdValue": "1000",
    "range":"day",
    "customerFilterMode": "per-customer",
    "enabled": false
}'
```


Prepaid Credits
---------------

This is a real-time alert that applies only to prepaid customers. It triggers when a customer's prepaid credits fall below a defined threshold, prompting them to top up.

- Set the `thresholdValue` for the prepaid balance.
- The `thresholdCondition` is always *less-than*.
- The evaluation is done for the **current billing cycle**.

If a customer's prepaid balance on the active invoice drops below the threshold, the alert will be fired.

```curl
curl --location --request POST 'https://app.amberflo.io/notification' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: xyz' \
--data-raw '{
    "name": "alert-for-prepaid",
    "notificationType": "prepaid",
    "email": ["batman@gmail.com", "batman@wayne.io"],
    "webhookUrl": "https://hooks.slack.com/services/T01HZB7A0M6/B01P3J0LE0H/OBRoTt8TmrJ2Zbv3bQAqH88",
    "thresholdValue": "1000",
    "customerFilterMode": "per-customer",
    "enabled": true
}'
```

## Invoice

Invoice alerts are **real-time** and apply to customers with billing enabled through an assigned pricing plan.

- Set the `thresholdValue` for the total invoice amount.
- The `thresholdCondition` is always *greater-than*.
- The evaluation is based on the **current billing cycle** and applies to the active invoice.

If the total on a customer’s current invoice exceeds the set threshold, an alert is triggered.

```curl
curl --location --request POST 'https://app.amberflo.io/notification' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: xyz' \
--data-raw '{
    "name": "invoice-tracker",
    "notificationType": "invoice",
    "email": ["batman@wayne.io"],
    "thresholdValue": "500",
    "customerFilterMode": "per-customer",
    "enabled": true
}'
```

## Product Item Usage Limit

This **real-time** alert is relevant only to invoices that include a breakdown by product items. Since product items are mapped to specific meters, the alert monitors meter unit consumption (or quantity) for a product item as displayed on the invoice.

![](https://files.readme.io/730d3a1-invoice_product_item_.jpg)

1. Select the meter by setting the `meterId`**.&#x20;**&#x49;t can found by calling the [List Meters API](docId\:i66o22RFPYjUNKud2fZ6i)  or [UI Dashboard](https://ui.amberflo.io/meters)
2. Select the pricing plan by setting the `productPlanId`. This can be obtained from the [Account Pricing API ](docId:-r4cpBaBC5wUBoiwpm0fb) or [UI Dashboard](https://ui.amberflo.io/billing-cloud/pricing-plans)
3. Set the meter units limit `thresholdValue`**.**
4. The `thresholdCondition` is always **greater-than**
5. The **range&#x20;**&#x6F;r time bucket is always the current billing cycle.

If the *meter units* or quantity on the current invoice for the selected meter and pricing plan exceeds the `thresholdValue`, then it will fire an alert.

```curl
curl --location --request POST 'https://app.amberflo.io/notification' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: xyz' \
--data-raw '{
    "name": "product-item-units-tracker",
    "notificationType": "product-item-units",
    "productPlanId":"ff9c55a9-4796-480f-ab77-2ae943ae1700",
    "email": ["batman@wayne.io"],
    "thresholdValue": "100",
    "customerFilterMode": "per-customer",
    "meterId":"21b71110-ee51-11ec-ad99-5b1b04dba7a5",
    "enabled": true
}'
```

## Product Item Charge Amount

This is the same as **Product Item Usage Limit**, except it tracks the product item total charge on the current invoice instead of the meter units.

1. Select the meter by setting the `meterId`. It can found by calling the [List Meters API](docId\:i66o22RFPYjUNKud2fZ6i)  or [UI Dashboard](https://ui.amberflo.io/meters)
2. Select the pricing plan by setting the `productPlanId`. This can be obtained from the [Account Pricing API ](docId:-r4cpBaBC5wUBoiwpm0fb) or [UI Dashboard](https://ui.amberflo.io/billing-cloud/pricing-plans)
3. Set the product item charge limit `thresholdValue`
4. The `thresholdCondition` is always **greater-than**
5. The **range&#x20;**&#x6F;r time bucket is always the current billing cycle.

If the total product item total charge on the current invoice for the selected meter and pricing plan exceeds the `thresholdValue`, then it will fire an alert.

```curl
curl --location --request POST 'https://app.amberflo.io/notification' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: xyz' \
--data-raw '{
    "name": "product-item-price-tracker",
    "notificationType": "product-item-price",
    "productPlanId":"ff9c55a9-4796-480f-ab77-2ae943ae1700",
    "email": ["batman@wayne.io"],
    "thresholdValue": "200",
    "customerFilterMode": "per-customer",
    "meterId":"21b71110-ee51-11ec-ad99-5b1b04dba7a5",
    "enabled": true
}'
```

## Undefined Customer

This scheduled alert is triggered when ingested records reference a customer that does not exist in Amberflo. To prevent alert fatigue, there is a one-hour cool-down period between alerts of this type.

```curl
curl --location --request POST 'https://app.amberflo.io/notification' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: xyz' \
--data-raw '{
    "name": "Undefined Customer",
    "notificationType": "undefined-customer",
    "email": ["batman@wayne.io"]
}'
```

## Undefined Meter

This scheduled alert is triggered when ingested records reference a meter that has not been defined in Amberflo. Like the undefined customer alert, it includes a one-hour cool-down period between notifications.

```curl
curl --location --request POST 'https://app.amberflo.io/notification' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: xyz' \
--data-raw '{
    "name": "Undefined Meter",
    "notificationType": "undefined-meter",
    "email": ["batman@wayne.io"]
}'
```

