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

List Billable Metrics

Get billable metrics for a customer
v1.customers.list_billable_metrics(**kwargs) -> CursorPage<idStringnameStringaggregateStringaggregate_keysarrayaggregation_keyStringaggregation_typeunionarchived_atTimecustom_fieldshashevent_type_filterEventTypeFilterfilterhashgroup_byarraygroup_keysarrayproperty_filtersarraysqlStringCustomerListBillableMetricsResponse>
get/v1/customers/{customer_id}/billable-metrics

Get all billable metrics for a given customer.

Parameters
customer_idString
formatuuid
include_archivedbool
optional

If true, the list of returned metrics will include archived metrics

limitInteger
optional

Max number of results that should be returned

minimum1
maximum100
next_pageString
optional

Cursor that indicates where the next page of results should start.

on_current_planbool
optional

If true, the list of metrics will be filtered to just ones that are on the customer's current plan

Returns
CustomerListBillableMetricsResponseclass
Hide ParametersShow Parameters
idString
formatuuid
nameString
aggregateString
optional

(DEPRECATED) use aggregation_type instead

aggregate_keysarray
optional
Array[String]

(DEPRECATED) use aggregation_key instead

aggregation_keyString
optional

A key that specifies which property of the event is used to aggregate data. This key must be one of the property filter names and is not applicable when the aggregation type is 'count'.

aggregation_typeunion
optional
:COUNT | :LATEST | :MAX | 2 more

Specifies the type of aggregation performed on matching events.

Hide ParametersShow Parameters
:COUNT
:LATEST
:MAX
:SUM
:UNIQUE
archived_atTime
optional

RFC 3339 timestamp indicating when the billable metric was archived. If not provided, the billable metric is not archived.

formatdate-time
custom_fieldshash
optional
Hash[Symbol, String]
event_type_filterin_valuesarraynot_in_valuesarrayEventTypeFilter
optional

An optional filtering rule to match the 'event_type' property of an event.

filterhash
optional
Hash[Symbol, untyped]

(DEPRECATED) use property_filters & event_type_filter instead

group_byarray
optional
Array[String]

(DEPRECATED) use group_keys instead

group_keysarray
optional
Array[Array[String]]

Property names that are used to group usage costs on an invoice. Each entry represents a set of properties used to slice events into distinct buckets.

property_filtersarray
optional
Array[nameStringexistsboolin_valuesarraynot_in_valuesarrayPropertyFilter]

A list of filters to match events to this billable metric. Each filter defines a rule on an event property. All rules must pass for the event to match the billable metric.

Hide ParametersShow Parameters
nameString

The name of the event property.

existsbool
optional

Determines whether the property must exist in the event. If true, only events with this property will pass the filter. If false, only events without this property will pass the filter. If null or omitted, the existence of the property is optional.

in_valuesarray
optional
Array[String]

Specifies the allowed values for the property to match an event. An event will pass the filter only if its property value is included in this list. If undefined, all property values will pass the filter. Must be non-empty if present.

not_in_valuesarray
optional
Array[String]

Specifies the values that prevent an event from matching the filter. An event will not pass the filter if its property value is included in this list. If null or empty, all property values will pass the filter. Must be non-empty if present.

sqlString
optional

The SQL query associated with the billable metric

require "metronome_sdk"

metronome = MetronomeSDK::Client.new(bearer_token: "My Bearer Token")

page = metronome.v1.customers.list_billable_metrics(customer_id: "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc")

puts(page)
200 Example
{
  "data": [
    {
      "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "name": "name",
      "aggregate": "aggregate",
      "aggregate_keys": [
        "string"
      ],
      "aggregation_key": "aggregation_key",
      "aggregation_type": "COUNT",
      "archived_at": "2019-12-27T18:11:19.117Z",
      "custom_fields": {
        "foo": "string"
      },
      "event_type_filter": {
        "in_values": [
          "string"
        ],
        "not_in_values": [
          "string"
        ]
      },
      "filter": {
        "foo": "bar"
      },
      "group_by": [
        "string"
      ],
      "group_keys": [
        [
          "string"
        ]
      ],
      "property_filters": [
        {
          "name": "name",
          "exists": true,
          "in_values": [
            "string"
          ],
          "not_in_values": [
            "string"
          ]
        }
      ],
      "sql": "sql"
    }
  ],
  "next_page": "next_page"
}