> ## 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 units (parents and children), flat and filterable



## OpenAPI

````yaml /api/rs/openapi.json get /rs/units/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/units/v1/:
    get:
      tags:
        - units
      summary: List units (parents and children), flat and filterable
      operationId: listUnitsRSV1
      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:
                - actions-info
                - updatable-fields
                - tags
                - position
                - qrcode
                - responsibles
                - created-by
              description: >-
                Extend options (JSON-encoded array, e.g.
                `?extend=["category"]`):

                - "actions-info": Projects `{ canBeUpdated }` per row for the
                current viewer.

                - "updatable-fields": Per-field write rules per row in its
                current state.

                - "tags": Each unit's tags with their tag type.

                - "position": Structural context under each unit: buildings →
                plans → plan items.

                - "qrcode": Sticker scan URL for the QR code linked to each unit
                (null when none).

                - "responsibles": Adds `responsibles` - the users responsible
                for this element.

                - "created-by": Adds `createdBy` (the user who created each
                unit), null when unknown.
          in: query
          name: extend
          required: false
        - schema:
            type: array
            items:
              type: object
              properties:
                field:
                  type: string
                  enum:
                    - name
                    - serialNumber
                    - createdAt
                    - updatedAt
                  description: >-
                    OrderBy options (JSON-encoded array, e.g.
                    `?orderBy=[{"field":"name","direction":"asc"}]`):

                    - "name": Order by unit name.

                    - "serialNumber": Order by serial number.

                    - "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: whereUnitIds
          required: false
          description: Narrow the result to the requested unit ids.
        - 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: whereITIds
          required: false
          description: >-
            Narrow the result to units linked to the requested technical
            installations.
        - schema:
            type: array
            items:
              type: string
            example:
              - parent
              - child
          in: query
          name: whereType
          required: false
          description: Filter by sub-type (parent, child).
        - schema:
            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)$
          in: query
          name: whereParentId
          required: false
          description: Filter child units by their parent unit's id.
        - schema:
            type: string
            maxLength: 200
            example: lobby
          in: query
          name: whereName
          required: false
          description: Case-insensitive partial match on the unit name.
        - schema:
            type: string
            maxLength: 200
            example: lobby
          in: query
          name: whereSerialNumber
          required: false
          description: Case-insensitive partial match on the serial number.
        - schema:
            type: string
            maxLength: 200
            example: lobby
          in: query
          name: whereText
          required: false
          description: Free-text search across name and serial number.
        - 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: whereTags
          required: false
          description: Units carrying at least one of the given tag ids.
        - schema:
            anyOf:
              - type: boolean
              - type: string
            example: true
          in: query
          name: whereImResponsible
          required: false
          description: >-
            When `true`, restricts to units the current user is responsible for.
            A responsibility names one unit: it does not cascade to child units.
            Narrows the caller’s visibility scope, never widens it.
      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*)*$
                        type:
                          type: string
                          enum:
                            - parent
                            - child
                        name:
                          type: string
                          minLength: 1
                          maxLength: 150
                        description:
                          nullable: true
                          type: string
                          maxLength: 1000
                        serialNumber:
                          nullable: true
                          type: string
                          minLength: 1
                          maxLength: 20
                        openedAt:
                          nullable: true
                          type: string
                          format: date-time
                        logo:
                          nullable: true
                          type: object
                          properties:
                            name:
                              type: string
                              minLength: 1
                              maxLength: 255
                            mimeType:
                              type: string
                              minLength: 1
                              maxLength: 100
                            size:
                              type: integer
                              minimum: 0
                              exclusiveMinimum: true
                              maximum: 1073741824
                            storageKey:
                              type: string
                              minLength: 1
                              maxLength: 512
                          required:
                            - name
                            - mimeType
                            - size
                            - storageKey
                          additionalProperties: false
                        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
                        classifications:
                          type: array
                          items:
                            type: string
                            enum:
                              - erp
                              - ert
                              - igh
                              - icpe
                              - hab
                              - other
                        totalSurfaceArea:
                          nullable: true
                          type: integer
                          minimum: 0
                          exclusiveMinimum: true
                          maximum: 9007199254740991
                        publicCapacity:
                          nullable: true
                          type: integer
                          minimum: 0
                          maximum: 9007199254740991
                        privateCapacity:
                          nullable: true
                          type: integer
                          minimum: 0
                          maximum: 9007199254740991
                        pinCode:
                          type: string
                          pattern: ^\d{6}$
                        pinCodeRequired:
                          type: boolean
                        accessInstructions:
                          nullable: true
                          type: string
                          maxLength: 1000
                        organizationId:
                          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)$
                        createdByUserId:
                          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)$
                        addressCountry:
                          nullable: true
                          type: string
                          minLength: 1
                          maxLength: 200
                        addressCity:
                          nullable: true
                          type: string
                          minLength: 1
                          maxLength: 200
                        addressPostalCode:
                          nullable: true
                          type: string
                          minLength: 1
                          maxLength: 20
                        addressStreet:
                          nullable: true
                          type: string
                          minLength: 1
                          maxLength: 200
                        category:
                          nullable: true
                          type: string
                          enum:
                            - '1'
                            - '2'
                            - '3'
                            - '4'
                            - '5'
                        commissionPeriodicityYears:
                          nullable: true
                          anyOf:
                            - type: number
                              enum:
                                - 3
                            - type: number
                              enum:
                                - 5
                        parentId:
                          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)$
                        sortOrder:
                          nullable: true
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        createdAt:
                          type: string
                          format: date-time
                        updatedAt:
                          type: string
                          format: date-time
                        actions:
                          type: object
                          properties:
                            canBeUpdated:
                              type: boolean
                          required:
                            - canBeUpdated
                          additionalProperties: false
                        updatableFields:
                          type: object
                          properties:
                            name:
                              type: boolean
                            description:
                              type: boolean
                            serialNumber:
                              type: boolean
                            openedAt:
                              type: boolean
                            accessInstructions:
                              type: boolean
                            activityTypes:
                              type: boolean
                            classifications:
                              type: boolean
                            totalSurfaceArea:
                              type: boolean
                            publicCapacity:
                              type: boolean
                            privateCapacity:
                              type: boolean
                            pinCodeRequired:
                              type: boolean
                            addressCountry:
                              type: boolean
                            addressCity:
                              type: boolean
                            addressPostalCode:
                              type: boolean
                            addressStreet:
                              type: boolean
                            category:
                              type: boolean
                            commissionPeriodicityYears:
                              type: boolean
                            tagIds:
                              type: boolean
                          required:
                            - name
                            - description
                            - serialNumber
                            - openedAt
                            - accessInstructions
                            - activityTypes
                            - classifications
                            - totalSurfaceArea
                            - publicCapacity
                            - privateCapacity
                            - pinCodeRequired
                            - addressCountry
                            - addressCity
                            - addressPostalCode
                            - addressStreet
                            - category
                            - commissionPeriodicityYears
                            - tagIds
                          additionalProperties: false
                        tags:
                          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)$
                              name:
                                type: string
                                minLength: 1
                                maxLength: 100
                              color:
                                nullable: true
                                type: string
                                pattern: ^#[0-9a-fA-F]{6}$
                              type:
                                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
                                    minLength: 1
                                    maxLength: 100
                                  type:
                                    type: string
                                    enum:
                                      - unit
                                      - library_anomaly
                                required:
                                  - id
                                  - name
                                  - type
                                additionalProperties: false
                            required:
                              - id
                              - name
                              - color
                              - type
                            additionalProperties: false
                        position:
                          type: object
                          properties:
                            buildings:
                              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
                                  type:
                                    type: string
                                    enum:
                                      - rs
                                      - ad
                                  plans:
                                    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
                                        type:
                                          type: string
                                          enum:
                                            - rs
                                            - ad
                                        items:
                                          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:
                                                nullable: true
                                                type: string
                                                maxLength: 40
                                                pattern: ^[A-Z]+-[1-9]\d*(?:-[A-Z]+-[1-9]\d*)*$
                                              name:
                                                type: string
                                                minLength: 1
                                                maxLength: 150
                                              type:
                                                type: string
                                                enum:
                                                  - point
                                                  - zone
                                                  - drawing
                                              entityType:
                                                type: string
                                                enum:
                                                  - custom
                                                  - anomaly
                                                  - equipment
                                                  - room
                                                  - drawing
                                              xPercent:
                                                nullable: true
                                                type: number
                                                minimum: 0
                                                maximum: 100
                                              yPercent:
                                                nullable: true
                                                type: number
                                                minimum: 0
                                                maximum: 100
                                            required:
                                              - id
                                              - ref
                                              - name
                                              - type
                                              - entityType
                                              - xPercent
                                              - yPercent
                                            additionalProperties: false
                                      required:
                                        - id
                                        - ref
                                        - name
                                        - type
                                        - items
                                      additionalProperties: false
                                required:
                                  - id
                                  - ref
                                  - name
                                  - type
                                  - plans
                                additionalProperties: false
                          required:
                            - buildings
                          additionalProperties: false
                        qrcode:
                          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)$
                            scanUrl:
                              type: string
                              format: uri
                          required:
                            - id
                            - scanUrl
                          additionalProperties: false
                        responsibles:
                          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)$
                              name:
                                type: string
                              email:
                                nullable: true
                                type: string
                            required:
                              - id
                              - name
                              - email
                            additionalProperties: false
                        createdBy:
                          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*)*$
                            name:
                              type: string
                          required:
                            - id
                            - ref
                            - name
                          additionalProperties: false
                      required:
                        - id
                        - ref
                        - type
                        - name
                        - description
                        - serialNumber
                        - openedAt
                        - logo
                        - activityTypes
                        - classifications
                        - totalSurfaceArea
                        - publicCapacity
                        - privateCapacity
                        - pinCode
                        - pinCodeRequired
                        - accessInstructions
                        - organizationId
                        - createdByUserId
                        - addressCountry
                        - addressCity
                        - addressPostalCode
                        - addressStreet
                        - category
                        - commissionPeriodicityYears
                        - parentId
                        - sortOrder
                        - 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

````