---
title: "POST /api/v1/config/recording-rules"
method: POST
path: "/api/v1/config/recording-rules"
tags: ["RecordingRule"]
---

# POST /api/v1/config/recording-rules

`POST /api/v1/config/recording-rules`

## Request body

- Configv1CreateRecordingRuleRequest
  - `recording_rule` Configv1RecordingRule
    - `slug` string — Unique identifier of the RecordingRule. If a `slug` isn't provided, one will be generated based of the `name` field. You can't modify this field after the RecordingRule is created.
    - `name` string — Required. Name of the RecordingRule. You can modify this value after the RecordingRule is created.
    - `created_at` string, date-time — Timestamp of when the RecordingRule was created. Cannot be set by clients.
    - `updated_at` string, date-time — Timestamp of when the RecordingRule was last updated. Cannot be set by clients.
    - `bucket_slug` string — Optional slug of the bucket the RecordingRule belongs to.
    - `label_policy` Configv1RecordingRuleLabelPolicy
      - `add` object — Labels to add or overwrite before storing the result.
    - `interval_secs` integer — Optional interval for evaluating the recording rule.
    - `metric_name` string — The name of the time series to use for output, which must be a valid metric name.
    - `prometheus_expr` string — The PromQL expression to evaluate at the time of each evaluation cycle. The result is recorded as a new time series with its metric name defined by the metric_name (or name) field.
    - `execution_group` string — Optional execution_group in which this rule is to be evaluated. At least one of bucket_slug and execution_group must be set. If both are set, then they are expected to match.
  - `dry_run` boolean — If true, the RecordingRule isn't created, and no response RecordingRule will be returned. The response will return an error if the given RecordingRule is invalid.

## Response `200`

A successful response containing the created RecordingRule.

- Configv1CreateRecordingRuleResponse
  - `recording_rule` Configv1RecordingRule
    - `slug` string — Unique identifier of the RecordingRule. If a `slug` isn't provided, one will be generated based of the `name` field. You can't modify this field after the RecordingRule is created.
    - `name` string — Required. Name of the RecordingRule. You can modify this value after the RecordingRule is created.
    - `created_at` string, date-time — Timestamp of when the RecordingRule was created. Cannot be set by clients.
    - `updated_at` string, date-time — Timestamp of when the RecordingRule was last updated. Cannot be set by clients.
    - `bucket_slug` string — Optional slug of the bucket the RecordingRule belongs to.
    - `label_policy` Configv1RecordingRuleLabelPolicy
      - `add` object — Labels to add or overwrite before storing the result.
    - `interval_secs` integer — Optional interval for evaluating the recording rule.
    - `metric_name` string — The name of the time series to use for output, which must be a valid metric name.
    - `prometheus_expr` string — The PromQL expression to evaluate at the time of each evaluation cycle. The result is recorded as a new time series with its metric name defined by the metric_name (or name) field.
    - `execution_group` string — Optional execution_group in which this rule is to be evaluated. At least one of bucket_slug and execution_group must be set. If both are set, then they are expected to match.

## Other responses

- `400` — Cannot create the RecordingRule because the request is invalid.
- `409` — Cannot create the RecordingRule because there is a conflict with an existing RecordingRule.
- `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)
