Create a billing alert 

Billing
Alerts
Create a billing alert

Creates a billing alert

Parameters

  • alert_typeenumRequired

    The type of alert to create.

    Possible enum values
    usage_threshold

    Use usage_threshold if you intend for an alert to fire when a usage threshold on a meter is crossed.

  • titlestringRequired

    The title of the alert.

  • usage_thresholdobject

    The configuration of the usage threshold.

    • usage_threshold.gteintegerRequired

      Defines at which value the alert will fire.

    • usage_threshold.meterstringRequired

      The Billing Meter ID whose usage is monitored.

    • usage_threshold.recurrenceenumRequired

      Defines how the alert will behave.

      Possible enum values
      one_time

      Use one_time if you intend for an alert to only fire once in the lifetime of a customer.

    • usage_threshold.filtersarray of objects

      The filters allows limiting the scope of this usage alert. You can only specify up to one filter at this time.

      • usage_threshold.filters.typeenumRequired

        What type of filter is being applied to this usage alert.

        Possible enum values
        customer

        Use customer if you intend to filter this alert to a customer.

      • usage_threshold.filters.customerstring

        Limit the scope to this usage alert only to this customer.

Returns

Returns a billing alert

POST /v1/billing/alerts
curl https://api.stripe.com/v1/billing/alerts \
-u "sk_test_BQokikJ...2HlWgH4olfQ2sk_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"
}