Skip to main content
POST
/
assets
/
aggregate
JavaScript SDK
const aggregates = await client.assets.aggregate({ filter: { root: true } });
console.log('Number of root assets: ', aggregates[0].count)
{
  "items": [
    {
      "count": 10
    }
  ]
}

Authorizations

Authorization
string
header
required

Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.

Body

application/json

Aggregation request of assets. Filters behave the same way as for the filter endpoint. Default aggregation is count.

aggregate
enum<string>

Type of aggregation to apply. count: Get approximate number of Assets matching the filters.

Available options:
count
advancedFilter
and · object

A query that matches items matching boolean combinations of other queries. It is built using one or more boolean clauses of the following types: and, or, or not.

Example:
{
"or": [
{
"not": {
"and": [
{
"equals": {
"property": ["metadata", "asset_type"],
"value": "gas pump"
}
},
{
"in": {
"property": ["source"],
"values": ["blueprint", "inventory"]
}
},
{
"range": {
"property": ["dataSetId"],
"gte": 1,
"lt": 10
}
}
]
}
},
{
"and": [
{
"containsAny": {
"property": ["labels"],
"values": ["pump", "cooler"]
}
},
{
"equals": {
"property": ["parentId"],
"value": 95867294876
}
}
]
},
{
"search": {
"property": ["description"],
"value": "My favorite pump"
}
}
]
}
filter
Filter · object

Filter on assets with strict matching.

Response

Response with a list of aggregation results.

Common aggregate structure to represent aggregate result which have one count for filter resultset (Documents Count, Property Cardinality, etc).

items
object[]
required
Required array length: 1 element
Last modified on April 23, 2026