> ## 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 building works (paginated/filterable)



## OpenAPI

````yaml /api/rs/openapi.json get /rs/building-works/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:
  /rs/building-works/v1/:
    get:
      tags:
        - building-works
      summary: List building works (paginated/filterable)
      operationId: listBuildingWorksRSV1
      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:
                - units
                - commission
                - created-by
                - documents-stats
                - actions-info
                - updatable-fields
              description: >-
                Extend options (JSON-encoded array, e.g.
                `?extend=["category"]`):

                - "units": Adds `units` (the active units each building work
                targets).

                - "commission": Adds `commission` (the most recently held safety
                commission, or null).

                - "created-by": Adds the building work author (`createdByUser`
                with display name).

                - "documents-stats": Adds `documentsStats` (count of active
                documents attached to the work, and the distinct document types
                present).

                - "actions-info": Projects `{ canBeUpdated, canBeArchived,
                canBeUnarchived, canBeDeleted }`.

                - "updatable-fields": Per-field write rules for each building
                work in its current state.
          in: query
          name: extend
          required: false
        - schema:
            type: array
            items:
              type: object
              properties:
                field:
                  type: string
                  enum:
                    - ref
                    - status
                    - authorizationNumber
                    - contractorName
                    - supervisingTechnicianName
                    - architectName
                    - startAt
                    - endAt
                    - receivedAt
                    - createdAt
                    - updatedAt
                  description: >-
                    OrderBy options (JSON-encoded array, e.g.
                    `?orderBy=[{"field":"name","direction":"asc"}]`):

                    - "ref": Order by ref.

                    - "status": Order by status.

                    - "authorizationNumber": Order by authorization number.

                    - "contractorName": Order by contractor name.

                    - "supervisingTechnicianName": Order by supervising
                    technician name.

                    - "architectName": Order by architect name.

                    - "startAt": Order by work start date.

                    - "endAt": Order by work end date.

                    - "receivedAt": Order by reception date.

                    - "createdAt": Order by creation date.

                    - "updatedAt": Order by last-update date.
                direction:
                  type: string
                  enum:
                    - asc
                    - desc
                  description: Sort direction
                  example: asc
              required:
                - field
                - direction
          in: query
          name: orderBy
          required: false
        - 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: whereIds
          required: false
          description: Filter by one or more building work ids.
        - schema:
            type: string
            maxLength: 200
            example: lobby
          in: query
          name: whereSearch
          required: false
          description: >-
            Case-insensitive search across ref, authorization number, work
            nature, contractor name, supervising technician name and architect
            name.
        - schema:
            type: array
            items:
              type: string
            example:
              - rejected
              - pending
          in: query
          name: whereStatus
          required: false
          description: Filter by one or more building work statuses.
        - 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: whereUnitIds
          required: false
          description: Filter by one or more unit ids the building work targets.
        - 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: whereCreatedById
          required: false
          description: Filter by one or more author user ids.
        - schema:
            anyOf:
              - type: boolean
              - type: string
            example: true
          in: query
          name: whereArchived
          required: false
          description: When `true`, only archived; when `false`, only non-archived.
        - 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: whereStartAt
          required: false
          description: Filter by the work start 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: whereEndAt
          required: false
          description: Filter by the work end 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: whereReceivedAt
          required: false
          description: Filter by the reception 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: whereCreatedAt
          required: false
          description: Filter by creation date range.
        - schema:
            anyOf:
              - type: boolean
              - type: string
            example: true
          in: query
          name: whereIncludeDeleted
          required: false
          description: When `true`, also returns soft-deleted building works.
      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)$
                        ref:
                          type: string
                          maxLength: 40
                          pattern: ^[A-Z]+-[1-9]\d*(?:-[A-Z]+-[1-9]\d*)*$
                        authorizationNumber:
                          type: string
                          minLength: 1
                          maxLength: 200
                        status:
                          type: string
                          enum:
                            - rejected
                            - pending
                            - approved
                            - partially_received
                            - received
                        description:
                          nullable: true
                          type: string
                          maxLength: 2000
                        workNature:
                          nullable: true
                          type: string
                          maxLength: 200
                        contractorName:
                          nullable: true
                          type: string
                          maxLength: 200
                        supervisingTechnicianName:
                          nullable: true
                          type: string
                          maxLength: 200
                        architectName:
                          nullable: true
                          type: string
                          maxLength: 200
                        receivedAt:
                          nullable: true
                          type: string
                          format: date-time
                        startAt:
                          nullable: true
                          type: string
                          format: date-time
                        endAt:
                          nullable: true
                          type: string
                          format: date-time
                        archivedAt:
                          nullable: true
                          type: string
                          format: date-time
                        deletedAt:
                          nullable: true
                          type: string
                          format: date-time
                        createdAt:
                          type: string
                          format: date-time
                        updatedAt:
                          type: string
                          format: date-time
                        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
                        commission:
                          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)$
                            ref:
                              type: string
                              maxLength: 40
                              pattern: ^[A-Z]+-[1-9]\d*(?:-[A-Z]+-[1-9]\d*)*$
                            visitType:
                              type: string
                              enum:
                                - vc
                                - vr
                                - vp
                                - vrp
                            status:
                              type: string
                              enum:
                                - to_schedule
                                - scheduled
                                - in_progress
                                - pending
                                - completed
                                - late
                            decision:
                              nullable: true
                              type: string
                              enum:
                                - favorable
                                - unfavorable
                                - no_opinion
                                - not_provided
                            heldAt:
                              nullable: true
                              type: string
                              format: date-time
                          required:
                            - id
                            - ref
                            - visitType
                            - status
                            - decision
                            - heldAt
                          additionalProperties: false
                        createdByUser:
                          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
                          required:
                            - id
                            - name
                          additionalProperties: false
                        documentsStats:
                          type: object
                          properties:
                            total:
                              type: integer
                              minimum: 0
                              maximum: 9007199254740991
                            types:
                              type: array
                              items:
                                type: string
                                enum:
                                  - cerfa
                                  - security_notice
                                  - plan
                                  - fire_safety_instructions
                                  - evacuation_plan
                                  - intervention_plan
                                  - bl
                                  - invoice
                                  - quote
                                  - schema
                                  - pv
                                  - rvre
                                  - cr
                                  - contract
                                  - other
                          required:
                            - total
                            - types
                          additionalProperties: false
                        actions:
                          type: object
                          properties:
                            canBeUpdated:
                              type: boolean
                            canBeReceived:
                              type: boolean
                            canBeArchived:
                              type: boolean
                            canBeUnarchived:
                              type: boolean
                            canBeDeleted:
                              type: boolean
                          required:
                            - canBeUpdated
                            - canBeReceived
                            - canBeArchived
                            - canBeUnarchived
                            - canBeDeleted
                          additionalProperties: false
                        updatableFields:
                          type: object
                          properties:
                            authorizationNumber:
                              type: boolean
                            status:
                              type: boolean
                            description:
                              type: boolean
                            workNature:
                              type: boolean
                            contractorName:
                              type: boolean
                            supervisingTechnicianName:
                              type: boolean
                            architectName:
                              type: boolean
                            startAt:
                              type: boolean
                            endAt:
                              type: boolean
                            unitIds:
                              type: boolean
                          required:
                            - authorizationNumber
                            - status
                            - description
                            - workNature
                            - contractorName
                            - supervisingTechnicianName
                            - architectName
                            - startAt
                            - endAt
                            - unitIds
                          additionalProperties: false
                      required:
                        - id
                        - ref
                        - authorizationNumber
                        - status
                        - description
                        - workNature
                        - contractorName
                        - supervisingTechnicianName
                        - architectName
                        - receivedAt
                        - startAt
                        - endAt
                        - archivedAt
                        - deletedAt
                        - 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

````