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.

  • filterobject

    Filters to limit the scope of an alert.

  • usage_threshold_configobject

    The configuration of the usage threshold.

Returns

Returns a billing alert

POST /v1/billing/alerts
curl https://api.stripe.com/v1/billing/alerts \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:" \
-d title="API Request usage alert" \
-d alert_type=usage_threshold \
-d "usage_threshold_config[gte]"=10000 \
-d "usage_threshold_config[meter]"=mtr_12345 \
-d "usage_threshold_config[recurrence]"=one_time
Response
{
"id": "alrt_12345",
"object": "billing.alert",
"title": "API Request usage alert",
"livemode": true,
"alert_type": "usage_threshold",
"usage_threshold_config": {
"gte": 10000,
"meter": "mtr_12345",
"recurrence": "one_time"
},
"status": "active"
}

Retrieves a billing alert given an ID

Parameters

No parameters.

Returns

Returns the alert

GET /v1/billing/alerts/:id
cURL
curl https://api.stripe.com/v1/billing/alerts/alrt_12345 \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:"
Response
{
"id": "alrt_12345",
"object": "billing.alert",
"title": "API Request usage alert",
"livemode": true,
"alert_type": "usage_threshold",
"usage_threshold_config": {
"gte": 10000,
"meter": "mtr_12345",
"recurrence": "one_time"
},
"status": "active"
}

Lists billing active and inactive alerts

Parameters

  • alert_typeenum

    Filter results to only include this type of alert.

    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.

  • meterstring

    Filter results to only include alerts with the given meter.

More parameters

  • ending_beforestring

  • limitinteger

  • starting_afterstring

Returns

Returns a list of billing alerts

GET /v1/billing/alerts
curl https://api.stripe.com/v1/billing/alerts \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:"
Response
{
"data": [
{
"id": "alrt_12345",
"object": "billing.alert",
"title": "API Request usage alert",
"livemode": true,
"alert_type": "usage_threshold",
"usage_threshold_config": {
"gte": 10000,
"meter": "mtr_12345",
"recurrence": "one_time"
},
"status": "active"
},
{
"id": "alrt_67890",
"object": "billing.alert",
"title": "API Request usage alert",
"livemode": true,
"alert_type": "usage_threshold",
"usage_threshold_config": {
"gte": 120,
"meter": "mtr_67890",
"recurrence": "one_time"
},
"status": "active"
}
]
}

Reactivates this alert, allowing it to trigger again.

Parameters

No parameters.

Returns

Returns the alert with its updated status.

POST /v1/billing/alerts/:id/activate
cURL
curl -X POST https://api.stripe.com/v1/billing/alerts/alrt_12345/activate \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:"
Response
{
"id": "alrt_12345",
"object": "billing.alert",
"title": "API Request usage alert",
"livemode": true,
"alert_type": "usage_threshold",
"usage_threshold_config": {
"gte": 10000,
"meter": "mtr_12345",
"recurrence": "one_time"
},
"status": "active"
}

Archives this alert, removing it from the list view and APIs. This is non-reversible.

Parameters

No parameters.

Returns

Returns the alert with its updated status.

POST /v1/billing/alerts/:id/archive
cURL
curl -X POST https://api.stripe.com/v1/billing/alerts/alrt_12345/archive \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:"
Response
{
"id": "alrt_12345",
"object": "billing.alert",
"title": "API Request usage alert",
"livemode": true,
"alert_type": "usage_threshold",
"usage_threshold_config": {
"gte": 10000,
"meter": "mtr_12345",
"recurrence": "one_time"
},
"status": "archived"
}