Skip to content
  • Auto
  • Light
  • Dark
Talk to an expert

Create billable metrics with Basic Filters | Metronome

The Basic Filters editor is a structured query builder designed to provide out-of-the-box filters and aggregations on your usage stream. All metrics defined with the Basic Filters editor are created as streaming billable metrics.

For this example, create a metric to track “API Calls” for a hypothetical cloud service.

This billable metric counts all successful API calls broken out by user_id, providing a simple but effective measure of platform usage across an organization.

Terminal window
curl -X POST https://api.metronome.com/v1/billable-metrics/create \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"name":"API Calls",
"event_type_filter": {
"in_values": ["api_request"]
},
"property_filters": [
{
"name": "status",
"exists": true,
"in_values": ["success"]
},
{
"name": "user_id",
"exists": true
}
],
"aggregation_type": "COUNT",
"group_keys": [["user_id"]]
}'