Skip to main content
POST
Aggregate Objects

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

bucket_identifier
string
required

The unique identifier of the bucket.

Body

application/json

Aggregation configuration specifying grouping, metrics, and filters.

group_by
GroupByField · object[]
required

Fields to group results by. REQUIRED, at least one field. Can include field transformations (date_trunc, date_part). Results will have one row per unique combination of group_by values.

Minimum array length: 1
aggregations
AggregationOperation · object[]
required

Aggregation operations to perform. REQUIRED, at least one operation. Each operation produces a calculated field in results. Can combine multiple functions (COUNT, SUM, AVG, etc.).

Minimum array length: 1
filters
Filters · object | null

Pre-aggregation filters to apply to source data. OPTIONAL, filters data before grouping. Uses same syntax as standard query filters. Applied before GROUP BY.

Example:
having
HavingCondition · object[] | null

Post-aggregation filters to apply to results. OPTIONAL, filters groups after aggregation. Uses aggregation aliases as field names. Applied after GROUP BY and aggregation calculations.

unwind
string | null

Array field to unwind before aggregation. OPTIONAL, creates one document per array element. Useful for aggregating over array contents. Example: 'blobs' to analyze each blob separately.

Example:

"blobs"

range_buckets
RangeBucket · object[] | null

Range-based bucketing for numeric fields. OPTIONAL, creates histogram-style buckets. Groups numeric values into defined ranges. Applied during grouping stage.

sort_by
string | null

Field to sort results by. OPTIONAL, can be group_by field or aggregation alias. Defaults to no specific order. Use with sort_direction to control order.

Example:

"total_count"

sort_direction
string
default:desc

Sort direction. OPTIONAL, defaults to 'desc' (descending). Valid values: 'asc' (ascending), 'desc' (descending). Used with sort_by field.

Examples:

"asc"

"desc"

limit
integer | null

Maximum number of results to return. OPTIONAL, no limit if not specified. Applied after sorting. Useful for 'top N' queries.

Required range: x > 0
Example:

10

Response

Successful Response

Response containing object aggregation results.

Returns aggregated statistics grouped by specified fields.

results
AggregationResult · object[]
required

List of aggregation results, one per group.

total_groups
integer
required

Total number of unique groups returned.

query_info
Query Info · object

Additional information about the query execution. May include pipeline stages, execution time, etc.