> ## 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), paginated (BO)



## OpenAPI

````yaml /api/bo/openapi.json get /bo/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:
  /bo/units/v1/:
    get:
      tags:
        - units
      summary: List units (parents and children), paginated (BO)
      operationId: listUnitsBOV1
      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
                - nb-children
                - organization
                - created-by
              description: >-
                Extend options (JSON-encoded array, e.g.
                `?extend=["category"]`):

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

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

                - "nb-children": Number of non-deleted children (always 0 on a
                child unit) and QR codes, per row.

                - "organization": Each unit's organization (id, name, type,
                accessStatus).

                - "created-by": The BO admin who created each unit.
          in: query
          name: extend
          required: false
        - schema:
            type: array
            items:
              type: object
              properties:
                field:
                  type: string
                  enum:
                    - name
                    - createdAt
                    - updatedAt
                    - archivedAt
                    - category
                    - onboardingStatus
                    - organization
                    - addressStreet
                    - addressCity
                    - addressPostalCode
                    - addressCountry
                    - totalSurfaceArea
                    - publicCapacity
                    - privateCapacity
                    - pinCodeRequired
                    - childCount
                  description: >-
                    OrderBy options (JSON-encoded array, e.g.
                    `?orderBy=[{"field":"name","direction":"asc"}]`):

                    - "name": Order by unit name.

                    - "createdAt": Order by creation date.

                    - "updatedAt": Order by last update date.

                    - "archivedAt": Order by archive date.

                    - "category": Order by ERP category.

                    - "onboardingStatus": Order by onboarding status.

                    - "organization": Order by the unit's organization name.

                    - "addressStreet": Order by (parent) address street.

                    - "addressCity": Order by (parent) address city.

                    - "addressPostalCode": Order by (parent) postal code.

                    - "addressCountry": Order by (parent) address country.

                    - "totalSurfaceArea": Order by total surface area.

                    - "publicCapacity": Order by public capacity.

                    - "privateCapacity": Order by private capacity.

                    - "pinCodeRequired": Order by the pinCodeRequired flag.

                    - "childCount": Order by number of children (legacy
                    `sitesCount`, unfiltered).
                direction:
                  type: string
                  enum:
                    - asc
                    - desc
                  description: Sort direction
                  example: asc
              required:
                - field
                - direction
          in: query
          name: orderBy
          required: false
        - 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: whereOrganizationId
          required: false
          description: Filter by the unit's organization id.
        - 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:
            type: array
            items:
              type: string
            example:
              - erp
              - ert
          in: query
          name: whereClassifications
          required: false
          description: Filter by classification (matches any of the given codes).
        - schema:
            type: array
            items:
              type: string
            example:
              - '1'
              - '2'
          in: query
          name: whereCategory
          required: false
          description: Filter by ERP category (matches any of the given codes).
        - schema:
            type: array
            items:
              type: string
            example:
              - pending
              - in_progress
          in: query
          name: whereOnboardingStatus
          required: false
          description: Filter by onboarding status (matches any of the given codes).
        - 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: boolean
              - type: string
            example: true
          in: query
          name: whereIncludeDeleted
          required: false
          description: When `true`, also returns soft-deleted units.
        - schema:
            type: string
            maxLength: 200
            example: lobby
          in: query
          name: whereAddressStreet
          required: false
          description: Case-insensitive partial match on the (parent) address street.
        - schema:
            type: string
            maxLength: 200
            example: lobby
          in: query
          name: whereAddressCity
          required: false
          description: Case-insensitive partial match on the (parent) address city.
        - schema:
            type: string
            maxLength: 200
            example: lobby
          in: query
          name: whereAddressPostalCode
          required: false
          description: Case-insensitive partial match on the (parent) postal code.
        - schema:
            type: string
            maxLength: 200
            example: lobby
          in: query
          name: whereAddressCountry
          required: false
          description: Case-insensitive partial match on the (parent) address country.
        - schema:
            type: integer
            minimum: -9007199254740991
            maximum: 9007199254740991
            example: 42
          in: query
          name: whereTotalSurfaceArea
          required: false
          description: Exact match on total surface area.
        - schema:
            type: integer
            minimum: -9007199254740991
            maximum: 9007199254740991
            example: 42
          in: query
          name: wherePublicCapacity
          required: false
          description: Exact match on public capacity.
        - schema:
            type: integer
            minimum: -9007199254740991
            maximum: 9007199254740991
            example: 42
          in: query
          name: wherePrivateCapacity
          required: false
          description: Exact match on private capacity.
        - schema:
            anyOf:
              - type: boolean
              - type: string
            example: true
          in: query
          name: wherePinCodeEnabled
          required: false
          description: Filter by the pinCodeRequired flag.
        - 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:
            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: whereCreatedById
          required: false
          description: Filter by the id of the BO admin who created the unit.
        - schema:
            type: object
            properties:
              op:
                type: string
                enum:
                  - '='
                  - '!='
                  - '>'
                  - '>='
                  - <
                  - <=
              value:
                type: integer
                minimum: -9007199254740991
                maximum: 9007199254740991
            example:
              op: '>'
              value: 5
          in: query
          name: whereChildCount
          required: false
          description: >-
            Filter by number of non-deleted children, with comparator (op: =,
            !=, >, >=, <, <=).
      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
                        leafletDispatchedAt:
                          nullable: true
                          type: string
                          format: date-time
                        onboardingStatus:
                          nullable: true
                          type: string
                          enum:
                            - pending
                            - in_progress
                            - on_hold
                            - completed
                        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)$
                        createdByBoUserId:
                          nullable: true
                          type: string
                          format: uuid
                          pattern: >-
                            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                        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
                        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
                        actions:
                          type: object
                          properties:
                            canBeUpdated:
                              type: boolean
                            canBeDeleted:
                              type: boolean
                            canBeArchived:
                              type: boolean
                            canBeUnarchived:
                              type: boolean
                          required:
                            - canBeUpdated
                            - canBeDeleted
                            - canBeArchived
                            - canBeUnarchived
                          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
                            pinCode:
                              type: boolean
                            addressCountry:
                              type: boolean
                            addressCity:
                              type: boolean
                            addressPostalCode:
                              type: boolean
                            addressStreet:
                              type: boolean
                            category:
                              type: boolean
                            commissionPeriodicityYears:
                              type: boolean
                            onboardingStatus:
                              type: boolean
                            leafletDispatchedAt:
                              type: boolean
                          required:
                            - name
                            - description
                            - serialNumber
                            - openedAt
                            - accessInstructions
                            - activityTypes
                            - classifications
                            - totalSurfaceArea
                            - publicCapacity
                            - privateCapacity
                            - pinCodeRequired
                            - pinCode
                            - addressCountry
                            - addressCity
                            - addressPostalCode
                            - addressStreet
                            - category
                            - commissionPeriodicityYears
                            - onboardingStatus
                            - leafletDispatchedAt
                          additionalProperties: false
                        nbChildren:
                          type: integer
                          minimum: 0
                          maximum: 9007199254740991
                        nbQrCodes:
                          type: integer
                          minimum: 0
                          maximum: 9007199254740991
                        organization:
                          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
                            type:
                              type: string
                            accessStatus:
                              type: string
                          required:
                            - id
                            - name
                            - type
                            - accessStatus
                          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)$
                            name:
                              type: string
                            email:
                              type: string
                          required:
                            - id
                            - name
                            - email
                          additionalProperties: false
                      required:
                        - id
                        - ref
                        - type
                        - name
                        - description
                        - serialNumber
                        - openedAt
                        - logo
                        - activityTypes
                        - classifications
                        - totalSurfaceArea
                        - publicCapacity
                        - privateCapacity
                        - pinCode
                        - pinCodeRequired
                        - accessInstructions
                        - leafletDispatchedAt
                        - onboardingStatus
                        - organizationId
                        - createdByBoUserId
                        - addressCountry
                        - addressCity
                        - addressPostalCode
                        - addressStreet
                        - category
                        - commissionPeriodicityYears
                        - parentId
                        - sortOrder
                        - 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

````