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

# Get aggregated statistics

> Returns statistical aggregations of table data based on specified functions and grouping criteria



## OpenAPI

````yaml /swagger.json get /table/{tableId}/aggregation
openapi: 3.0.0
info:
  version: 1.0.0
  title: Teable App
  description: Manage Data as easy as drink a cup of tea
  x-logo:
    backgroundColor: '#F0F0F0'
    altText: Teable logo
servers:
  - url: https://app.teable.ai/api
security: []
paths:
  /table/{tableId}/aggregation:
    get:
      tags:
        - aggregation
      summary: Get aggregated statistics
      description: >-
        Returns statistical aggregations of table data based on specified
        functions and grouping criteria
      parameters:
        - schema:
            type: string
          required: true
          name: tableId
          in: path
      responses:
        '200':
          description: Returns aggregations list.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    aggregations:
                      type: array
                      items:
                        type: object
                        properties:
                          fieldId:
                            type: string
                            description: The id of the field.
                          total:
                            type: object
                            nullable: true
                            properties:
                              value:
                                anyOf:
                                  - type: string
                                  - type: number
                                  - nullable: true
                              aggFunc:
                                type: string
                                enum:
                                  - count
                                  - empty
                                  - filled
                                  - unique
                                  - max
                                  - min
                                  - sum
                                  - average
                                  - checked
                                  - unChecked
                                  - percentEmpty
                                  - percentFilled
                                  - percentUnique
                                  - percentChecked
                                  - percentUnChecked
                                  - earliestDate
                                  - latestDate
                                  - dateRangeOfDays
                                  - dateRangeOfMonths
                                  - totalAttachmentSize
                            required:
                              - value
                              - aggFunc
                            description: Aggregations by all data in field
                          group:
                            type: object
                            nullable: true
                            additionalProperties:
                              type: object
                              properties:
                                value:
                                  anyOf:
                                    - type: string
                                    - type: number
                                    - nullable: true
                                aggFunc:
                                  type: string
                                  enum:
                                    - count
                                    - empty
                                    - filled
                                    - unique
                                    - max
                                    - min
                                    - sum
                                    - average
                                    - checked
                                    - unChecked
                                    - percentEmpty
                                    - percentFilled
                                    - percentUnique
                                    - percentChecked
                                    - percentUnChecked
                                    - earliestDate
                                    - latestDate
                                    - dateRangeOfDays
                                    - dateRangeOfMonths
                                    - totalAttachmentSize
                              required:
                                - value
                                - aggFunc
                            description: Aggregations by grouped data in field
                        required:
                          - fieldId
                          - total
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: Shell
          source: |-
            curl --request GET \
              --url https://app.teable.ai/api/table/%7BtableId%7D/aggregation \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
        - lang: JavaScript
          source: >-
            const url =
            'https://app.teable.ai/api/table/%7BtableId%7D/aggregation';

            const options = {method: 'GET', headers: {Authorization: 'Bearer
            REPLACE_BEARER_TOKEN'}};


            try {
              const response = await fetch(url, options);
              const data = await response.json();
              console.log(data);
            } catch (error) {
              console.error(error);
            }
        - lang: Node.js
          source: |-
            const http = require('https');

            const options = {
              method: 'GET',
              hostname: 'app.teable.ai',
              port: null,
              path: '/api/table/%7BtableId%7D/aggregation',
              headers: {
                Authorization: 'Bearer REPLACE_BEARER_TOKEN'
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on('data', function (chunk) {
                chunks.push(chunk);
              });

              res.on('end', function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.end();
        - lang: Python
          source: >-
            import http.client


            conn = http.client.HTTPSConnection("app.teable.ai")


            headers = { 'Authorization': "Bearer REPLACE_BEARER_TOKEN" }


            conn.request("GET", "/api/table/%7BtableId%7D/aggregation",
            headers=headers)


            res = conn.getresponse()

            data = res.read()


            print(data.decode("utf-8"))
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````