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

Retrieve

Get a billable metric
get/v1/billable-metrics/{billable_metric_id}

Get a billable metric.

Path Parameters
billable_metric_idstring
formatuuid
Returns
dataobject
Hide ParametersShow Parameters
idstring

ID of the billable metric

formatuuid
namestring

The display name of the billable metric.

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_typeenum
optional
"COUNT" OR "LATEST" OR "MAX" OR 2 more

Specifies the type of aggregation performed on matching events.

Hide ParametersShow Parameters
"COUNT"
"LATEST"
"MAX"
"SUM"
"UNIQUE"
archived_atstring
optional

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

formatdate-time
custom_fieldsmap
optional
event_type_filterin_valuesarray of stringnot_in_valuesarray of stringEventTypeFilter
optional

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

group_keysarray of array of string
optional

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 of namestringexistsbooleanin_valuesarray of stringnot_in_valuesarray of stringPropertyFilter
optional

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.

sqlstring
optional

The SQL query associated with the billable metric

curl https://api.metronome.com/v1/billable-metrics/$BILLABLE_METRIC_ID \
    -H "Authorization: Bearer $METRONOME_BEARER_TOKEN"
200 Example
{
  "data": {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "name": "name",
    "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"
      ]
    },
    "group_keys": [
      [
        "string"
      ]
    ],
    "property_filters": [
      {
        "name": "name",
        "exists": true,
        "in_values": [
          "string"
        ],
        "not_in_values": [
          "string"
        ]
      }
    ],
    "sql": "sql"
  }
}