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

# Update a rule

> Update a rule.



## OpenAPI

````yaml put /rules/{ruleId}
openapi: 3.0.3
info:
  contact:
    email: support@openlayer.com
    name: Openlayer
    url: https://openlayer.com/
  description: API for interacting with the Openlayer server.
  title: Openlayer API
  version: '1.0'
  x-logo:
    url: https://logo.clearbit.com/openlayer.com
servers:
  - url: https://api.openlayer.com/v1
    description: Our prod backend
security:
  - bearerAuth: []
paths:
  /rules/{ruleId}:
    put:
      tags:
        - Governance
      summary: Update a rule
      description: Update a rule.
      operationId: updateRule
      parameters:
        - $ref: '#/components/parameters/ruleId'
      requestBody:
        description: Only the fields you send are changed.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name: 2f23c303-70ed-43f3-a5f4-892e8ae7ab8a
                description: 89c8631b-1377-4012-ac4a-1faf38ca6406
                renewalCadenceDays: c2f5c5cb-8d7e-4dcb-ac7b-1a8adf2c5a68
                deactivated: cf47c75c-a6d9-475c-a1ba-a8d6f0183ad8
                assigneeId: ed6276a7-bd83-48e8-9389-6c35f31a9a2f
                tagIds: c7a22b66-b34e-4a6c-a765-4ccd6d272d41
      responses:
        '200':
          description: Status OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Rule'
        default:
          $ref: '#/components/responses/UnexpectedError'
      x-codeSamples:
        - lang: python
          source: |
            from openlayer import Openlayer

            client = Openlayer()

            rule = client.governance.rules.update(
                "4a5b6c7d-8e9f-4a0b-9c1d-2e3f4a5b6c7d",
                assignee_id="d4e5f6a7-b8c9-4d0e-8f1a-2b3c4d5e6f7a",
                renewal_cadence_days=180,
            )
            print(rule.renewal_cadence_days)
        - lang: typescript
          source: >
            import Openlayer from 'openlayer';


            const client = new Openlayer();


            const rule = await
            client.governance.rules.update('4a5b6c7d-8e9f-4a0b-9c1d-2e3f4a5b6c7d',
            {
              renewalCadenceDays: 90,
              tagIds: ['3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f'],
            });


            console.log(rule.name);
        - lang: go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openlayer-ai/openlayer-go\"\n)\n\nclient := openlayer.NewClient()\nrule, err := client.Governance.Rules.Update(\n\tcontext.TODO(),\n\t\"4a5b6c7d-8e9f-4a0b-9c1d-2e3f4a5b6c7d\",\n\topenlayer.GovernanceRuleUpdateParams{\n\t\tRenewalCadenceDays: openlayer.Int(30),\n\t\tAssigneeID:         openlayer.F(\"d4e5f6a7-b8c9-4d0e-8f1a-2b3c4d5e6f7a\"),\n\t},\n)\nif err != nil {\n\tpanic(err.Error())\n}\nfmt.Printf(\"%+v\\n\", rule.RenewalCadenceDays)\n"
        - lang: java
          source: >
            import com.openlayer.api.client.OpenlayerClient;

            import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient;

            import com.openlayer.api.models.governance.rules.RuleUpdateParams;

            import com.openlayer.api.models.governance.rules.RuleUpdateResponse;


            OpenlayerClient client = OpenlayerOkHttpClient.fromEnv();


            RuleUpdateParams params = RuleUpdateParams.builder()
                .ruleId("4a5b6c7d-8e9f-4a0b-9c1d-2e3f4a5b6c7d")
                .assigneeId("d4e5f6a7-b8c9-4d0e-8f1a-2b3c4d5e6f7a")
                .renewalCadenceDays(180L)
                .build();
            RuleUpdateResponse rule =
            client.governance().rules().update(params);
        - lang: ruby
          source: |
            require "openlayer"

            openlayer = Openlayer::Client.new(api_key: ENV["OPENLAYER_API_KEY"])

            rule = openlayer.governance.rules.update(
              "4a5b6c7d-8e9f-4a0b-9c1d-2e3f4a5b6c7d",
              name: "Monitoring enabled",
              renewal_cadence_days: 90
            )

            puts(rule)
        - lang: curl
          source: |
            curl --request PUT \
              --url https://api.openlayer.com/v1/rules/7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d \
              --header 'Authorization: Bearer <token>' \
              --header 'Content-Type: application/json' \
              --data '{"deactivated": true}'
components:
  parameters:
    ruleId:
      name: ruleId
      in: path
      description: The rule id.
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    Rule:
      type: object
      description: >
        A single requirement Openlayer tracks. `platform` rules are evaluated
        automatically from the state of your workspace, and `evidence` rules are
        satisfied by attaching evidence. A rule can belong to several
        frameworks, or to none.
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
          description: The rule id.
          example: 7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d
        workspaceId:
          type: string
          format: uuid
          readOnly: true
          description: The id of the workspace the rule belongs to.
        name:
          type: string
          maxLength: 255
          description: The rule name.
          example: Monitoring enabled
        description:
          type: string
          nullable: true
          description: What the rule requires.
          example: Each project must have Openlayer monitoring mode enabled.
        scope:
          type: string
          enum:
            - project
            - workspace
          description: >
            Whether the rule is evaluated once for the whole workspace, or once
            per project the rule's frameworks apply to. Must be `project` for
            platform rules. Fixed once the rule is created.
          example: project
        type:
          type: string
          enum:
            - platform
            - evidence
          description: >
            `platform` rules are evaluated automatically from the state of your
            Openlayer workspace. `evidence` rules are satisfied by attaching
            evidence. Fixed once the rule is created.
          example: platform
        evidenceType:
          type: string
          nullable: true
          enum:
            - document
            - text
            - url
            - categoryValue
            - null
          description: >
            The kind of evidence that satisfies the rule. Set it for evidence
            rules; omit or `null` for platform rules. Fixed once the rule is
            created.
        renewalCadenceDays:
          type: integer
          nullable: true
          minimum: 1
          description: >
            How often evidence must be renewed, in days. Once evidence is older
            than this, the rule result becomes `due_soon` and then `failing`.
            The window restarts whenever evidence is attached. Omit or `null`
            for platform rules.
          example: 90
        automationType:
          type: string
          nullable: true
          description: >
            Which workspace signal a platform rule checks, for example
            `monitoring_mode_enabled`, `test_setup`, or `project_owner_set`. Set
            it for platform rules; omit or `null` for evidence rules. Fixed once
            the rule is created.
          example: monitoring_mode_enabled
        automationParams:
          type: object
          nullable: true
          additionalProperties: true
          description: >
            Configuration for the platform check, when the automation takes
            parameters. Omit or `null` for evidence rules. Fixed once the rule
            is created.
        deactivated:
          type: boolean
          default: false
          description: Whether the rule is excluded from compliance calculations.
        assigneeId:
          type: string
          format: uuid
          nullable: true
          description: The user responsible for satisfying the rule.
        tagIds:
          type: array
          nullable: true
          writeOnly: true
          description: >
            The ids of the rule tags to associate with the rule. Replaces the
            rule's tags. Read them back from `tags`, and list the tags available
            in the workspace with `GET /workspaces/{workspaceId}/rule-tags`.
          items:
            type: string
            format: uuid
        tags:
          type: array
          nullable: true
          readOnly: true
          description: The rule tags associated with the rule.
          items:
            $ref: '#/components/schemas/RuleTag'
        frameworks:
          type: array
          readOnly: true
          description: The frameworks that include this rule.
          items:
            type: object
            required:
              - id
              - name
              - avatar
              - builtInSlug
              - enabled
            properties:
              id: 375f31da-dcc9-420e-b9c5-d63b6bda8c76
              name: 7e080bcf-26a2-4b1e-84ba-fe303e714c01
              avatar: df63df6f-dcf6-46fe-af6f-00a9c24c4d6f
              builtInSlug: b2bda309-05e0-4d3e-b2c8-bc433192e78c
              enabled: 6e2f4260-23ed-4f91-80fd-7d8b97b49be0
        results:
          type: array
          readOnly: true
          description: >
            The rule's results, one per entity the rule is evaluated against.
            Only returned when `includeResults` is `true`.
          items:
            $ref: '#/components/schemas/RuleResult'
        resultsSummary:
          type: object
          nullable: true
          readOnly: true
          description: >
            Pass-rate counts across all of the rule's entities, independent of
            any status filter applied to the request.
          properties:
            passing:
              type: integer
              minimum: 0
            total:
              type: integer
              minimum: 0
        immutable:
          type: boolean
          readOnly: true
          description: >
            Whether the rule is managed by Openlayer. These rules can't be
            renamed or deleted; set `deactivated` to exclude one from compliance
            instead.
        dateCreated:
          type: string
          format: date-time
          readOnly: true
          description: The creation date.
          example: '2026-03-22T11:31:01.185Z'
        dateUpdated:
          type: string
          format: date-time
          readOnly: true
          description: The last update date.
          example: '2026-03-22T11:31:01.185Z'
      required:
        - id
        - workspaceId
        - name
        - scope
        - type
        - dateCreated
        - dateUpdated
    RuleTag:
      type: object
      description: >-
        A label that groups rules across frameworks, for example by team or
        control family.
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
          description: The rule tag id.
          example: 6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e
        workspaceId:
          type: string
          format: uuid
          readOnly: true
          description: The id of the workspace the tag belongs to.
        creatorId:
          type: string
          format: uuid
          nullable: true
          readOnly: true
          description: >-
            The user who created the tag. `null` for tags that ship with
            Openlayer.
        name:
          type: string
          maxLength: 255
          description: The tag name.
          example: Evaluation
        color:
          type: string
          maxLength: 50
          nullable: true
          description: The color the tag is displayed with.
        immutable:
          type: boolean
          default: false
          readOnly: true
          description: >-
            Whether the tag is managed by Openlayer. These tags can't be
            deleted.
        dateCreated:
          type: string
          format: date-time
          readOnly: true
          description: The creation date.
          example: '2026-03-22T11:31:01.185Z'
        dateUpdated:
          type: string
          format: date-time
          readOnly: true
          description: The last update date.
          example: '2026-03-22T11:31:01.185Z'
      required:
        - id
        - workspaceId
        - creatorId
        - name
        - immutable
        - dateCreated
        - dateUpdated
    RuleResult:
      type: object
      description: >
        The compliance status of one rule for one entity: a project for
        project-scoped rules, or the workspace for workspace-scoped rules.
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
          description: The rule result id.
          example: 5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b
        workspaceId:
          type: string
          format: uuid
          readOnly: true
          description: The id of the workspace the rule result belongs to.
        ruleId:
          type: string
          format: uuid
          readOnly: true
          description: The rule this result belongs to.
        projectId:
          type: string
          format: uuid
          nullable: true
          readOnly: true
          description: >-
            The project this result was evaluated for. `null` for
            workspace-scoped rules.
        status:
          type: string
          enum:
            - running
            - passing
            - failing
            - skipped
            - error
            - pending
            - due_soon
          description: >
            The compliance status of the rule for this entity. Computed by
            Openlayer and can't be set directly.
          example: passing
        statusMessage:
          type: string
          nullable: true
          description: A human-readable explanation of the status.
        dateLastEvaluated:
          type: string
          format: date-time
          nullable: true
          readOnly: true
          description: When the rule was last evaluated. Platform rules only.
        dateOfNextEvaluation:
          type: string
          format: date-time
          nullable: true
          readOnly: true
          description: When the rule will next be evaluated. Platform rules only.
        dateOfLatestEvidence:
          type: string
          format: date-time
          nullable: true
          readOnly: true
          description: >-
            When the most recent piece of evidence was attached. Evidence rules
            only.
        dateOfRenewal:
          type: string
          format: date-time
          nullable: true
          readOnly: true
          description: >-
            When the evidence must be renewed. Evidence rules with a renewal
            cadence only.
        deactivated:
          type: boolean
          default: false
          description: >
            Whether this result is excluded from compliance calculations.
            Excludes just this result, without deactivating the rule everywhere.
        deactivatedReason:
          type: string
          nullable: true
          description: >-
            Why the result was excluded. Required when setting `deactivated` to
            `true`.
        assigneeId:
          type: string
          format: uuid
          nullable: true
          description: The user responsible for this result.
        blockedBy:
          type: array
          default: []
          description: Rule results that must pass before this one can be satisfied.
          items:
            type: object
            properties:
              id:
                type: string
                format: uuid
              status: c8d6dae9-615f-4f41-9ec2-c7ddf3c322a0
        blocking:
          type: array
          default: []
          description: Rule results that this one blocks.
          items:
            type: object
            properties:
              id:
                type: string
                format: uuid
              status: c8d6dae9-615f-4f41-9ec2-c7ddf3c322a0
        dateCreated:
          type: string
          format: date-time
          readOnly: true
          description: The creation date.
          example: '2026-03-22T11:31:01.185Z'
        dateUpdated:
          type: string
          format: date-time
          readOnly: true
          description: The last update date.
          example: '2026-03-22T11:31:01.185Z'
      required:
        - id
        - workspaceId
        - ruleId
        - status
        - deactivated
        - dateCreated
        - dateUpdated
  responses:
    UnexpectedError:
      description: Unexpected error.
      content:
        application/json:
          schema:
            type: object
            required:
              - code
              - error
            properties:
              code:
                type: integer
                format: int32
              error:
                type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your workspace API key. See [Find your API
        key](https://www.openlayer.com/docs/workspace-and-projects/find-your-api-key)
        for more information.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.