---
title: "POST /api/v1/config/derived-metrics"
method: POST
path: "/api/v1/config/derived-metrics"
tags: ["DerivedMetric"]
---

# POST /api/v1/config/derived-metrics

`POST /api/v1/config/derived-metrics`

## Request body

- Configv1CreateDerivedMetricRequest
  - `derived_metric` Configv1DerivedMetric
    - `name` string — Required. Name of the DerivedMetric. You can modify this value after the DerivedMetric is created.
    - `slug` string — Unique identifier of the DerivedMetric. If a `slug` isn't provided, one will be generated based of the `name` field. You can't modify this field after the DerivedMetric is created.
    - `created_at` string, date-time — Timestamp of when the DerivedMetric was created. Cannot be set by clients.
    - `updated_at` string, date-time — Timestamp of when the DerivedMetric was last updated. Cannot be set by clients.
    - `metric_name` string — Required metric name of the derived metric, which must be unique across the system.
    - `description` string — Optional description of the derived metric.
    - `queries` DerivedMetricSelectorQuery[] — Required queries that the derived metric can map to.
      - `selector` DerivedMetricSelector
        - `labels` Configv1DerivedMetricLabelMatcher[] — Labels which must match in the derived metric usage for the selector to match.
          - `type` 'EXACT'
          - `name` string — name always matches against an exact label name.
          - `value` string — value matches against a label value based on the configured type.
      - `query` DerivedMetricQuery
        - `prometheus_expr` string — Required PromQL expression which the derived metric executes. Should include all configured variables.
        - `variables` DerivedMetricVariable[] — Optional variables which may be used in the derived metric as label selectors.
          - `name` string — Required name of the variable.
          - `default_prometheus_selector` string — Required PromQL label selector which must match the given variable name. If the variable is not specified in the derived metric usage, then this default selector is used.
  - `dry_run` boolean — If true, the DerivedMetric isn't created, and no response DerivedMetric will be returned. The response will return an error if the given DerivedMetric is invalid.

## Response `200`

A successful response containing the created DerivedMetric.

- Configv1CreateDerivedMetricResponse
  - `derived_metric` Configv1DerivedMetric
    - `name` string — Required. Name of the DerivedMetric. You can modify this value after the DerivedMetric is created.
    - `slug` string — Unique identifier of the DerivedMetric. If a `slug` isn't provided, one will be generated based of the `name` field. You can't modify this field after the DerivedMetric is created.
    - `created_at` string, date-time — Timestamp of when the DerivedMetric was created. Cannot be set by clients.
    - `updated_at` string, date-time — Timestamp of when the DerivedMetric was last updated. Cannot be set by clients.
    - `metric_name` string — Required metric name of the derived metric, which must be unique across the system.
    - `description` string — Optional description of the derived metric.
    - `queries` DerivedMetricSelectorQuery[] — Required queries that the derived metric can map to.
      - `selector` DerivedMetricSelector
        - `labels` Configv1DerivedMetricLabelMatcher[] — Labels which must match in the derived metric usage for the selector to match.
          - `type` 'EXACT'
          - `name` string — name always matches against an exact label name.
          - `value` string — value matches against a label value based on the configured type.
      - `query` DerivedMetricQuery
        - `prometheus_expr` string — Required PromQL expression which the derived metric executes. Should include all configured variables.
        - `variables` DerivedMetricVariable[] — Optional variables which may be used in the derived metric as label selectors.
          - `name` string — Required name of the variable.
          - `default_prometheus_selector` string — Required PromQL label selector which must match the given variable name. If the variable is not specified in the derived metric usage, then this default selector is used.

## Other responses

- `400` — Cannot create the DerivedMetric because the request is invalid.
- `409` — Cannot create the DerivedMetric because there is a conflict with an existing DerivedMetric.
- `500` — An unexpected error response.
- `default` — An undefined error response.

---

[API](https://skmtc.net/chronosphere/apis/config-v1-api.md) · [All operations](https://skmtc.net/chronosphere/apis/config-v1-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/chronosphere/config-v1-api/revisions/530951bd2ccf/schema)
