Create a billing alert
POST / v1 / billing / alerts
Creates a billing alert
Parameters
- alert _ type enum Required The type of alert to create. Possible enum values
usage_thresholdUseusage_thresholdif you intend for an alert to fire when a usage threshold on a meter is crossed. - title string Required The title of the alert. The maximum length is 256 characters.
- usage _ threshold object The configuration of the usage threshold.
Returns
Returns a billing alert
Response
{ "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"}
Retrieve a billing alert
GET / v1 / billing / alerts /:id
Retrieves a billing alert given an ID
Parameters
No parameters.
Returns
Returns the alert
Response
{ "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"}
List billing alert notifications
GET / v1 / billing / alerts /:id / notifications
Lists sent billing alert triggered and recovered notifications for a billing alert.
Parameters
- customer string Required The customer to list notifications for.
More parameters
- action string
- cadence string
- ending _ before string
- limit integer
- meter string
- notified _ at object
- starting _ after string
- subscription string
Returns
Returns a list of billing alert notification history entries.
cURL
Response
{ "object": "list", "data": [ { "id": "threvt_12345", "object": "billing.alert_notification", "action": "triggered", "customer": "cus_12345", "notification_event": "evt_12345", "alert": "alrt_12345", "subscription": "sub_12345", "cadence": "monthly", "value": "123.45", "currency": "usd", "alert_type": "spend_threshold", "meter": null, "aggregation_period_start": null, "aggregation_period_end": null, "livemode": false, "notified_at": 1700000020 } ]}
