Skip to main content
POST
/
events
/
aggregate
TypeScript
import { Autumn } from 'autumn-js';

const autumn = new Autumn();

const { data, error } = await autumn.events.aggregate({ customer_id: 'x', feature_id: 'x' });
{
  "list": [
    {
      "timestamp": 1762905600000,
      "messages": 10,
      "seats": 3
    },
    {
      "timestamp": 1762992000000,
      "messages": 3,
      "seats": 12
    }
  ],
  "total": {
    "messages": {
      "count": 2,
      "sum": 13
    },
    "seats": {
      "count": 2,
      "sum": 15
    }
  }
}

Authorizations

Authorization
string
header
required

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

Body

application/json
customer_id
string
required

Customer ID to aggregate events for

feature_id
required

Feature ID(s) to aggregate events for

group_by
string

Property to group events by. If provided, each key in the response will be an object with distinct groups as the keys

range
enum<string>

Time range to aggregate events for. Either range or custom_range must be provided

Available options:
24h,
7d,
30d,
90d,
last_cycle,
1bc,
3bc
bin_size
enum<string>
default:day

Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day

Available options:
day,
hour
custom_range
object

Custom time range to aggregate events for. If provided, range must not be provided

Response

200 - application/json

Response when group_by is not provided. Feature values are numbers.

list
object[]
required
total
object
required