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

# Interpret one natural-language question as read-only KARE catalogue queries.



## OpenAPI

````yaml /api/rs/openapi.json post /rs/search/v1/query
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/search/v1/query:
    post:
      tags:
        - search
      summary: >-
        Interpret one natural-language question as read-only KARE catalogue
        queries.
      operationId: querySearchRSV1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                query:
                  type: string
                  minLength: 2
                  maxLength: 500
                scope:
                  type: object
                  properties:
                    unitIds:
                      maxItems: 50
                      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)$
                    technicalInstallationIds:
                      maxItems: 50
                      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)$
                  additionalProperties: false
                resolutions:
                  maxItems: 5
                  type: array
                  items:
                    type: object
                    properties:
                      kind:
                        type: string
                        enum:
                          - unit
                          - technical_installation
                          - equipment
                      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:
                      - kind
                      - id
                    additionalProperties: false
                previous:
                  type: object
                  properties:
                    question:
                      type: string
                      minLength: 2
                      maxLength: 500
                    plan: {}
                  required:
                    - question
                    - plan
                  additionalProperties: false
              required:
                - query
              additionalProperties: false
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  answer:
                    oneOf:
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - results
                        required:
                          - kind
                        additionalProperties: false
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - no_results
                        required:
                          - kind
                        additionalProperties: false
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - counts
                        required:
                          - kind
                        additionalProperties: false
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - clarification
                          term:
                            type: string
                            minLength: 1
                        required:
                          - kind
                          - term
                        additionalProperties: false
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - unsupported
                          reason:
                            type: string
                            enum:
                              - mutation
                              - unsupported_analysis
                              - non_kare_request
                              - missing_required_information
                              - unavailable_entity_type
                            description: >-
                              mutation : ordre de créer, modifier, clôturer,
                              archiver, planifier, envoyer ou supprimer ;
                              unsupported_analysis : synthèse, comparaison,
                              tendance, explication, prédiction ou recherche
                              d’une absence (un comptage ou une répartition est
                              un aggregate, pas un refus) ; non_kare_request :
                              demande étrangère aux données KARE ;
                              unavailable_entity_type : type de fiches métier
                              absent du catalogue (factures, devis, bons de
                              commande, attestations) ;
                              missing_required_information : ce, cette, celui-là
                              sans aucun nom ni période.
                        required:
                          - kind
                          - reason
                        additionalProperties: false
                  sections:
                    type: array
                    items:
                      type: object
                      properties:
                        entity:
                          type: string
                          enum:
                            - anomaly
                            - intervention
                            - commission
                            - unit
                            - technical_installation
                            - equipment
                            - building_work
                            - logbook
                            - provider
                            - contact
                            - contract
                            - document
                            - report
                            - routine
                            - member
                            - compliance
                        label:
                          type: string
                          minLength: 1
                        filters:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                                minLength: 1
                              label:
                                type: string
                                minLength: 1
                              value:
                                anyOf:
                                  - type: string
                                  - type: array
                                    items:
                                      type: string
                                  - type: boolean
                                  - type: number
                                  - type: object
                                    properties:
                                      from:
                                        type: string
                                        format: date-time
                                        pattern: >-
                                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                                      to:
                                        type: string
                                        format: date-time
                                        pattern: >-
                                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                                    additionalProperties: false
                              valueLabel:
                                type: string
                                minLength: 1
                            required:
                              - key
                              - label
                              - value
                              - valueLabel
                            additionalProperties: false
                        cards:
                          type: array
                          items:
                            type: object
                            properties:
                              entityType:
                                type: string
                                enum:
                                  - anomaly
                                  - intervention
                                  - commission
                                  - unit
                                  - technical_installation
                                  - equipment
                                  - building_work
                                  - logbook
                                  - provider
                                  - contact
                                  - contract
                                  - document
                                  - report
                                  - routine
                                  - member
                                  - compliance
                              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)$
                              ref:
                                anyOf:
                                  - type: string
                                    maxLength: 40
                                    pattern: ^[A-Z]+-[1-9]\d*(?:-[A-Z]+-[1-9]\d*)*$
                                  - 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)$
                              title:
                                type: string
                                minLength: 1
                                maxLength: 300
                              subtitle:
                                nullable: true
                                type: string
                                maxLength: 240
                              status:
                                nullable: true
                                type: string
                                minLength: 1
                                maxLength: 64
                              interventionType:
                                type: string
                                enum:
                                  - preventive
                                  - curative
                                  - troubleshooting
                                  - audit
                                  - exercise
                                  - session
                                  - qualification
                              lifecycle:
                                type: object
                                properties:
                                  archived:
                                    type: boolean
                                  historized:
                                    type: boolean
                                required:
                                  - archived
                                  - historized
                                additionalProperties: false
                              units:
                                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)$
                                    ref:
                                      type: string
                                      maxLength: 40
                                      pattern: ^[A-Z]+-[1-9]\d*(?:-[A-Z]+-[1-9]\d*)*$
                                    name:
                                      type: string
                                      minLength: 1
                                      maxLength: 150
                                  required:
                                    - id
                                    - ref
                                    - name
                                  additionalProperties: false
                              technicalInstallations:
                                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)$
                                    ref:
                                      type: string
                                      maxLength: 40
                                      pattern: ^[A-Z]+-[1-9]\d*(?:-[A-Z]+-[1-9]\d*)*$
                                    name:
                                      type: string
                                      minLength: 1
                                      maxLength: 150
                                  required:
                                    - id
                                    - ref
                                    - name
                                  additionalProperties: false
                              matchedField:
                                type: string
                                enum:
                                  - ref
                                  - title
                                  - text
                                  - related
                              outsideRequestedScope:
                                type: boolean
                            required:
                              - entityType
                              - id
                              - ref
                              - title
                              - subtitle
                              - status
                              - lifecycle
                              - units
                              - technicalInstallations
                              - matchedField
                              - outsideRequestedScope
                            additionalProperties: false
                        totalCount:
                          type: integer
                          minimum: 0
                          maximum: 9007199254740991
                        hasMore:
                          type: boolean
                        listParams:
                          type: object
                          additionalProperties: {}
                        orderBy:
                          type: object
                          properties:
                            param:
                              type: string
                              minLength: 1
                            direction:
                              type: string
                              enum:
                                - asc
                                - desc
                          required:
                            - param
                            - direction
                          additionalProperties: false
                        aggregate:
                          anyOf:
                            - type: object
                              properties:
                                kind:
                                  type: string
                                  enum:
                                    - count
                                count:
                                  type: integer
                                  minimum: 0
                                  maximum: 9007199254740991
                              required:
                                - kind
                                - count
                              additionalProperties: false
                            - type: object
                              properties:
                                kind:
                                  type: string
                                  enum:
                                    - groupCount
                                by:
                                  type: string
                                  minLength: 1
                                groups:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      value:
                                        type: string
                                      label:
                                        type: string
                                      count:
                                        type: integer
                                        minimum: 0
                                        maximum: 9007199254740991
                                    required:
                                      - value
                                      - label
                                      - count
                                    additionalProperties: false
                              required:
                                - kind
                                - by
                                - groups
                              additionalProperties: false
                        unavailable:
                          type: string
                          enum:
                            - forbidden
                      required:
                        - entity
                        - label
                        - filters
                        - cards
                        - totalCount
                        - hasMore
                        - listParams
                      additionalProperties: false
                  plan: {}
                  clarification:
                    type: object
                    properties:
                      kind:
                        type: string
                        enum:
                          - unit
                          - technical_installation
                          - equipment
                      candidates:
                        maxItems: 5
                        type: array
                        items:
                          type: object
                          properties:
                            entityType:
                              type: string
                              enum:
                                - anomaly
                                - intervention
                                - commission
                                - unit
                                - technical_installation
                                - equipment
                                - building_work
                                - logbook
                                - provider
                                - contact
                                - contract
                                - document
                                - report
                                - routine
                                - member
                                - compliance
                            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)$
                            ref:
                              anyOf:
                                - type: string
                                  maxLength: 40
                                  pattern: ^[A-Z]+-[1-9]\d*(?:-[A-Z]+-[1-9]\d*)*$
                                - 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)$
                            title:
                              type: string
                              minLength: 1
                              maxLength: 300
                            subtitle:
                              nullable: true
                              type: string
                              maxLength: 240
                            status:
                              nullable: true
                              type: string
                              minLength: 1
                              maxLength: 64
                            interventionType:
                              type: string
                              enum:
                                - preventive
                                - curative
                                - troubleshooting
                                - audit
                                - exercise
                                - session
                                - qualification
                            lifecycle:
                              type: object
                              properties:
                                archived:
                                  type: boolean
                                historized:
                                  type: boolean
                              required:
                                - archived
                                - historized
                              additionalProperties: false
                            units:
                              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)$
                                  ref:
                                    type: string
                                    maxLength: 40
                                    pattern: ^[A-Z]+-[1-9]\d*(?:-[A-Z]+-[1-9]\d*)*$
                                  name:
                                    type: string
                                    minLength: 1
                                    maxLength: 150
                                required:
                                  - id
                                  - ref
                                  - name
                                additionalProperties: false
                            technicalInstallations:
                              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)$
                                  ref:
                                    type: string
                                    maxLength: 40
                                    pattern: ^[A-Z]+-[1-9]\d*(?:-[A-Z]+-[1-9]\d*)*$
                                  name:
                                    type: string
                                    minLength: 1
                                    maxLength: 150
                                required:
                                  - id
                                  - ref
                                  - name
                                additionalProperties: false
                            matchedField:
                              type: string
                              enum:
                                - ref
                                - title
                                - text
                                - related
                            outsideRequestedScope:
                              type: boolean
                          required:
                            - entityType
                            - id
                            - ref
                            - title
                            - subtitle
                            - status
                            - lifecycle
                            - units
                            - technicalInstallations
                            - matchedField
                            - outsideRequestedScope
                          additionalProperties: false
                    required:
                      - kind
                      - candidates
                    additionalProperties: false
                  degraded:
                    type: boolean
                required:
                  - answer
                  - sections
                  - plan
                  - degraded
                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
        '403':
          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
        '429':
          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
        '502':
          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

````