Alerts v1
A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed. For example, you might create a billing alert to notify you when a certain user made 100 API requests.
Attributes
- idstring
Unique identifier for the object.
- objectstring, value is "billing.alert"
String representing the object’s type. Objects of the same type share the same value.
- alert_
typeenum Defines the type of the alert.
Possible enum valuesusage_threshold Use
usage_if you intend for an alert to fire when a usage threshold on a meter is crossed.threshold - livemodeboolean
If the object exists in live mode, the value is
true. If the object exists in test mode, the value isfalse. - statusnullable enum
Status of the alert. This can be active, inactive or archived.
Possible enum valuesactivearchivedinactive - titlestring
Title of the alert.
- usage_
thresholdnullable object Encapsulates configuration of the alert to monitor usage on a specific Billing Meter.
{ "id": "alrt_12345", "object": "billing.alert", "title": "API Request usage alert", "livemode": true, "alert_type": "usage_threshold", "usage_threshold": { "gte": 10000, "meter": "mtr_12345", "recurrence": "one_time" }, "status": "active"}Attributes
- idstring
Unique identifier for the object.
- objectstring, value is "billing.alert_notification"
String representing the object’s type. Objects of the same type share the same value.
- actionenum
Whether the alert was triggered or recovered.
Possible enum valuesrecoveredThe alert recovered below the threshold and a notification was sent.
triggeredThe alert threshold was crossed and a notification was sent.
- aggregation_
period_ endnullable timestamp End of the aggregation period for which this notification was sent. Only present for usage threshold alerts.
- aggregation_
period_ startnullable timestamp Start of the aggregation period for which this notification was sent. Only present for usage threshold alerts.
- alertstring
ID of the billing alert that generated this notification.
- alert_
typeenum The type of billing alert that generated this notification.
Possible enum valuesusage_threshold Use
usage_if you intend for an alert to fire when a usage threshold on a meter is crossed.threshold - billing_
groupnullable string The billing group associated with this notification. Only present for spend threshold alerts grouped by billing group.
- cadencenullable string
The cadence associated with this notification. Only present for spend threshold alerts grouped by cadence.
- currencynullable string
Three-letter ISO currency code for the value, in lowercase. Only present for spend and credit balance threshold alerts.
- customerstring
ID of the customer for which the alert notification was sent.
- livemodeboolean
The value is
truefor objects in live mode andfalsefor objects in a sandbox. For accounts that still have access to legacy test mode, the value is alsofalsefor objects in that mode. - meternullable string
ID of the billing meter associated with this notification. Only present for usage threshold alerts.
- notification_
eventstring ID of the event delivered for this notification. Retrievable via the Events API for a limited time; for long-term audit scenarios, capture the full event payload at webhook delivery time.
- notified_
attimestamp Time at which the notification was sent. Measured in seconds since the Unix epoch.
- subscriptionnullable string
ID of the subscription associated with this notification. Only present for spend threshold alerts grouped by subscription.
- valuestring
The value that triggered the alert. This may be a decimal string for custom pricing unit alerts. For usage threshold alerts, this is the meter event count. For credit balance and spend threshold alerts, this is the amount in the smallest currency unit.
{ "id": "threvt_12345", "object": "billing.alert_notification", "action": "triggered", "customer": "cus_12345", "notification_event": "evt_12345", "alert": "alrt_12345", "subscription": null, "cadence": null, "value": "12345", "currency": null, "alert_type": "usage_threshold", "meter": "mtr_12345", "aggregation_period_start": 1698796800, "aggregation_period_end": 1701388800, "livemode": false, "notified_at": 1700000020}