Update a billing meter

Updates a billing meter

Parameters

  • idstringRequired

    Unique identifier for the object.

  • display_namestring

    The meter’s name.

Returns

Returns a billing meter

POST /v1/billing/meters/:id
curl https://api.stripe.com/v1/billing/meters/mtr_123 \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:" \
-d display_name="Updated Display Name"
Response
{
"id": "mtr_123",
"object": "billing.meter",
"created": 1704824589,
"customer_mapping": {
"type": "by_id",
"event_payload_key": "stripe_customer_id"
},
"default_aggregation": {
"formula": "sum"
},
"display_name": "Updated Display Name",
"event_name": "ai_search_api",
"event_time_window": null,
"livemode": false,
"status": "active",
"status_transitions": {
"deactivated_at": null
},
"updated": 1704898330,
"value_settings": {
"event_payload_key": "tokens"
}
}

Retrieve a billing meter

Retrieves a billing meter given an ID

Parameters

  • idstringRequired

    Unique identifier for the object.

Returns

Returns a billing meter

GET /v1/billing/meters/:id
curl https://api.stripe.com/v1/billing/meters/mtr_123 \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:"
Response
{
"id": "mtr_123",
"object": "billing.meter",
"created": 1704824589,
"customer_mapping": {
"type": "by_id",
"event_payload_key": "stripe_customer_id"
},
"default_aggregation": {
"formula": "sum"
},
"display_name": "Search API Calls",
"event_name": "ai_search_api",
"event_time_window": null,
"livemode": false,
"status": "active",
"status_transitions": {
"deactivated_at": null
},
"updated": 1704898330,
"value_settings": {
"event_payload_key": "tokens"
}
}

List billing meters

Retrieve a list of billing meters.

Parameters

  • statusenum

    Filter results to only include meters with the given status.

    Possible enum values
    active

    The meter is active.

    inactive

    The meter is inactive. No more events for this meter will be accepted. The meter cannot be attached to a price.

More parameters

  • ending_beforestring

  • limitinteger

  • starting_afterstring

Returns

Returns a list of billing meters.

GET /v1/billing/meters
curl https://api.stripe.com/v1/billing/meters \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:"
Response
{
"object": "list",
"data": [
{
"id": "mtr_123",
"object": "billing.meter",
"created": 1704824589,
"customer_mapping": {
"type": "by_id",
"event_payload_key": "stripe_customer_id"
},
"default_aggregation": {
"formula": "sum"
},
"display_name": "Search API Calls",
"event_name": "ai_search_api",
"event_time_window": null,
"livemode": false,
"status": "active",
"status_transitions": {
"deactivated_at": null
},
"updated": 1704898330,
"value_settings": {
"event_payload_key": "tokens"
}
}
],
"has_more": true,
"url": "v1/billing/meters"
}

Deactivate a billing meter

Deactivates a billing meter

Parameters

  • idstringRequired

    Unique identifier for the object.

Returns

Returns a billing meter

POST /v1/billing/meters/:id/deactivate
curl -X POST https://api.stripe.com/v1/billing/meters/mtr_123/deactivate \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:"
Response
{
"id": "mtr_123",
"object": "billing.meter",
"created": 1704824589,
"customer_mapping": {
"type": "by_id",
"event_payload_key": "stripe_customer_id"
},
"default_aggregation": {
"formula": "sum"
},
"display_name": "Search API Calls",
"event_name": "ai_search_api",
"event_time_window": null,
"livemode": false,
"status": "active",
"status_transitions": {
"deactivated_at": 1704898330
},
"updated": 1704898330,
"value_settings": {
"event_payload_key": "tokens"
}
}

Reactivate a billing meter

Reactivates a billing meter

Parameters

  • idstringRequired

    Unique identifier for the object.

Returns

Returns a billing meter

POST /v1/billing/meters/:id/reactivate
curl -X POST https://api.stripe.com/v1/billing/meters/mtr_123/reactivate \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:"
Response
{
"id": "mtr_123",
"object": "billing.meter",
"created": 1704824589,
"customer_mapping": {
"type": "by_id",
"event_payload_key": "stripe_customer_id"
},
"default_aggregation": {
"formula": "sum"
},
"display_name": "Search API Calls",
"event_name": "ai_search_api",
"event_time_window": null,
"livemode": false,
"status": "active",
"status_transitions": {
"deactivated_at": null
},
"updated": 1704898330,
"value_settings": {
"event_payload_key": "tokens"
}
}
Stripe Shell
Test mode
Welcome to the Stripe Shell! Stripe Shell is a browser-based shell with the Stripe CLI pre-installed. Log in to your Stripe account and press Control + Backtick (`) on your keyboard to start managing your Stripe resources in test mode. - View supported Stripe commands: - Find webhook events: - Listen for webhook events: - Call Stripe APIs: stripe [api resource] [operation] (e.g., )
The Stripe Shell is best experienced on desktop.
$