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

# Aggregate activities

> Returns COUNT(*) buckets for externally visible activities over a required UTC window of at most 92 days. Values follow group_by order, followed by TIME_BUCKET when requested. Empty time buckets are not zero-filled; CARDINALITY and other measures are future extensions.



## OpenAPI

````yaml /openapi.json post /v1/activities/aggregate
openapi: 3.1.0
info:
  title: ModernLoop Platform API
  version: 0.1.0
  description: The ModernLoop Platform API for managing recruiting workflows.
  contact:
    email: support@modernloop.io
servers:
  - url: https://api.modernloop.io
security: []
tags:
  - name: Activity
  - name: Application
  - name: Candidate
  - name: Interview Event
  - name: Interview Module
  - name: Job
  - name: Job Stage
  - name: Me
  - name: Organization
  - name: Schedule
  - name: Scheduling Task
  - name: Task Queue
  - name: Template
  - name: User
paths:
  /v1/activities/aggregate:
    post:
      tags:
        - Activity
      summary: Aggregate activities
      description: >-
        Returns COUNT(*) buckets for externally visible activities over a
        required UTC window of at most 92 days. Values follow group_by order,
        followed by TIME_BUCKET when requested. Empty time buckets are not
        zero-filled; CARDINALITY and other measures are future extensions.
      operationId: aggregateActivities
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActivityAggregateInput'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActivityAggregateResult'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '410':
          description: Gone
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    ActivityAggregateInput:
      type: object
      properties:
        group_by:
          type: array
          items:
            type: string
            enum:
              - ACTIVITY_TYPE
              - SUBJECT_TYPE
              - ACTOR_TYPE
              - USER_ACTOR
          minItems: 1
          maxItems: 3
          description: >-
            1-3 distinct dimensions in response order. This dimension enum may
            grow.
        time_bucket:
          type: string
          enum:
            - DAY
            - WEEK
            - MONTH
          description: Optional UTC histogram. Empty time buckets are not zero-filled.
        start_at:
          type: string
          format: date-time
          description: Inclusive window start; the window may not exceed 92 days.
        end_at:
          type: string
          format: date-time
          description: Inclusive window end; the window may not exceed 92 days.
        activity_types:
          type: array
          items:
            type: string
            enum:
              - TASK_CREATED
              - TASK_ASSIGNED
              - CANDIDATE_AVAILABILITY_REQUESTED
              - CANDIDATE_AVAILABILITY_SUBMITTED
              - SELF_SCHEDULE_REQUESTED
              - SCHEDULE_CREATED
              - SCHEDULE_UPDATED
              - SCHEDULE_RESCHEDULED
              - SCHEDULE_CANCELED
              - SELF_SCHEDULE_CREATED
              - SELF_SCHEDULE_RESCHEDULED
              - SELF_SCHEDULE_CANCELED
              - INTERVIEWER_RSVP_ACCEPTED
              - INTERVIEWER_RSVP_DECLINED
              - INTERVIEWER_RSVP_TENTATIVE
              - CANDIDATE_RSVP_ACCEPTED
              - CANDIDATE_RSVP_DECLINED
              - CANDIDATE_RSVP_TENTATIVE
              - COMMENT
              - INTERVIEWER_AUTO_REPLACED
              - CANDIDATE_INTERVIEW_REMINDER_SENT
              - CANDIDATE_SELF_SCHEDULE_REMINDER_SENT
              - CANDIDATE_AVAILABILITY_REMINDER_SENT
              - SCHEDULE_INTERVIEW_ADDED
              - SCHEDULE_INTERVIEW_UPDATED
              - SCHEDULE_INTERVIEW_CANCELED
              - DEBRIEF_CREATED
              - DEBRIEF_CANCELED
              - DEBRIEF_UPDATED
              - DEBRIEF_RESCHEDULED
              - CHANGE_REQUESTED
              - FLAG_RESOLVED_CHANGE_REQUESTED
              - FLAG_RESOLVED_INTERVIEW_DECLINED
              - FLAG_RESOLVED_DEBRIEF_DECLINED
              - FLAG_RESOLVED_CANDIDATE_DECLINED
              - FLAG_RESOLVED_INTERVIEWER_DEACTIVATED
              - FLAG_RESOLVED_INTERVIEWER_TENTATIVE
              - FLAG_RESOLVED_DEBRIEF_ATTENDEE_TENTATIVE
              - FLAG_RESOLVED_DEBRIEF_ATTENDEE_DEACTIVATED
              - FLAG_RESOLVED_CANDIDATE_TENTATIVE
          maxItems: 100
        subject_types:
          type: array
          items:
            type: string
            enum:
              - TASK
              - APPLICATION
              - CANDIDATE
          maxItems: 100
        actor_types:
          type: array
          items:
            type: string
            enum:
              - USER
              - CANDIDATE
              - SYSTEM
          maxItems: 100
        user_actor_ids:
          type: array
          items:
            type: string
            pattern: >-
              ^(?:usr_)?(?:[0-9a-fA-F]{32}|[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
            description: >-
              an user ID. Accepts the canonical prefixed compact UUID, a
              prefixed dashed UUID, a bare dashed UUID, or a bare compact UUID;
              input is case-insensitive.
            example: usr_a1b2c3d4e5f64789a1b2c3d4e5f64789
          maxItems: 100
          description: Public user ids. Unknown or foreign-organization ids match no rows.
        limit:
          type: integer
      required:
        - group_by
        - start_at
        - end_at
      additionalProperties: false
    ActivityAggregateResult:
      type: object
      properties:
        buckets:
          type: array
          items:
            type: object
            properties:
              group_values:
                type: array
                items:
                  type: object
                  properties:
                    dimension:
                      type: string
                      enum:
                        - ACTIVITY_TYPE
                        - SUBJECT_TYPE
                        - ACTOR_TYPE
                        - USER_ACTOR
                        - TIME_BUCKET
                    value:
                      type: string
                  required:
                    - dimension
                    - value
              count:
                type: string
                pattern: ^\d+$
                description: Exact decimal count (int64-safe).
            required:
              - group_values
              - count
        truncated:
          type: boolean
      required:
        - buckets
        - truncated
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - UNAUTHENTICATED
                - INSUFFICIENT_SCOPE
                - VALIDATION_FAILED
                - INVALID_CURSOR
                - PAYLOAD_TOO_LARGE
                - NOT_FOUND
                - PERMISSION_DENIED
                - IDEMPOTENCY_KEY_REQUIRED
                - IDEMPOTENCY_KEY_REUSED
                - RATE_LIMITED
                - CONFLICT
                - CANNOT_UPDATE_SYNC_MANAGED_FIELDS
                - NOT_IMPLEMENTED
                - INTERNAL
                - UPSTREAM_TIMEOUT
                - UNAVAILABLE
            message:
              type: string
            docs_url:
              type: string
              format: uri
            details:
              type: array
              items:
                type: object
                additionalProperties:
                  type: string
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API tokens are passed as Bearer tokens.

````