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

# Enable, disable, mark critical or unmark critical Rules in bulk

> Enables or disables the listed Rules (`active`), or marks or unmarks them as critical
(`critical`), in a single request. Exactly one of `active` and `critical` must be set; a
request with both or neither is rejected with `400 VALIDATION_ERROR`. Both fields have the
same semantics as on `updateRule`. Partial success is possible; the response reports the
updated count and per-rule failures.

### Enabling (`active=true`)
Rules are enabled in the order given in `ruleIds`. A Rule whose (Content Group, Language)
scope has no room left under the organization's active-rule limit is skipped — reported as
a `RULE_ACTIVE_LIMIT_REACHED` failure — while later Rules with a different scope are still
attempted. This never changes `aiCheckEnabled`, matching `updateRule`'s behavior for an
explicit `active=true` with no `aiCheckEnabled` in the request.

### Disabling (`active=false`)
Every listed Rule is disabled, and `aiCheckEnabled` is forced to `false` on each — AI check
requires an active Rule, the same cascade `updateRule` already applies for a single Rule.

### Consistency guarantee
When `active=true`, the active-rule limit check is atomic across the whole batch: every
Rule in the request is evaluated against a single consistent view of each scope's limit,
the same guarantee `createRule`/`updateRule` provide for a single Rule. If that guarantee
cannot be honored right now, the request fails with `503 RULE_ACTIVATION_LOCK_UNAVAILABLE`
— retry the request. Not applicable when `active=false`.

### Marking critical (`critical=true`)
Rules are marked in the order given in `ruleIds`, in one transaction under the activation
lock; each mark counts toward the next Rule's check. A Rule is skipped when it is inactive
(`RULE_INACTIVE`) or when marking it would exceed the critical-rule limit for one of its
Content Group/Language combinations (`RULE_CRITICAL_LIMIT_REACHED`, with that combination's
`contentGroupId` and `language`, either absent meaning all, and the `limit`). Rules already
critical count as updated and keep their marking time.

### Unmarking critical (`critical=false`)
Every listed critical Rule is unmarked, active or inactive. No lock is taken. Rules already
non-critical count as updated.




## OpenAPI

````yaml /openapi/phrase-style-guides.json patch /api/v1/rules
openapi: 3.1.0
info:
  version: 2.1.0
  title: Style Guide API
  description: REST API for managing Style Guides on the Phrase Platform
  contact:
    name: Linguistic Assets
    email: engineering@phrase.com
servers:
  - url: https://eu.phrase.com/styleguide
    description: Production EU
  - url: https://us.phrase.com/styleguide
    description: Production US
security:
  - bearerAuth: []
tags:
  - name: Style Guide
    description: Public API for managing Style Guides
  - name: Rule
    description: Public API for managing Rules
paths:
  /api/v1/rules:
    patch:
      tags:
        - Rule
      summary: Enable, disable, mark critical or unmark critical Rules in bulk
      description: >
        Enables or disables the listed Rules (`active`), or marks or unmarks
        them as critical

        (`critical`), in a single request. Exactly one of `active` and
        `critical` must be set; a

        request with both or neither is rejected with `400 VALIDATION_ERROR`.
        Both fields have the

        same semantics as on `updateRule`. Partial success is possible; the
        response reports the

        updated count and per-rule failures.


        ### Enabling (`active=true`)

        Rules are enabled in the order given in `ruleIds`. A Rule whose (Content
        Group, Language)

        scope has no room left under the organization's active-rule limit is
        skipped — reported as

        a `RULE_ACTIVE_LIMIT_REACHED` failure — while later Rules with a
        different scope are still

        attempted. This never changes `aiCheckEnabled`, matching `updateRule`'s
        behavior for an

        explicit `active=true` with no `aiCheckEnabled` in the request.


        ### Disabling (`active=false`)

        Every listed Rule is disabled, and `aiCheckEnabled` is forced to `false`
        on each — AI check

        requires an active Rule, the same cascade `updateRule` already applies
        for a single Rule.


        ### Consistency guarantee

        When `active=true`, the active-rule limit check is atomic across the
        whole batch: every

        Rule in the request is evaluated against a single consistent view of
        each scope's limit,

        the same guarantee `createRule`/`updateRule` provide for a single Rule.
        If that guarantee

        cannot be honored right now, the request fails with `503
        RULE_ACTIVATION_LOCK_UNAVAILABLE`

        — retry the request. Not applicable when `active=false`.


        ### Marking critical (`critical=true`)

        Rules are marked in the order given in `ruleIds`, in one transaction
        under the activation

        lock; each mark counts toward the next Rule's check. A Rule is skipped
        when it is inactive

        (`RULE_INACTIVE`) or when marking it would exceed the critical-rule
        limit for one of its

        Content Group/Language combinations (`RULE_CRITICAL_LIMIT_REACHED`, with
        that combination's

        `contentGroupId` and `language`, either absent meaning all, and the
        `limit`). Rules already

        critical count as updated and keep their marking time.


        ### Unmarking critical (`critical=false`)

        Every listed critical Rule is unmarked, active or inactive. No lock is
        taken. Rules already

        non-critical count as updated.
      operationId: bulkUpdateRules
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkUpdateRulesRequest'
        required: true
      responses:
        '200':
          description: Rules updated (partial success possible)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkUpdateRulesResponse'
        '400':
          description: 'Invalid request data. Error codes: VALIDATION_ERROR.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - Invalid or missing authentication token
        '403':
          description: >-
            Forbidden - Insufficient permissions, or one of the requested Rules
            belongs to another organization. Error codes: ACCESS_DENIED.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: >-
            Temporary conflict acquiring the activation lock for this
            organization, or the rule was changed by another request at the same
            time. Retry the request. Error codes:
            RULE_ACTIVATION_LOCK_UNAVAILABLE, CONCURRENT_UPDATE_CONFLICT.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    BulkUpdateRulesRequest:
      type: object
      description: >-
        Request to bulk-update Rules. Exactly one of active or critical must be
        set.
      properties:
        ruleIds:
          type: array
          description: Rule IDs to update, in the order they should be processed
          items:
            type: string
            format: uuid
          maxItems: 50
          minItems: 0
        active:
          type: boolean
          description: >-
            true to enable the listed Rules, false to disable them. Exactly one
            of active or critical must be set.
        critical:
          type: boolean
          description: >-
            true to mark the listed Rules critical, false to unmark them.
            Exactly one of active or critical must be set.
      required:
        - ruleIds
    BulkUpdateRulesResponse:
      type: object
      description: Result of a bulk enable/disable Rules operation
      properties:
        updatedCount:
          type: integer
          format: int32
          description: Number of Rules successfully enabled/disabled
        failures:
          type: array
          description: Rules that could not be enabled/disabled
          items:
            $ref: '#/components/schemas/RuleBulkOperationFailure'
      required:
        - failures
        - updatedCount
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        detail:
          type: string
    RuleBulkOperationFailure:
      type: object
      description: A single Rule that failed within a bulk operation
      properties:
        ruleId:
          type: string
          format: uuid
          description: Rule ID that could not be processed
        errorCode:
          type: string
          description: Error code indicating the failure reason
          enum:
            - RULE_NOT_FOUND
            - RULE_ACTIVE_LIMIT_REACHED
            - RULE_INACTIVE
            - RULE_CRITICAL_LIMIT_REACHED
            - RULE_DELETION_FAILED
        errorMessage:
          type: string
          description: Human-readable error message
        contentGroupId:
          type:
            - string
            - 'null'
          description: >-
            Content Group of the full combination. Only for
            RULE_CRITICAL_LIMIT_REACHED; absent there means all Content Groups.
        language:
          type:
            - string
            - 'null'
          description: >-
            Language of the full combination. Only for
            RULE_CRITICAL_LIMIT_REACHED; absent there means all languages.
          example: de
        limit:
          type:
            - integer
            - 'null'
          format: int32
          description: >-
            Configured maximum number of critical rules per Content Group and
            language. Only for RULE_CRITICAL_LIMIT_REACHED.
          example: 5
      required:
        - errorCode
        - errorMessage
        - ruleId
  securitySchemes:
    bearerAuth:
      type: http
      description: 'JWT from IDM (Authorization: Bearer <token>)'
      scheme: bearer
      bearerFormat: JWT

````

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