# List client groups

**Retrieve all client groups with basic pagination support**
This endpoint returns a paginated list of all client groups in the tenant,
including assigned partner/manager staff and office information.
**Key Features:**
- Basic pagination with configurable page sizes (default: 50 records)
- Default sorting by client group name (ascending) then creation date (descending)
- Total count aggregation for pagination metadata

**Real Example:**

```bash
curl --location 'https://{{host}}/v1/client_groups' \
--data '{
  "pageSize": 25,
  "page": 0
}'
```

Endpoint: POST /gql/v1/client_groups
Version: 1.0.0
Security: BearerAuth

## Request fields (application/json):

  - `pageSize` (integer)
    Maximum number of client group records to return
    Example: 25

  - `page` (integer)
    Number of records to skip for pagination navigation
    Example: 0

## Response 200 fields (application/json):

  - `clientGroups` (array)

  - `clientGroups.id` (integer)
    Unique client group identifier
    Example: 10

  - `clientGroups.name` (string)
    Client group name
    Example: Acme Corp Group

  - `clientGroups.pmsRef` (string)
    Practice Management System reference
    Example: GRP-001

  - `clientGroups.parentClientId` (integer)
    ID of the parent client, if any
    Example: null

  - `clientGroups.primaryContactId` (integer)
    ID of the primary contact
    Example: 201

  - `clientGroups.billingContactId` (integer)
    ID of the billing contact
    Example: 202

  - `clientGroups.partnerStaffId` (integer)
    ID of the assigned partner staff member
    Example: 101

  - `clientGroups.managerStaffId` (integer)
    ID of the assigned manager staff member
    Example: 102

  - `clientGroups.officeId` (integer)
    ID of the associated office
    Example: 5

  - `clientGroups.active` (boolean)
    Whether the client group is active
    Example: true

  - `clientGroups.isManagedByAiwyn` (boolean)
    Whether the client group is managed by Aiwyn
    Example: false

  - `clientGroups.createdAt` (string)
    Record creation timestamp
    Example: 2024-01-15T10:00:00.000000+00:00

  - `clientGroups.updatedAt` (string)
    Last modification timestamp
    Example: 2024-06-20T14:30:00.000000+00:00

  - `clientGroups.version` (integer)
    Record version number
    Example: 3

  - `clientGroups.partnerStaff` (object)
    Staff member basic information

  - `clientGroups.partnerStaff.id` (integer)
    Example: 53

  - `clientGroups.partnerStaff.firstName` (string)
    Example: Allen

  - `clientGroups.partnerStaff.lastName` (string)
    Example: Hermiston

  - `clientGroups.partnerStaff.email` (string)
    Example: allen.hermiston@company.com

  - `clientGroups.office` (object)
    Associated office

  - `clientGroups.office.id` (integer)
    Example: 5

  - `clientGroups.office.pmsRef` (string)
    Example: OFF-5

  - `clientGroups.office.name` (string)
    Example: San Francisco

  - `total` (object)

  - `total.aggregate` (object)

  - `total.aggregate.count` (integer)
    Total number of client groups in the tenant
    Example: 142

## Response 400 fields (application/json):

  - `error` (string, required)
    Human-readable error message
    Example: Invalid parameter value

  - `code` (string, required)
    Machine-readable error code
    Example: INVALID_PARAMETER

  - `details` (string)
    Additional error context
    Example: The 'pageSize' parameter must be between 1 and 1000

## Response 500 fields (application/json):

  - `error` (string, required)
    Human-readable error message
    Example: Invalid parameter value

  - `code` (string, required)
    Machine-readable error code
    Example: INVALID_PARAMETER

  - `details` (string)
    Additional error context
    Example: The 'pageSize' parameter must be between 1 and 1000

