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.
opstringRequired
The type of operation to perform
pathstringRequired
A JSON Pointer string specifying the part of the document to operate on
valueanyOptional
A JSON value used in "add", "replace", and "test" operations

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
Allowed values:
tagslist of strings
Tags for the metric
_creationDatelong
Timestamp of when the metric was created
dataSourceobject
experimentCountinteger
The number of experiments using this metric
metricGroupCountinteger
The number of metric groups using this metric
activeExperimentCountinteger
The number of active experiments using this metric
activeGuardedRolloutCountinteger
The number of active guarded rollouts using this metric
_versioninteger
Version of the metric
_attachedFlagCountinteger
The number of feature flags currently attached to this metric
_siteobject
Details on how to access the metric in the LaunchDarkly UI
_accessobject
Details on the allowed and denied actions for this metric
lastModifiedobject
maintainerIdstring
The ID of the member who maintains this metric
_maintainerobject
Details on the member who maintains this metric
descriptionstring
Description of the metric
categorystring
The category of the metric
isNumericboolean

For custom 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).

successCriteriaenum
For custom metrics, the success criteria
Allowed values:
unitstring
For numeric custom metrics, the unit of measure
eventKeystring
For custom metrics, the event key to use in your code
randomizationUnitslist of strings
An array of randomization units allowed for this metric
filtersobject
The filters narrowing down the audience based on context attributes or event properties.
unitAggregationTypeenum
The method by which multiple unit event values are aggregated
Allowed values:
analysisTypeenum
The method for analyzing metric events
Allowed values:
percentileValueinteger

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

eventDefaultobject
lastSeenlong

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

archivedboolean
Whether the metric version is archived
archivedAtlong
Timestamp when the metric version was archived
selectorstring
For click metrics, the CSS selectors
urlslist of maps from strings to any
For click and pageview metrics, the target URLs
experimentslist of objects
Experiments that use this metric, including those using a metric group that contains this metric
metricGroupslist of objects
Metric groups that use this metric
lastUsedInExperimentobject
The most recent experiment that used this metric
lastUsedInGuardedRolloutobject
The most recent guarded rollout that used this metric
isActiveboolean
Whether the metric is active
_attachedFeatureslist of objects
Details on the flags attached to this metric

Errors

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