Creates a new alert configuration. Depending on type, the alert can monitor usage or spend, and it can be global or subscription-scoped depending on whether subscription_id is provided.
Note: Creating an alert defines the threshold rule only. After an alert is created, Chargebee begins evaluating it as relevant billing data changes are processed. Alert statuses are created and updated during alert evaluation. The runtime evaluation state for each subscription is available via the Alert Status endpoints.
Prerequisites & Constraints
- For
usage_exceededalerts,metered_feature_idmust reference an existing metered feature configured on your site. - For
spend_exceededalerts, providecurrency_code. - Provide only the input that matches the alert
type:metered_feature_idandcurrency_codeare mutually exclusive. - For
spend_exceededalerts,thresholdmodeis optional and defaults toabsolutewhen omitted; if provided, it must beabsolute. Onlyusage_exceededalerts supportpercentagemode. - For
filter_conditions, onlyplan_price_idis supported as thefield, with operatorequalsornot_equals.
Use Cases
Create a usage alert
Set type to usage_exceeded and provide metered_feature_id. Use a percentage threshold to fire relative to the plan or feature quota (for example, at 90%), or an absolute threshold to fire at a specific usage quantity.
Create a spend alert
Set type to spend_exceeded and provide currency_code. The alert monitors the usage-based spend accumulated from metered addons (counting only usage beyond the included entitlement) and fires when it reaches the absolute threshold amount in that currency.
Sample Request
Sample Result[JSON]
URL Format
Input Parameters
The type of alert to create. Determines what the alert measures, which input it requires, and how the threshold is interpreted.
The alert fires when usage of the metered feature (identified by metered_feature_id) reaches or exceeds the configured threshold. Supports both percentage and absolute threshold modes.
The alert fires when the total usage-based spend accumulated from metered addons reaches or exceeds the configured threshold. Only spend from usage beyond the included entitlement is counted. See usage charges for how overage spend is computed. The threshold mode is always absolute.
Identifier of the metered feature that the alert should monitor. Required when type is usage_exceeded; do not set it for other alert types.
The ISO currency code in which the metered-addon overage spend is measured. Required when type is spend_exceeded; do not set it for other alert types.
The identifier of the subscription to scope this alert to. If omitted, the alert is created as a global alert. If provided, filter_conditions must not be set.