v1

latestOpenAPI 3.0.02026-07-13103151174.7 KB
Metrics

Update a Metric

patch/v1/projects/{project}/metrics/{key}

Path parameters

keystring required
projectstring required

A Project key or ID

Request body

namestring

Name of the Metric

keystring

Unique key by Project, can be used in the SDK / API to reference by 'key' rather than _id. Must only contain lower-case characters and _, - or ..

descriptionstring

Metric description.

eventstring

Event associated with metric

dimension'COUNT_PER_UNIQUE_USER' | 'COUNT_PER_VARIABLE_EVALUATION' | 'SUM_PER_UNIQUE_USER' | 'AVERAGE_PER_UNIQUE_USER' | 'TOTAL_AVERAGE' | 'TOTAL_SUM'

Metric dimension

optimize'increase' | 'decrease'

Indicates whether the metric is optimized for increase or decreasae

Example request

{
  "name": "New Signups",
  "key": "new-signups",
  "description": "New signups on the dashboard",
  "event": "Sign Ups",
  "dimension": "COUNT_PER_UNIQUE_USER",
  "optimize": "increase"
}

Response

namestring required

Name of the Metric

keystring required

Unique key by Project, can be used in the SDK / API to reference by 'key' rather than _id. Must only contain lower-case characters and _, - or ..

descriptionstring

Metric description.

_idstring required

A unique Metric ID

_projectstring required

The Project owning the Metric

source'api' | 'dashboard' | 'importer' | 'github.code_usages' | 'github.pr_insights' | 'gitlab.code_usages' | 'gitlab.pr_insights' | 'bitbucket.code_usages' | 'bitbucket.pr_insights' | 'terraform' | 'cli' | 'slack' | 'mcp'

Source that created the Metric

eventstring required

Event associated with metric

dimension'COUNT_PER_UNIQUE_USER' | 'COUNT_PER_VARIABLE_EVALUATION' | 'SUM_PER_UNIQUE_USER' | 'AVERAGE_PER_UNIQUE_USER' | 'TOTAL_AVERAGE' | 'TOTAL_SUM' required

Metric dimension

optimize'increase' | 'decrease' required

Indicates whether the metric is optimized for increase or decreasae

createdAtstring date-time required

The date the Metric was created

updatedAtstring date-time required

The date the Metric was last updated

Example response

{
  "name": "New Signups",
  "key": "new-signups",
  "description": "New signups on the dashboard",
  "_id": "61450f3daec96f5cf4a49946",
  "event": "Sign Ups",
  "dimension": "COUNT_PER_UNIQUE_USER",
  "optimize": "increase"
}