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

# Aggregate

> Counts and rates across all customers, pseudonymous by default.



## OpenAPI

````yaml openapi/en/cell.json POST /v1/insights/aggregate
openapi: 3.1.0
info:
  title: Niadra data API
  version: '1'
  description: >-
    Writing, context, history, objects, identity, privacy and governance of one
    space. Every space has a stable address, with the space and the region in
    its name.
servers:
  - url: https://{space}.{region}.api.niadra.com
    variables:
      space:
        default: acme-prod
        description: The space, which comes in the source key.
      region:
        default: us-east-1
        description: The region of the space, which also comes in the key.
security: []
paths:
  /v1/insights/aggregate:
    post:
      summary: Aggregate
      description: >-
        Counts and rates across all customers of the space: pick an entity, a
        period, filters, dimensions and metrics (`count`, `profiles`,
        `avg_sentiment`). Groups smaller than the minimum group size are
        suppressed, never shown, and every query leaves an analytics receipt.


        **Authentication.** Source key with the `analytics` scope, or a Console
        person token with the analysis role (or admin). People with the vendor
        role have no access.
      operationId: aggregate_v1_insights_aggregate_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AggregateRequest'
            example:
              entity: episodes
              since: '2026-06-24T00:00:00Z'
              until: '2026-09-22T23:59:59Z'
              filters:
                intent:
                  - complaint
              group_by:
                - normalized_category
                - channel
              metrics:
                - count
                - profiles
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AggregateResponse'
              example:
                min_group_size: 10
                suppressed_groups: 3
                rows:
                  - group:
                      normalized_category: technician_visit
                      channel: voice
                    count: 1204
                    profiles: 1030
                    avg_sentiment: null
                  - group:
                      normalized_category: technician_visit
                      channel: whatsapp
                    count: 636
                    profiles: 588
                    avg_sentiment: null
          description: One row per group, with the suppressed groups counted apart.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The request does not match the contract.
      security:
        - sourceKey: []
components:
  schemas:
    AggregateRequest:
      additionalProperties: false
      properties:
        entity:
          description: episodes, open_items, traits, actions, objects or profiles
          title: Entity
          type: string
        filters:
          additionalProperties:
            items:
              maxLength: 200
              type: string
            type: array
          title: Filters
          type: object
        group_by:
          items:
            type: string
          maxItems: 3
          title: Group By
          type: array
        metrics:
          items:
            type: string
          maxItems: 3
          title: Metrics
          type: array
        since:
          format: date-time
          title: Since
          type: string
        until:
          format: date-time
          title: Until
          type: string
      required:
        - since
        - until
        - entity
      title: AggregateRequest
      type: object
    AggregateResponse:
      additionalProperties: false
      properties:
        min_group_size:
          title: Min Group Size
          type: integer
        rows:
          items:
            $ref: '#/components/schemas/AggregateRowOut'
          title: Rows
          type: array
        suppressed_groups:
          description: Groups below the minimum size, withheld.
          title: Suppressed Groups
          type: integer
      required:
        - rows
        - suppressed_groups
        - min_group_size
      title: AggregateResponse
      type: object
    Problem:
      additionalProperties: false
      description: RFC 9457 problem details; `code` comes from the versioned error catalog.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object
    AggregateRowOut:
      additionalProperties: false
      properties:
        avg_sentiment:
          anyOf:
            - type: number
            - type: 'null'
          title: Avg Sentiment
        count:
          title: Count
          type: integer
        group:
          additionalProperties:
            anyOf:
              - type: string
              - type: 'null'
          title: Group
          type: object
        profiles:
          anyOf:
            - type: integer
            - type: 'null'
          title: Profiles
      required:
        - group
        - count
      title: AggregateRowOut
      type: object
  securitySchemes:
    sourceKey:
      type: http
      scheme: bearer
      description: nia_sk_...

````