Skip to main content
POST
/
events
/
aggregate
JavaScript SDK
const aggregates = await client.events.aggregate.count({ filter: { assetIds: [1, 2, 3] } });
console.log('Number of events: ', aggregates[0].count)

const uniqueValues = await client.events.aggregate.uniqueValues({ filter: { assetIds: [1, 2, 3] }, fields: ['subtype'] });
console.log('Unique values: ', uniqueValues)
{
  "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

Request aggregate to count the number of Events matching the filters. Default aggregate for the endpoint.

aggregate
enum<string>

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

Available options:
count
advancedFilter
and · object

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

Example:
{
  "or": [
    {
      "not": {
        "and": [
          {
            "equals": {
              "property": ["metadata", "severity"],
              "value": "medium"
            }
          },
          {
            "in": {
              "property": ["source"],
              "values": ["inspection protocol", "incident report"]
            }
          },
          {
            "range": {
              "property": ["dataSetId"],
              "gte": 1,
              "lt": 10
            }
          }
        ]
      }
    },
    {
      "and": [
        {
          "equals": {
            "property": ["type"],
            "value": "equipment malfunction"
          }
        },
        {
          "equals": {
            "property": ["subtype"],
            "value": "mechanical failure"
          }
        }
      ]
    },
    {
      "search": {
        "property": ["description"],
        "value": "outage"
      }
    }
  ]
}
filter
object

Filter on events filter with exact match

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