Skip to content

Update a draft metric definition

Auth: session ADMIN role, or ApiKeyAuth with scope metrics:write. Only draft metrics are mutable.

projectId
required
string
metricId
required
string
Media typeapplication/json

Draft-only update; all fields optional.

object
name
string
>= 1 characters <= 100 characters
description
string
<= 500 characters
eventName
string
>= 1 characters <= 100 characters
aggregation

Metric aggregation DSL. aggregator is one of METRIC_AGGREGATORS (count/sum/max/unique/…); non-count aggregators require fieldPath. fieldPaths are allowlist-validated.

object
aggregator
required
string
fieldPath
string
filter
object
conditions
required
Array<object>
>= 1 items
object
field
required
string
op
required

One of FILTER_OPS.

string
value
required
groupBy
object
keys
required
Array<string>
>= 1 items
window
object
type
required
string
Allowed values: billing_period rolling_days
days
integer
>= 1

{ metric }

Media typeapplication/json
object
key
additional properties
any

Metric_not_found

Media typeapplication/json
object
error
required

Human-readable error message.

string
message
string
Examplegenerated
json
{
"error": "example",
"message": "example"
}

Active_version_immutable / archived_metric_immutable

Media typeapplication/json
object
error
string
detail
string
Examplegenerated
json
{
"error": "example",
"detail": "example"
}

Validation failed

Media typeapplication/json

Validation error envelope (Zod). issues/details present on schema failures.

object
error
required
string
issues
Array<object>
object
key
additional properties
any
details
Array<object>
object
key
additional properties
any
Examplegenerated
json
{
"error": "example",
"issues": [
{}
],
"details": [
{}
]
}

Update_failed

Media typeapplication/json
object
error
required

Human-readable error message.

string
message
string
Examplegenerated
json
{
"error": "example",
"message": "example"
}