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

# Query aggregated results

> Reads only; nothing is changed. It is a POST because the query does not fit in a URL.



## OpenAPI

````yaml /openapi.json post /v1/analytics/query
openapi: 3.1.0
info:
  title: Cluster API
  version: '1'
servers:
  - url: https://api.getcluster.ai
security: []
paths:
  /v1/analytics/query:
    post:
      tags:
        - Analytics
      summary: Query aggregated results
      description: >-
        Reads only; nothing is changed. It is a POST because the query does not
        fit in a URL.
      operationId: query_analytics
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnalyticsQueryRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsResult'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '402':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Payment Required
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Entity
        '429':
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Too Many Requests
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '503':
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Service Unavailable
      security:
        - ApiKey: []
components:
  schemas:
    AnalyticsQueryRequest:
      properties:
        start_date:
          type: string
          format: date
          title: Start Date
        end_date:
          type: string
          format: date
          title: End Date
        timezone:
          type: string
          title: Timezone
          default: UTC
        comparison:
          type: string
          enum:
            - previous_period
            - none
          title: Comparison
          default: none
        interval:
          type: string
          enum:
            - day
            - week
            - month
          title: Interval
          default: day
        group_by:
          items:
            type: string
            enum:
              - campaign
              - sequence
              - sender
              - channel
              - step
              - action
          type: array
          maxItems: 6
          title: Group By
        scope:
          items:
            $ref: '#/components/schemas/AnalyticsScope'
          type: array
          maxItems: 6
          title: Scope
        sort_by:
          type: string
          enum:
            - leads_reached
            - replies
            - reply_rate
            - invitations_sent
            - invitations_accepted
            - acceptance_rate
            - messages_sent
            - emails_sent
            - calls_made
            - call_conversations
            - call_conversation_rate
            - positive_replies
            - positive_reply_rate
            - classified_replies
            - unclassified_replies
            - classification_coverage
          title: Sort By
          default: leads_reached
        sort_direction:
          type: string
          enum:
            - asc
            - desc
          title: Sort Direction
          default: desc
        limit:
          type: integer
          maximum: 500
          minimum: 1
          title: Limit
          default: 50
      additionalProperties: false
      type: object
      required:
        - start_date
        - end_date
      title: AnalyticsQueryRequest
      description: >-
        Declared field by field, so a field added to the app's own query model
        never becomes public by accident.
    AnalyticsResult:
      properties:
        total:
          $ref: '#/components/schemas/AnalyticsRow'
        series:
          items:
            $ref: '#/components/schemas/AnalyticsRow'
          type: array
          title: Series
        groups:
          items:
            $ref: '#/components/schemas/AnalyticsRow'
          type: array
          title: Groups
        group_count:
          type: integer
          title: Group Count
        channels:
          items:
            type: string
          type: array
          title: Channels
        comparison:
          anyOf:
            - $ref: '#/components/schemas/AnalyticsDataset'
            - type: 'null'
        generated_at:
          type: string
          format: date-time
          title: Generated At
      type: object
      required:
        - total
        - series
        - groups
        - group_count
        - channels
        - generated_at
      title: AnalyticsResult
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
      type: object
      required:
        - error
      title: ErrorResponse
    AnalyticsScope:
      properties:
        dimension:
          type: string
          enum:
            - campaign
            - sequence
            - sender
            - channel
            - step
            - action
          title: Dimension
        value:
          type: string
          minLength: 1
          title: Value
      additionalProperties: false
      type: object
      required:
        - dimension
        - value
      title: AnalyticsScope
    AnalyticsRow:
      properties:
        dimensions:
          additionalProperties:
            type: string
          type: object
          title: Dimensions
        labels:
          additionalProperties:
            type: string
          type: object
          title: Labels
        values:
          additionalProperties:
            anyOf:
              - type: integer
              - type: number
              - type: 'null'
          type: object
          title: Values
      type: object
      required:
        - dimensions
        - labels
        - values
      title: AnalyticsRow
    AnalyticsDataset:
      properties:
        total:
          $ref: '#/components/schemas/AnalyticsRow'
        series:
          items:
            $ref: '#/components/schemas/AnalyticsRow'
          type: array
          title: Series
        groups:
          items:
            $ref: '#/components/schemas/AnalyticsRow'
          type: array
          title: Groups
        group_count:
          type: integer
          title: Group Count
      type: object
      required:
        - total
        - series
        - groups
        - group_count
      title: AnalyticsDataset
    ErrorBody:
      properties:
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
        request_id:
          type: string
          title: Request Id
        details:
          anyOf:
            - items:
                $ref: '#/components/schemas/ErrorDetail'
              type: array
            - type: 'null'
          title: Details
      type: object
      required:
        - code
        - message
        - request_id
      title: ErrorBody
    ErrorDetail:
      properties:
        field:
          anyOf:
            - type: string
            - type: 'null'
          title: Field
        message:
          type: string
          title: Message
      type: object
      required:
        - message
      title: ErrorDetail
  securitySchemes:
    ApiKey:
      type: http
      description: A workspace API key, created under Settings, API keys.
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.