POST
/
metrics
{
  "name": "Amex Consumer",
  "description": "No. of Amex Consumer Cards",
  "eventName": "transactions",
  "filterGroups": [
    {
      "operator": "and",
      "filters": [
        {
          "field": "card_scheme",
          "operator": "equal",
          "value": "amex"
        },
        {
          "field": "card_offering",
          "operator": "equal",
          "value": "consumer"
        }
      ]
    }
  ],
  "aggregation": {
    "method": "sum",
    "field": "txn_value"
  }
}

{
  "id": "mtr_02zBU3PJ3hJurtFSxDD3Ol",
  "description": "No. of Amex Consumer Cards",
  "name": "Amex Consumer",
  "eventName": "transactions",
  "filters": [
    {
      "operator": "and",
      "filters": [
        {
          "field": "card_scheme",
          "operator": "equal",
          "value": "amex"
        },
        {
          "field": "card_offering",
          "operator": "equal",
          "value": "consumer"
        }
      ]
    }
  ],
  "aggregation": {
    "method": "sum",
    "field": "txn_value"
  },
  "createdAt": "2025-02-24T12:09:05.350876Z",
  "updatedAt": "2025-02-24T12:09:05.350877Z",
  "organizationID": "8641473c-2d34-46c6-b712-c893934fc8fb"
}

Allows you to create a billable metric out of the raw ingested events.

Request

{
  "name": "Amex Consumer",
  "description": "No. of Amex Consumer Cards",
  "eventName": "transactions",
  "filterGroups": [
    {
      "operator": "and",
      "filters": [
        {
          "field": "card_scheme",
          "operator": "equal",
          "value": "amex"
        },
        {
          "field": "card_offering",
          "operator": "equal",
          "value": "consumer"
        }
      ]
    }
  ],
  "aggregation": {
    "method": "sum",
    "field": "txn_value"
  }
}

name
string
required
The name of the billable metric. This should be clear and concise to represent the usage you are tracking.
description
string
required
A detailed explanation of what the metric measures, such as the number of specific customer transactions.
eventName
string
required
The name of the event that triggers the metric. This event represents a customer action or transaction.
filterGroups
[]object
An array of filter groups used to refine which events contribute to the metric. Filters allow you to narrow down events based on specific properties.
aggregation
object
required
The aggregation settings for the metric. This defines how event data is calculated to produce the final metric value.

Response

id
string
The unique identifier for the metric.
description
string
A brief description of what the metric measures.
name
string
The name of the metric.
eventName
string
The event that triggers the metric.
filters
[]object
An array of filter groups applied to the metric to narrow down the events counted.
aggregation
object
The aggregation settings that define how the events are calculated to produce the metric value.
createdAt
datetime
The timestamp when the metric was created.
updatedAt
datetime
The timestamp when the metric was last updated.
organizationID
string
The unique identifier for the organization associated with the metric.
{
  "id": "mtr_02zBU3PJ3hJurtFSxDD3Ol",
  "description": "No. of Amex Consumer Cards",
  "name": "Amex Consumer",
  "eventName": "transactions",
  "filters": [
    {
      "operator": "and",
      "filters": [
        {
          "field": "card_scheme",
          "operator": "equal",
          "value": "amex"
        },
        {
          "field": "card_offering",
          "operator": "equal",
          "value": "consumer"
        }
      ]
    }
  ],
  "aggregation": {
    "method": "sum",
    "field": "txn_value"
  },
  "createdAt": "2025-02-24T12:09:05.350876Z",
  "updatedAt": "2025-02-24T12:09:05.350877Z",
  "organizationID": "8641473c-2d34-46c6-b712-c893934fc8fb"
}