> ## Documentation Index
> Fetch the complete documentation index at: https://api.buildingswell.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Group and count workers



## OpenAPI

````yaml /openapi.yaml post /worker/group-and-count
openapi: 3.0.3
info:
  title: BuildingSwell Public API
  version: 2.0.0
  description: >
    BuildingSwell v2 Public API. All endpoints require the `X-API-Key` header.

    Keys are scoped to your organization — all data is automatically filtered.


    See the [Guides](/index) for querying, filtering, joins, and response
    formats.
servers:
  - url: https://{instance}/api/v2
    description: Your BuildingSwell instance
    variables:
      instance:
        default: app.buildingswell.com
        description: Your BuildingSwell host
security:
  - ApiKeyAuth: []
tags:
  - name: Projects
    description: Top-level project groupings
  - name: Stages
    description: Stages — reusable department-scoped shop stations
  - name: Deliverables
    description: Work-tree nodes (orders, routes, phases, stages, steps, etc.)
  - name: Work sessions
    description: Work sessions on deliverables
  - name: Comments
    description: Comments on deliverables
  - name: Documents
    description: Documents attached to deliverables
  - name: Notes
    description: Notes on deliverables
  - name: Notifications
    description: Notifications and read-state
  - name: QC
    description: QC inspection sets and templates
  - name: Dependencies
    description: Dependency links between deliverables
  - name: Workers
    description: Workforce roster
  - name: Timesheets
    description: Unified time-tracking records (read-only)
  - name: Organization
    description: Roles and organization members
  - name: Concepts
    description: Concept-aware deliverable endpoints with validation
paths:
  /worker/group-and-count:
    post:
      tags:
        - Workers
      summary: Group and count workers
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GroupAndCountBody'
      responses:
        '200':
          description: Grouped counts
components:
  schemas:
    GroupAndCountBody:
      type: object
      required:
        - groupByField
      properties:
        groupByField:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        unnestGroupByField:
          type: boolean
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````