> ## 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.

# List Rules

> Returns a paginated, sorted list of Rules. Defaults to creation date descending.



## OpenAPI

````yaml /openapi/phrase-style-guides.json post /api/v1/rules/search
openapi: 3.1.0
info:
  version: 1.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/search:
    post:
      tags:
        - Rule
      summary: List Rules
      description: >-
        Returns a paginated, sorted list of Rules. Defaults to creation date
        descending.
      operationId: listRules
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ListRulesRequest'
        required: true
      responses:
        '200':
          description: Rules retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RuleListPage'
        '400':
          description: >-
            Invalid request parameters. Error codes: VALIDATION_ERROR,
            INVALID_ARGUMENT.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - Invalid or missing authentication token
        '403':
          description: 'Forbidden - Insufficient permissions. Error codes: ACCESS_DENIED.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ListRulesRequest:
      type: object
      description: Request parameters for listing Rules
      properties:
        pageNumber:
          type: integer
          format: int32
          description: Page number (0-indexed)
          example: 0
          minimum: 0
        pageSize:
          type: integer
          format: int32
          description: Page size (1–100)
          example: 20
          maximum: 100
          minimum: 1
        sortBy:
          type: string
          description: Sort field
          enum:
            - createdAt
            - rule
          example: createdAt
        sortDirection:
          type: string
          description: Sort direction
          enum:
            - ASC
            - DESC
          example: DESC
        contentGroupIds:
          type: array
          description: >-
            Filter by content group IDs (multi-valued). An empty list matches
            all content groups.
          example:
            - cg-marketing-en
          items:
            type: string
            minLength: 1
          maxItems: 50
          minItems: 0
        languages:
          type: array
          description: >-
            Filter by language codes (multi-valued, exact match). An empty list
            matches all languages.
          example:
            - en-GB
          items:
            type: string
            minLength: 1
          maxItems: 50
          minItems: 0
        active:
          type: boolean
          description: Filter by active status.
          example: true
        aiCheckEnabled:
          type: boolean
          description: Filter by AI-check-enabled status.
          example: true
        styleGuideIds:
          type: array
          description: >-
            Filter by Style Guide IDs (multi-valued). Rules not linked to any
            Style Guide are excluded when this filter is set. If omitted or
            empty, this filter is not applied.
          example:
            - 3fa85f64-5717-4562-b3fc-2c963f66afa6
          items:
            type: string
            format: uuid
          maxItems: 50
          minItems: 0
        lastModifiedBy:
          type: array
          description: >-
            Filter by last-modified-by user account IDs (multi-valued). If
            omitted or empty, this filter is not applied.
          example:
            - 5efc4feca115ac0bb5321917
          items:
            type: string
            minLength: 1
          maxItems: 50
          minItems: 0
        ruleText:
          type: string
          description: Filter by rule text (case-insensitive contains match).
          example: Oxford comma
          maxLength: 450
          minLength: 0
    RuleListPage:
      type: object
      description: Paginated list of Rules
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/RuleResponse'
        totalElements:
          type: integer
          format: int64
          description: Total number of rules matching the query
        totalPages:
          type: integer
          format: int32
          description: Total number of pages
        pageNumber:
          type: integer
          format: int32
          description: Current page number (0-indexed)
        pageSize:
          type: integer
          format: int32
          description: Page size
        numberOfElements:
          type: integer
          format: int32
          description: Number of rules in the current page
      required:
        - content
        - numberOfElements
        - pageNumber
        - pageSize
        - totalElements
        - totalPages
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        detail:
          type: string
    RuleResponse:
      type: object
      description: Rule details
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for this Rule
          example: 01900000-0000-7000-8000-000000000001
        rule:
          type: string
          description: The rule text
          example: Avoid passive voice in all user-facing content.
        active:
          type: boolean
          description: Whether this rule is active
        aiCheckEnabled:
          type: boolean
          description: Whether this rule is used during AI-powered quality checks
        allContentGroups:
          type: boolean
          description: Whether this rule applies to all content groups
        allLanguages:
          type: boolean
          description: Whether this rule applies to all languages
        styleGuide:
          $ref: '#/components/schemas/StyleGuideDetails'
          type: 'null'
          description: >-
            Style Guide this rule was extracted from. Null when the rule is
            unlinked — either manually created or subsequently edited.
        contentGroups:
          type:
            - array
            - 'null'
          description: >-
            Content Groups this rule applies to. Empty list means all content
            groups. Null means no content groups are assigned.
          items:
            $ref: '#/components/schemas/ContentGroupDetails'
        languages:
          type:
            - array
            - 'null'
          description: >-
            Language details for languages this rule applies to. Empty list
            means all languages. Null means no languages are assigned.
          items:
            $ref: '#/components/schemas/SupportedLanguageResponse'
        createdAt:
          type: string
          format: date-time
          description: When this rule was created
          example: '2024-01-15T10:30:00Z'
        lastModifiedAt:
          type: string
          format: date-time
          description: When this rule was last modified
          example: '2024-06-01T14:22:00Z'
        createdBy:
          $ref: '#/components/schemas/UserReference'
          type: 'null'
          description: User who created this rule
        lastModifiedBy:
          $ref: '#/components/schemas/UserReference'
          type: 'null'
          description: User who last modified this rule
      required:
        - active
        - aiCheckEnabled
        - allContentGroups
        - allLanguages
        - contentGroups
        - createdAt
        - id
        - languages
        - lastModifiedAt
        - rule
    StyleGuideDetails:
      type: object
      description: Style Guide reference
      properties:
        id:
          type: string
          format: uuid
          description: Style Guide ID
          example: 01900000-0000-7000-8000-000000000002
        name:
          type: string
          description: Style Guide name
          example: English Style Guide
      required:
        - id
        - name
    ContentGroupDetails:
      type: object
      description: Content Group reference
      properties:
        id:
          type: string
          description: Content Group ID
          example: cg-marketing-en
    SupportedLanguageResponse:
      type: object
      description: Supported Style Guide language
      properties:
        bcpCode:
          type: string
          description: Language code in BCP-47 format (more specifically RFC 5646 format)
          example: en-GB
        description:
          type: string
          description: Human-readable language name in English
          example: English (United Kingdom)
        region:
          type: string
          description: Region code, or null if not present
          example: gb
        script:
          type: string
          description: Script code when defined, or null
          enum:
            - ARAB
            - ARMN
            - BENG
            - CANS
            - CYRL
            - DEVA
            - GREK
            - GURU
            - HANG
            - HANS
            - HANT
            - HEBR
            - HMNG
            - JPAN
            - KHMR
            - LAOO
            - LATN
            - MONG
            - MTEI
            - MYMR
            - OLCK
            - ORYA
            - PIQD
            - ROHG
            - SIND
            - SYRC
            - TAML
            - TFNG
            - TELU
          example: LATN
        language:
          type: string
          description: ISO 639-1 language code (e.g., 'cs' from 'cs-CZ')
          example: cs
      required:
        - bcpCode
        - description
        - language
    UserReference:
      type: object
      description: User reference
      properties:
        id:
          type: string
          description: User ID
          example: 01900000-0000-7000-8000-000000000003
  securitySchemes:
    bearerAuth:
      type: http
      description: 'JWT from IDM (Authorization: Bearer <token>)'
      scheme: bearer
      bearerFormat: JWT

````