---
title: "POST /api/v1/config/mapping-rules"
method: POST
path: "/api/v1/config/mapping-rules"
tags: ["MappingRule"]
---

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

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

## Request body

- Configv1CreateMappingRuleRequest
  - `mapping_rule` Configv1MappingRule
    - `slug` string — Unique identifier of the MappingRule. If a `slug` isn't provided, one will be generated based of the `name` field. You can't modify this field after the MappingRule is created.
    - `name` string — Required. Name of the MappingRule. You can modify this value after the MappingRule is created.
    - `created_at` string, date-time — Timestamp of when the MappingRule was created. Cannot be set by clients.
    - `updated_at` string, date-time — Timestamp of when the MappingRule was last updated. Cannot be set by clients.
    - `bucket_slug` string — Required. Slug of the bucket the MappingRule belongs to.
    - `filters` Configv1LabelFilter[] — Required filters that determine to which metrics to apply the rule.
      - `name` string — Name of the label to match.
      - `value_glob` string — Glob value of the label to match.
    - `aggregation_policy` MappingRuleAggregationPolicy
      - `aggregation` 'LAST' | 'MIN' | 'MAX' | 'MEAN' | 'MEDIAN' | 'COUNT' | 'SUM' | 'SUMSQ' | 'STDEV' | 'P10' | 'P20' | 'P30' | 'P40' | 'P50' | 'P60' | 'P70' | 'P80' | 'P90' | 'P95' | 'P99' | 'P999' | 'P9999' | 'P25' | 'P75' | 'COUNT_SAMPLES' | 'HISTOGRAM'
      - `storage_policy` Configv1MappingRuleStoragePolicy
        - `resolution` string — Required resolution of the aggregated metrics.
        - `retention` string — Required retention of the aggregated metrics.
      - `interval` string — Interval between aggregated data points, equivalent to the resolution field in storage policy. If set, then the storage_policy field can't be set.
      - `drop_timestamp` boolean — Deprecated: This field is no longer supported.
    - `drop` boolean — Whether to drop the given set of metrics. If set, then the aggregation policy can't be set.
    - `mode` 'ENABLED' | 'PREVIEW' — - ENABLED: ENABLED rules are applied. Rules default to ENABLED. - PREVIEW: PREVIEW rules are not applied, but shaping impact stats for them rule are recorded.
  - `dry_run` boolean — If true, the MappingRule isn't created, and no response MappingRule will be returned. The response will return an error if the given MappingRule is invalid.

## Response `200`

A successful response containing the created MappingRule.

- Configv1CreateMappingRuleResponse
  - `mapping_rule` Configv1MappingRule
    - `slug` string — Unique identifier of the MappingRule. If a `slug` isn't provided, one will be generated based of the `name` field. You can't modify this field after the MappingRule is created.
    - `name` string — Required. Name of the MappingRule. You can modify this value after the MappingRule is created.
    - `created_at` string, date-time — Timestamp of when the MappingRule was created. Cannot be set by clients.
    - `updated_at` string, date-time — Timestamp of when the MappingRule was last updated. Cannot be set by clients.
    - `bucket_slug` string — Required. Slug of the bucket the MappingRule belongs to.
    - `filters` Configv1LabelFilter[] — Required filters that determine to which metrics to apply the rule.
      - `name` string — Name of the label to match.
      - `value_glob` string — Glob value of the label to match.
    - `aggregation_policy` MappingRuleAggregationPolicy
      - `aggregation` 'LAST' | 'MIN' | 'MAX' | 'MEAN' | 'MEDIAN' | 'COUNT' | 'SUM' | 'SUMSQ' | 'STDEV' | 'P10' | 'P20' | 'P30' | 'P40' | 'P50' | 'P60' | 'P70' | 'P80' | 'P90' | 'P95' | 'P99' | 'P999' | 'P9999' | 'P25' | 'P75' | 'COUNT_SAMPLES' | 'HISTOGRAM'
      - `storage_policy` Configv1MappingRuleStoragePolicy
        - `resolution` string — Required resolution of the aggregated metrics.
        - `retention` string — Required retention of the aggregated metrics.
      - `interval` string — Interval between aggregated data points, equivalent to the resolution field in storage policy. If set, then the storage_policy field can't be set.
      - `drop_timestamp` boolean — Deprecated: This field is no longer supported.
    - `drop` boolean — Whether to drop the given set of metrics. If set, then the aggregation policy can't be set.
    - `mode` 'ENABLED' | 'PREVIEW' — - ENABLED: ENABLED rules are applied. Rules default to ENABLED. - PREVIEW: PREVIEW rules are not applied, but shaping impact stats for them rule are recorded.

## Other responses

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