Skip to main content
POST
Aggregate records

Operations

fieldId is required for every operation. It and groupBy take field IDs: field names aren’t accepted. sum and avg require a numeric field (number, currency, percent, rating, or duration). min and max on a date field return epoch milliseconds.

Filtering

Use the optional filter to restrict which records are aggregated. It supports the same nested AND/OR logic as List Records.

Grouping

When groupBy is supplied, the response returns groupedResults (one entry per group with its value and groupValue) and result is null. For a select field, groupValue is the option ID, not its label.

Authorizations

Authorization
string
header
required

Enter your Zite API key. Format: Bearer <api_key>

Path Parameters

databaseId
string
required

The unique identifier of the database

tableId
string
required

The unique identifier of the table.

Body

application/json
fieldId
string
required

The ID of the field to aggregate (field names are not accepted). Required for all operations. sum and avg require a numeric field (number, currency, percent, rating, or duration); min and max work on numeric and date fields, with dates returned as epoch milliseconds.

operation
enum<string>
required

The aggregation to perform.

Available options:
sum,
avg,
min,
max,
count,
count_distinct
filter
object

Optional filter condition restricting which records are aggregated. Supports the same nested AND/OR logic as List Records.

groupBy
string

Optional ID of the field to group results by (field names are not accepted). When provided, groupedResults is returned and result is null.

Response

Aggregation result

fieldId
string
required

The field ID that was aggregated.

operation
enum<string>
required

The aggregation that was performed.

Available options:
sum,
avg,
min,
max,
count,
count_distinct
result
number | null
required

The aggregated value. Null when groupBy is used (see groupedResults) or when no rows match. sum returns 0 when no rows match.

groupedResults
object[]

Present only when groupBy is supplied. One entry per group.