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

# Create a preventive rule



## OpenAPI

````yaml /api/rs/openapi.json post /rs/rules/v1/preventive
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:
  /rs/rules/v1/preventive:
    post:
      tags:
        - rules
      summary: Create a preventive rule
      operationId: createPreventiveRuleRSV1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 200
                description:
                  type: string
                  maxLength: 2000
                workflowType:
                  type: string
                  enum:
                    - calendar
                    - regulatory
                complianceType:
                  type: string
                  enum:
                    - registry
                    - maintenance
                rrule:
                  type: string
                  minLength: 1
                  maxLength: 500
                links:
                  type: object
                  additionalProperties: {}
                providerTypes:
                  default: []
                  type: array
                  items:
                    type: string
                    enum:
                      - qualified_technician
                      - approved_organization
                      - training_provider
                siteScopes:
                  default: []
                  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
                equipmentScopes:
                  default: []
                  type: array
                  items:
                    type: object
                    properties:
                      specificationValueIds:
                        minItems: 1
                        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)$
                    required:
                      - specificationValueIds
                formTemplateId:
                  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)$
                technicalInstallationIds:
                  minItems: 1
                  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)$
              required:
                - name
                - workflowType
                - complianceType
                - rrule
                - technicalInstallationIds
      responses:
        '201':
          description: Default Response
          content:
            application/json:
              schema:
                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)$
                required:
                  - id
                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

````