> ## Documentation Index
> Fetch the complete documentation index at: https://api-documentation.kare-app.fr/llms.txt
> Use this file to discover all available pages before exploring further.

# List library rules (BO)



## OpenAPI

````yaml /api/bo/openapi.json get /bo/library-rules/v1/
openapi: 3.0.3
info:
  title: KARE API
  description: Backend API for the KARE platform
  version: dev
servers:
  - url: http://localhost:3000
    description: Local dev
security: []
tags:
  - name: better-auth
    description: >-
      Better Auth's own endpoints (sign-in, session, MFA, password) - generated
      from the audience's live config via `generateOpenAPISchema()`, not
      hand-written.
paths:
  /bo/library-rules/v1/:
    get:
      tags:
        - library-rules
      summary: List library rules (BO)
      operationId: listLibraryRulesBOV1
      parameters:
        - schema:
            default: 1
            type: integer
            minimum: 0
            exclusiveMinimum: true
            maximum: 9007199254740991
          in: query
          name: page
          required: false
        - schema:
            default: 50
            type: integer
            minimum: 0
            exclusiveMinimum: true
            maximum: 1000
          in: query
          name: pageSize
          required: false
        - schema:
            example: true
            anyOf:
              - type: boolean
          in: query
          name: countOnly
          required: false
          description: >-
            When true, answers `totalCount` with an empty `data`: the rows are
            never read, so no extend is selected and no transform runs. For a
            badge or a counter.
        - schema:
            type: array
            items:
              type: string
              enum:
                - technical-installations
                - created-by
                - counts
                - actions-info
              description: >-
                Extend options (JSON-encoded array, e.g.
                `?extend=["category"]`):

                - "technical-installations": Include the linked library
                technical installations (id, nameFr/nameEn/nameDe) - preventive
                only.

                - "created-by": Adds `createdByBoUser` { id, name, email } (the
                BO admin who created it).

                - "counts": Adds `_count.instances` (active organization
                instances adopted from this rule).

                - "actions-info": Projects `{ canBeUpdated, canBeArchived,
                canBeUnarchived, canBeDeleted }`.
          in: query
          name: extend
          required: false
        - schema:
            type: array
            items:
              type: object
              properties:
                field:
                  type: string
                  enum:
                    - name
                    - createdAt
                    - updatedAt
                    - version
                  description: >-
                    OrderBy options (JSON-encoded array, e.g.
                    `?orderBy=[{"field":"name","direction":"asc"}]`):

                    - "name": Order by name.

                    - "createdAt": Order by creation date.

                    - "updatedAt": Order by last-update date.

                    - "version": Order by version.
                direction:
                  type: string
                  enum:
                    - asc
                    - desc
                  description: Sort direction
                  example: asc
              required:
                - field
                - direction
          in: query
          name: orderBy
          required: false
        - schema:
            type: string
            maxLength: 200
            example: lobby
          in: query
          name: whereSearch
          required: false
          description: Case-insensitive partial match on the library rule name.
        - schema:
            type: array
            items:
              type: string
            example:
              - preventive
              - training_session
          in: query
          name: whereType
          required: false
          description: Filter by one or more rule types.
        - schema:
            type: array
            items:
              type: string
            example:
              - calendar
              - regulatory
          in: query
          name: whereWorkflowType
          required: false
          description: Filter by one or more workflow types (calendar, regulatory).
        - schema:
            type: array
            items:
              type: string
            example:
              - registry
              - maintenance
          in: query
          name: whereComplianceType
          required: false
          description: Filter by one or more compliance types (registry, maintenance).
        - schema:
            anyOf:
              - type: boolean
              - type: string
            example: true
          in: query
          name: whereArchived
          required: false
          description: >-
            When `true`, only archived library rules; when `false`, only
            non-archived.
        - schema:
            type: array
            items:
              type: string
            example:
              - qualified_technician
              - approved_organization
          in: query
          name: whereProviderType
          required: false
          description: Filter by library rules concerning any of the given provider types.
        - schema:
            maxItems: 250
            type: array
            items:
              type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            example:
              - 550e8400-e29b-41d4-a716-446655440000
              - 6ba7b810-9dad-11d1-80b4-00c04fd430c8
          in: query
          name: whereTechnicalInstallationIds
          required: false
          description: >-
            Narrow to library rules linked to any of the given library technical
            installations.
        - schema:
            anyOf:
              - type: object
                properties:
                  start:
                    type: string
                  end:
                    type: string
              - type: object
                properties:
                  gte:
                    type: string
                  lte:
                    type: string
            example:
              start: '2026-01-01'
              end: '2026-01-31'
          in: query
          name: whereCreatedAt
          required: false
          description: Filter by creation date range.
        - schema:
            anyOf:
              - type: object
                properties:
                  start:
                    type: string
                  end:
                    type: string
              - type: object
                properties:
                  gte:
                    type: string
                  lte:
                    type: string
            example:
              start: '2026-01-01'
              end: '2026-01-31'
          in: query
          name: whereUpdatedAt
          required: false
          description: Filter by last-update date range.
        - schema:
            anyOf:
              - type: boolean
              - type: string
            example: true
          in: query
          name: whereIncludeDeleted
          required: false
          description: When `true`, also returns soft-deleted library rules.
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                          pattern: >-
                            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                        version:
                          type: integer
                          minimum: 0
                          exclusiveMinimum: true
                          maximum: 9007199254740991
                        name:
                          type: string
                          minLength: 1
                          maxLength: 200
                        description:
                          nullable: true
                          type: string
                          maxLength: 2000
                        type:
                          type: string
                          enum:
                            - preventive
                            - training_session
                            - training_exercise
                            - training_qualification
                        workflowType:
                          type: string
                          enum:
                            - calendar
                            - regulatory
                        complianceType:
                          type: string
                          enum:
                            - registry
                            - maintenance
                        rrule:
                          nullable: true
                          type: string
                          minLength: 1
                          maxLength: 500
                        rruleGap:
                          nullable: true
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        validityDuration:
                          nullable: true
                          type: string
                          pattern: >-
                            ^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$
                        thresholdPercent:
                          nullable: true
                          type: integer
                          minimum: 0
                          maximum: 100
                        links:
                          nullable: true
                          type: object
                          additionalProperties: {}
                        providerTypes:
                          type: array
                          items:
                            type: string
                            enum:
                              - qualified_technician
                              - approved_organization
                              - training_provider
                        siteScopes:
                          type: array
                          items:
                            type: object
                            properties:
                              classifications:
                                type: array
                                items:
                                  type: string
                                  enum:
                                    - erp
                                    - ert
                                    - igh
                                    - icpe
                                    - hab
                                    - other
                              categories:
                                type: array
                                items:
                                  type: string
                                  enum:
                                    - '1'
                                    - '2'
                                    - '3'
                                    - '4'
                                    - '5'
                              activityTypes:
                                type: array
                                items:
                                  type: string
                                  enum:
                                    - J
                                    - L
                                    - M
                                    - 'N'
                                    - O
                                    - P
                                    - R
                                    - S
                                    - T
                                    - U
                                    - V
                                    - W
                                    - X
                                    - 'Y'
                                    - PA
                                    - CTS
                                    - SG
                                    - OA
                                    - REF
                                    - PS
                                    - GHA
                                    - GHO
                                    - GHR
                                    - GHS
                                    - GHTC
                                    - GHU
                                    - GHW1
                                    - GHW2
                                    - GHZ
                                    - ITGH
                              privateCapacity:
                                type: object
                                properties:
                                  operator:
                                    type: string
                                    enum:
                                      - '>'
                                      - '>='
                                      - <
                                      - <=
                                      - '='
                                  value:
                                    type: integer
                                    minimum: 0
                                    maximum: 9007199254740991
                                required:
                                  - operator
                                  - value
                                additionalProperties: false
                            additionalProperties: false
                        mainLibraryTechnicalInstallationId:
                          nullable: true
                          type: string
                          format: uuid
                          pattern: >-
                            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                        createdByBoUserId:
                          nullable: true
                          type: string
                          format: uuid
                          pattern: >-
                            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                        archivedAt:
                          nullable: true
                          type: string
                          format: date-time
                        createdAt:
                          type: string
                          format: date-time
                        updatedAt:
                          type: string
                          format: date-time
                        libraryTechnicalInstallations:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                format: uuid
                                pattern: >-
                                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                              nameFr:
                                type: string
                                minLength: 1
                                maxLength: 150
                              nameEn:
                                type: string
                                minLength: 1
                                maxLength: 150
                              nameDe:
                                type: string
                                minLength: 1
                                maxLength: 150
                            required:
                              - id
                              - nameFr
                              - nameEn
                              - nameDe
                            additionalProperties: false
                        createdByBoUser:
                          nullable: true
                          type: object
                          properties:
                            id:
                              type: string
                              format: uuid
                              pattern: >-
                                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                            name:
                              type: string
                            email:
                              type: string
                          required:
                            - id
                            - name
                            - email
                          additionalProperties: false
                        _count:
                          type: object
                          properties:
                            instances:
                              type: integer
                              minimum: 0
                              maximum: 9007199254740991
                          required:
                            - instances
                          additionalProperties: false
                        actions:
                          type: object
                          properties:
                            canBeUpdated:
                              type: boolean
                            canBeArchived:
                              type: boolean
                            canBeUnarchived:
                              type: boolean
                            canBeDeleted:
                              type: boolean
                          required:
                            - canBeUpdated
                            - canBeArchived
                            - canBeUnarchived
                            - canBeDeleted
                          additionalProperties: false
                      required:
                        - id
                        - version
                        - name
                        - description
                        - type
                        - workflowType
                        - complianceType
                        - rrule
                        - rruleGap
                        - validityDuration
                        - thresholdPercent
                        - links
                        - providerTypes
                        - siteScopes
                        - mainLibraryTechnicalInstallationId
                        - createdByBoUserId
                        - archivedAt
                        - createdAt
                        - updatedAt
                      additionalProperties: false
                  totalCount:
                    type: integer
                    minimum: 0
                    maximum: 9007199254740991
                  pagination:
                    type: object
                    properties:
                      page:
                        type: integer
                        minimum: 0
                        exclusiveMinimum: true
                        maximum: 9007199254740991
                      pageSize:
                        type: integer
                        minimum: 0
                        exclusiveMinimum: true
                        maximum: 9007199254740991
                      totalPages:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                    required:
                      - page
                      - pageSize
                      - totalPages
                    additionalProperties: false
                required:
                  - data
                  - totalCount
                  - pagination
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  requestId:
                    type: string
                  details: {}
                required:
                  - error
                  - message
                  - requestId
                additionalProperties: false
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  requestId:
                    type: string
                  details: {}
                required:
                  - error
                  - message
                  - requestId
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  requestId:
                    type: string
                  details: {}
                required:
                  - error
                  - message
                  - requestId
                additionalProperties: false

````