Introducing the Better Auth Chargebee plugin: Use it to handle subscriptions, billing, and auth seamlessly.Try now
Chargebeechargebee API

Create an alert

Idempotency Supported

Creates a new alert configuration for a metered feature. The alert 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 new usage events are ingested for the associated metered feature. 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

  • The metered_feature_id must reference an existing metered feature configured on your site.
  • type must be usage_exceeded.
  • For filter_conditions, only plan_price_id is supported as the field, with operator equals or not_equals.

Sample Request

Sample Result[JSON]

URL Format

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

Input Parameters

type
required, enumerated string

The type of alert to create. Currently only usage_exceeded is supported.

Enum Values
usage_exceeded

The alert fires when usage of the metered feature exceeds the configured threshold.

name
required, string, max chars=50

A human-readable name for the alert. Maximum 50 characters.

description
optional, string, max chars=65k

An optional description providing additional context about the alert. Maximum 65,000 characters.

metered_feature_id
required, string, max chars=50

The identifier of the metered feature that this alert should monitor.

subscription_id
optional, string, max chars=50

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.

meta
optional, string, max chars=65k

An optional string field for storing custom metadata with the alert (for example, JSON serialized by your integration). Maximum 65,000 characters.

threshold
Parameters for threshold
pass parameters as threshold[<param name>]
filter_conditions[0..n]
Parameters for filter_conditions. Multiple filter_conditions can be passed by specifying unique indices.
pass parameters as filter_conditions[<param name>][<idx:0..n>]

Returns

Alert object
Resource object representing alert