Skip to content
Product Docs

Usage Metrics

Aggregate Usage Metrics
client.admin.usageMetrics.aggregate(UsageMetricAggregateParams { day_on_or_after, day_on_or_before, group_by, 4 more } query, RequestOptionsoptions?): UsageMetricAggregateResponse { buckets, group_by }
GET/api/v1/admin/usage-metrics/aggregate
ModelsExpand Collapse
UsageMetricAggregateResponse { buckets, group_by }

Response containing usage metrics aggregated by one or more dimensions.

buckets: Array<Bucket>

The aggregation buckets, ordered by total credits descending

dimensions: Record<string, string>

The dimension values that define this bucket

metric_count: number

Number of metric rows in this bucket

total_credits: number | string

Total credits consumed by metrics in this bucket

One of the following:
number
string
total_value: number

Total of the metric value field in this bucket

group_by: Array<"day" | "event_type" | "organization_id" | 2 more>

The dimensions the metrics were grouped by

One of the following:
"day"
"event_type"
"organization_id"
"project_id"
"user_id"