> ## 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 or disable Rules in bulk

> Enables or disables the listed Rules in a single request. One endpoint handles both
directions via the `active` field, using the same semantics as `active` on `createRule`/
`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`.




## 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 or disable Rules in bulk
      description: >
        Enables or disables the listed Rules in a single request. One endpoint
        handles both

        directions via the `active` field, using the same semantics as `active`
        on `createRule`/

        `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`.
      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. Retry the request. Error codes:
            RULE_ACTIVATION_LOCK_UNAVAILABLE.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    BulkUpdateRulesRequest:
      type: object
      description: Request to bulk-enable or bulk-disable Rules
      properties:
        ruleIds:
          type: array
          description: Rule IDs to enable/disable, 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
      required:
        - active
        - 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_DELETION_FAILED
        errorMessage:
          type: string
          description: Human-readable error message
      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.