Update metric

Patch a metric by key. Updating a metric uses a [JSON patch](https://datatracker.ietf.org/doc/html/rfc6902) representation of the desired changes. To learn more, read [Updates](https://launchdarkly.com/docs/api#updates).

Authentication

Authorizationstring
API Key authentication via header

Path parameters

projectKeystringRequiredformat: "string"
The project key
metricKeystringRequiredformat: "string"
The metric key

Request

This endpoint expects a list of objects.

Response

Metric response
_idstring
The ID of this metric
_versionIdstring
The version ID of the metric
keystring
A unique key to reference the metric
namestring

A human-friendly name for the metric

kindenum
The kind of event the metric tracks
tagslist of strings
Tags for the metric
_creationDatelong
Timestamp of when the metric was created
dataSourceobject
experimentCountintegerOptional
The number of experiments using this metric
metricGroupCountintegerOptional
The number of metric groups using this metric
activeExperimentCountintegerOptional
The number of active experiments using this metric
activeGuardedRolloutCountintegerOptional
The number of active guarded rollouts using this metric
_versionintegerOptional
Version of the metric
_attachedFlagCountintegerOptional
The number of feature flags currently attached to this metric
_siteobjectOptional
Details on how to access the metric in the LaunchDarkly UI
_accessobjectOptional
Details on the allowed and denied actions for this metric
lastModifiedobjectOptional
maintainerIdstringOptional
The ID of the member who maintains this metric
_maintainerobjectOptional
Details on the member who maintains this metric
descriptionstringOptional
Description of the metric
categorystringOptional
The category of the metric
isNumericbooleanOptional

For custom and trace metrics, whether to track numeric changes in value against a baseline (true) or to track a conversion when an end user takes an action (false).

successCriteriaenumOptional
For custom and trace metrics, the success criteria
unitstringOptional
For numeric custom and trace metrics, the unit of measure
eventKeystringOptional
For custom metrics, the event key to use in your code
analysisUnitslist of stringsOptional
An array of analysis units allowed for this metric.
filtersobjectOptional
The filters narrowing down the audience based on context attributes or event properties.
unitAggregationTypeenumOptional
The method by which multiple unit event values are aggregated
analysisTypeenumOptional
The method for analyzing metric events
percentileValueintegerOptional

The percentile for the analysis method. An integer denoting the target percentile between 0 and 100. Required when analysisType is percentile.

eventDefaultobjectOptional
lastSeenlongOptional

Timestamp of most recent data for this metric, at one-hour fidelity

archivedbooleanOptional
Whether the metric version is archived
archivedAtlongOptional
Timestamp when the metric version was archived
selectorstringOptional
For click metrics, the CSS selectors
urlslist of maps from strings to anyOptional
For click and pageview metrics, the target URLs
windowStartOffsetlongOptional

Not yet implemented - The start of the measurement window, in milliseconds relative to the unit’s first exposure to a flag variation

windowEndOffsetlongOptional

Not yet implemented - The end of the measurement window, in milliseconds relative to the unit’s first exposure to a flag variation

winsorLowerPercentiledoubleOptional

Lower winsorization percentile, expressed as a percent in the open interval (0, 100). When both bounds are set, defines a two-sided clamp range. Otherwise lower-only winsorization.

winsorUpperPercentiledoubleOptional

Upper winsorization percentile, expressed as a percent in the open interval (0, 100). When both bounds are set, must be greater than winsorLowerPercentile.

winsorIncludeImputedbooleanOptional
When true, the percentile bound calculation includes imputed zeros. Only meaningful when at least one bound is set and the metric includes units that didn't send events.
traceQuerystringOptional
For trace metrics, the trace query to use for the metric.
traceValueLocationstringOptional
For trace metrics, the location in the trace to use for numeric values.
denominatorobjectOptional
For ratio metrics, the denominator event configuration
experimentslist of objectsOptional
Experiments that use this metric, including those using a metric group that contains this metric
metricGroupslist of objectsOptional
Metric groups that use this metric
lastUsedInExperimentobjectOptional
The most recent experiment that used this metric
lastUsedInGuardedRolloutobjectOptional
The most recent guarded rollout that used this metric
isActivebooleanOptional
Whether the metric is active
_attachedFeatureslist of objectsOptional
Details on the flags attached to this metric
randomizationUnitslist of stringsOptionalDeprecated

Deprecated, use analysisUnits instead.

Errors

400
Bad Request Error
401
Unauthorized Error
404
Not Found Error
409
Conflict Error
429
Too Many Requests Error