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

# Get Client Rules

> Returns all worker matching rules for a specific client, grouped by category (fields, credentials, has_tags, does_not_have_tags).



## OpenAPI

````yaml api-reference/v01.12.00/openapi-v01.12.00.json GET /clients/{id}/rules
openapi: 3.0.0
info:
  title: Roosted
  version: 0.1.12
  contact:
    name: Support
    url: https://support.roostedhr.com/support/home
    email: support@roostedhr.com
  description: |-
    Enterprise API

    Sandbox keys and Production keys are requested from support
servers:
  - url: https://api.roostedhr.com/api/1_12
  - url: https://sandbox.roostedhr.com/api/1_12
security:
  - X-API-KEY: []
tags:
  - name: Announcements
  - name: Areas
  - name: Clients
  - name: Company
  - name: Configuration
  - name: Events
  - name: Locations
  - name: Payroll Groups
  - name: Rate Cards
  - name: Shifts
  - name: Skillsets
  - name: Time Tracking
  - name: Wage Rules
  - name: Workers
paths:
  /clients/{id}/rules:
    parameters:
      - schema:
          type: string
        name: id
        in: path
        required: true
        description: Client ID
    get:
      tags:
        - Clients
      summary: Get Client Rules
      description: >-
        Returns all worker matching rules for a specific client, grouped by
        category (fields, credentials, has_tags, does_not_have_tags).
      operationId: get-client-rules
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  fields:
                    type: array
                    description: Rules based on custom fields.
                    items:
                      $ref: '#/components/schemas/ClientRule'
                  credentials:
                    type: array
                    description: Rules based on credentials.
                    items:
                      $ref: '#/components/schemas/ClientRule'
                  has_tags:
                    type: array
                    description: Rules requiring specific tags.
                    items:
                      $ref: '#/components/schemas/ClientRule'
                  does_not_have_tags:
                    type: array
                    description: Rules excluding specific tags.
                    items:
                      $ref: '#/components/schemas/ClientRule'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Missing field_id:
                  value:
                    code: CLI-1300
                    error: Rule field_id is required
                Missing operator:
                  value:
                    code: CLI-1400
                    error: Rule operator is required
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Invalid API key:
                  value:
                    code: ATH-100
                    error: Invalid or missing API key
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Not found:
                  value:
                    code: CLI-300
                    error: Client not found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Unexpected error:
                  value:
                    code: CLI-2000
                    error: An unexpected error occurred
components:
  schemas:
    ClientRule:
      title: ClientRule
      type: object
      description: >-
        A worker matching rule for a client, composed of field conditions,
        credential requirements, and tag filters.
      properties:
        fields:
          type: array
          items:
            $ref: '#/components/schemas/ClientRuleField'
        credentials:
          type: array
          items:
            $ref: '#/components/schemas/ClientRuleCredential'
        has_tags:
          type: array
          items:
            $ref: '#/components/schemas/ClientRuleTag'
        does_not_have_tags:
          type: array
          items:
            $ref: '#/components/schemas/ClientRuleTag'
    ClientRuleField:
      title: ClientRuleField
      type: object
      properties:
        id:
          type: string
          description: Rule field entry ID.
        field_id:
          type: string
          description: Custom field ID.
        field_type:
          type: string
          description: Field type (e.g., dropdown, text).
        field_name:
          type: string
          description: Field display name.
        operator:
          type: string
          description: Comparison operator (e.g., is, is not).
        answers:
          type: array
          nullable: true
          items:
            type: object
            properties:
              id:
                type: string
              display:
                type: string
        value:
          type: string
          nullable: true
          description: Selected value.
    ClientRuleCredential:
      title: ClientRuleCredential
      type: object
      properties:
        id:
          type: string
          description: Rule credential entry ID.
        credentials_id:
          type: string
          description: Credential definition ID.
        field_id:
          type: string
          nullable: true
        field_type:
          type: string
          nullable: true
        field_name:
          type: string
          nullable: true
        name:
          type: string
          description: Credential name.
        operator:
          type: string
          description: Comparison operator (e.g., has, does not have).
        answers:
          type: array
          nullable: true
          items:
            type: object
            properties:
              id:
                type: string
              display:
                type: string
        value:
          type: string
          nullable: true
    ClientRuleTag:
      title: ClientRuleTag
      type: object
      properties:
        rule_id:
          type: string
          description: Parent rule ID.
        id:
          type: string
          description: Tag ID.
        text:
          type: string
          description: Tag display text.
        operator:
          type: string
          description: Tag match operator (e.g., has, does not have).
  securitySchemes:
    X-API-KEY:
      name: X-API-KEY
      type: apiKey
      in: header

````