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

# Aggregate Records

> Count records, or sum, average, minimum or maximum a number attribute, over the records matching a filter,
optionally grouped by an attribute (dates by day, week or month).



## OpenAPI

````yaml /openapi-v1.json post /api/v1/crm/objects/{type_key}/records/aggregate
openapi: 3.1.0
info:
  title: AGO Public API
  version: 1.0.0
  description: Programmatic access to your AGO workspace.
servers:
  - url: https://{tenant_id}.api.useago.com
    description: AGO Public API v1
    variables:
      tenant_id:
        default: your-tenant-id
        description: Your AGO tenant identifier
security: []
paths:
  /api/v1/crm/objects/{type_key}/records/aggregate:
    post:
      tags:
        - CRM objects
      summary: Aggregate Records
      description: >-
        Count records, or sum, average, minimum or maximum a number attribute,
        over the records matching a filter,

        optionally grouped by an attribute (dates by day, week or month).
      operationId: aggregate_crm_records
      parameters:
        - in: path
          name: type_key
          schema:
            title: Type Key
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RecordAggregateIn'
        required: true
      responses:
        '200':
          description: OK
      security:
        - ScopedAPIKeyAuth: []
components:
  schemas:
    RecordAggregateIn:
      properties:
        metric:
          default: count
          description: count, sum, avg, min or max
          title: Metric
          type: string
        attribute:
          anyOf:
            - type: string
            - type: 'null'
          description: Number attribute measured by sum, avg, min and max
          title: Attribute
        group_by:
          anyOf:
            - type: string
            - type: 'null'
          description: Attribute whose values split the result
          title: Group By
        period:
          anyOf:
            - type: string
            - type: 'null'
          description: day, week or month, when grouping by a date
          title: Period
        filter:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Filter
      title: RecordAggregateIn
      type: object
  securitySchemes:
    ScopedAPIKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````

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