> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chronosphere.io/llms.txt
> Use this file to discover all available pages before exploring further.

# UpdateRecordingRule



## OpenAPI

````yaml openapi/api_v1_config_openapi3_DOCUMENTATION_ONLY.json PUT /api/v1/config/recording-rules/{slug}
openapi: 3.0.3
info:
  description: >

    The Config API provides standard HTTP/JSON REST endpoints for creating,
    reading,

    updating, deleting, and listing configurable Chronosphere resources.


    Use this link to download the raw Swagger specification:

    <a href="/api/v1/config/swagger.json">/api/v1/config/swagger.json</a>
  title: Config V1 API
  version: v1
servers:
  - url: https://{tenant}.chronosphere.io
    variables:
      tenant:
        default: tenant
        description: tenant ID assigned by the service provider
security:
  - ApiKeyAuth: []
tags:
  - name: ConfigV1
paths:
  /api/v1/config/recording-rules/{slug}:
    put:
      tags:
        - RecordingRule
      operationId: UpdateRecordingRule
      parameters:
        - in: path
          name: slug
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConfigV1UpdateRecordingRuleBody'
        required: true
        x-originalParamName: body
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/configv1UpdateRecordingRuleResponse'
          description: A successful response containing the updated RecordingRule.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiError'
          description: Cannot update the RecordingRule because the request is invalid.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiError'
          description: Cannot update the RecordingRule because the slug does not exist.
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiError'
          description: >-
            Cannot update the RecordingRule because there is a conflict with an
            existing RecordingRule.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiError'
          description: An unexpected error response.
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/genericError'
          description: An undefined error response.
components:
  schemas:
    ConfigV1UpdateRecordingRuleBody:
      properties:
        create_if_missing:
          description: >-
            If `true`, the RecordingRule will be created if it does not already
            exist, identified by `slug`. If `false`, an error will be returned
            if the RecordingRule does not already exist.
          type: boolean
        dry_run:
          description: >-
            If `true`, validates the specified configuration without creating or
            updating the RecordingRule. If the specified configuration is valid,
            the endpoint returns a partial response without the RecordingRule.
            If the specified configuration is invalid, the endpoint returns an
            error.
          type: boolean
        recording_rule:
          allOf:
            - $ref: '#/components/schemas/configv1RecordingRule'
          description: The RecordingRule to update.
      type: object
    configv1UpdateRecordingRuleResponse:
      properties:
        recording_rule:
          $ref: '#/components/schemas/configv1RecordingRule'
      type: object
    apiError:
      properties:
        message:
          description: An error message describing what went wrong.
          type: string
      type: object
    genericError:
      additionalProperties: true
      type: object
    configv1RecordingRule:
      properties:
        bucket_slug:
          description: >-
            The slug of the bucket the recording rule belongs to. Required if

            `execution_group` is not set. If both `bucket_slug` and
            `execution_group`

            are set, their values must match.
          type: string
        created_at:
          description: >-
            Timestamp of when the RecordingRule was created. Cannot be set by
            clients.
          format: date-time
          readOnly: true
          type: string
        execution_group:
          description: >-
            The slug of the execution group in which the recording rule will be
            evaluated.

            Rules in the same execution group run at intervals. All rules in a
            group must

            complete before the rules in that group run again. Required if
            `bucket_slug`

            isn't set. If both `bucket_slug` and `execution_group` are set,
            their values

            must match.


            Creating too many rules in an execution group can cause delays in
            execution of

            the next iteration. Chronosphere recommends limiting the number of
            rules in an

            execution group to 200-300 maximum.
          type: string
        execution_mode:
          allOf:
            - $ref: '#/components/schemas/RecordingRuleExecutionMode'
          description: >-
            Controls how this rule is assigned to shards for execution.

            When set to SYNCHRONIZED, all rules in the same execution group with

            this mode are assigned to the same shard, which ensures that they
            execute

            together with the same evaluation timestamp.
        interval_secs:
          description: 'Specifies how often to evaluate the recording rule. Default: `60s`.'
          format: int32
          type: integer
        label_policy:
          allOf:
            - $ref: '#/components/schemas/configv1RecordingRuleLabelPolicy'
          description: >-
            Specifies label names to add to the output metric. If you attempt to
            add an

            existing label, the label isn't added. For example, `add
            (instance123:instance)`.
        metric_name:
          description: >-
            The name of the time series to use for the output of
            `prometheus_expr`.

            This value must be a valid metric name. If you don't set this value,

            the output of `prometheus_expr` is output to a time series with a
            name

            defined by the value of `name`.
          type: string
        name:
          description: >-
            The name of the RecordingRule. You can modify this value after the
            RecordingRule is created.
          type: string
        prometheus_expr:
          description: >-
            The PromQL expression to evaluate at the time of each evaluation
            cycle. The

            result is output to a new time series with a name defined by the
            value of

            `metric_name`. If `metric_name` is unset, the result is output to a

            time series defined by the value of `name`.
          type: string
        slug:
          description: >-
            The unique identifier of the RecordingRule. If a `slug` isn't
            provided, one is generated based on the `name` field. You can't
            modify this field after the RecordingRule is created.
          type: string
        updated_at:
          description: >-
            Timestamp of when the RecordingRule was last updated. Cannot be set
            by clients.
          format: date-time
          readOnly: true
          type: string
      required:
        - name
      type: object
    RecordingRuleExecutionMode:
      description: >-
        ExecutionMode controls how a recording rule is assigned to shards for
        execution.

         - EXECUTION_MODE_SYNCHRONIZED: Synchronized: shard rule by execution group, which ensures that all
        synchronized rules in the same group execute on the same shard.
      enum:
        - EXECUTION_MODE_SYNCHRONIZED
      type: string
    configv1RecordingRuleLabelPolicy:
      properties:
        add:
          additionalProperties:
            type: string
          description: A list of labels to add or overwrite before storing the result.
          type: object
      type: object
  securitySchemes:
    ApiKeyAuth:
      description: Chronosphere API token
      in: header
      name: API-Token
      type: apiKey

````