POST /v1/billing/alerts
Creates a billing alert
Parameters
- alert_
type enumRequiredThe type of alert to create.
Possible enum valuesusage_threshold Use
usage_if you intend for an alert to fire when a usage threshold on a meter is crossed.threshold - titlestringRequired
The title of the alert.
The maximum length is 256 characters.
- usage_
threshold objectThe configuration of the usage threshold.
Returns
Returns a billing alert
curl https://api.stripe.com/v1/billing/alerts \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \ -d "title=API Request usage alert" \ -d alert_type=usage_threshold \ -d "usage_threshold[gte]=10000" \ -d "usage_threshold[meter]=mtr_12345" \ -d "usage_threshold[recurrence]=one_time"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"}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"}GET /v1/billing/alerts/:id/notifications
Lists sent billing alert triggered and recovered notifications for a billing alert.
Parameters
- customerstringRequired
The customer to list notifications for.
More parameters
- actionstring
- cadencestring
- ending_
before string - limitinteger
- meterstring
- notified_
at object - starting_
after string - subscriptionstring
Returns
Returns a list of billing alert notification history entries.
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 } ]}