Meters

Preview an unsaved meter definition

Changed on

Dry-run a candidate meter definition against your real usage over the last 7 whole UTC days (today included, future-dated events excluded) WITHOUT creating anything: matched events, aggregated units, distinct customers, and a zero-filled per-day series, oldest first. Useful for checking a definition before committing to it. The scan is capped defensively and runs newest-first, so a very high-volume store gets the most recent slice of the window rather than an unbounded scan — the recent days stay complete and the oldest day of the series degrades.

post/v1/meters/preview

Request

Request body

event_namestring required

The usage event name the candidate meter would consume

aggregation'count' | 'sum' | 'average' | 'min' | 'max' | 'unique' required

Aggregation to dry-run

aggregation_propertystring

Event property the aggregation reduces. Required for every aggregation except "count".

unit_labelstring

Display unit for the preview. Cosmetic (nothing is persisted); defaults to "units".

Example request

{
  "event_name": "image.generated",
  "aggregation": "count",
  "aggregation_property": "tokens",
  "filter": {
    "conjunction": "and",
    "clauses": [
      {
        "property": "tier",
        "operator": "equals"
      }
    ]
  },
  "unit_label": "images"
}

Response

Preview of the candidate definition

matched_eventsnumber required

Events the meter would count over the preview window

unitsstring required

Aggregated units over the whole window, as a string for BigInt safety

distinct_customersnumber required

Distinct customers among the matching events

Example response

{
  "matched_events": 137,
  "units": "4820",
  "distinct_customers": 12,
  "daily": [
    {
      "date": "2026-08-16",
      "event_count": 42,
      "value": "1280"
    }
  ]
}

Changes