Serve filter results to your product through an API

Configure a query in the UI, then call it with a single POST. The response contains the fields you chose, as JSON or CSV.

From filter to API

The Metrics API exposes every option, but most products repeat the same few queries. An Endpoint stores that configuration so your code doesn't have to.

Filter
Start from any filter you've already built.
Timing
A single lookback total, like the last 24 hours, or a time series.
Groupings
Return every value, a fixed list, roll them up, or let the caller choose at query time.
Fields
Name the calculations to return, then set sorting and limits.

One filter, an Endpoint for each screen

Any number of Endpoints can read from the same filter. Each one picks its own timing, groupings, fields and sorting, so the usage page, the trending list, the admin chart and the weekly export all come from one set of aggregations.

Filter · set up once
Impressions
Filter
@.event_name == 'Impressions'
Groupings
@.item_id@.device.type@.customer_id
Interval
1 hour
Aggregations
1 Impressions · count2 Viewers · @.user_id · distinct count3 Duration · @.duration_ms · avg, percentiles
  • Usage page for each customercustomer-usageLookback 30 days@.customer_id query timefields impressions, viewersYour backend passes one customer ID per request, so each customer only sees their own numbers.
  • Trending itemstop-itemsLookback 24 hours@.item_id all valuessort impressions desclimit 10
  • Chart in the admin dashboardimpressions-hourlyTime series 1 hourduration 7 days@.device.type all values
  • Weekly numbers for financeweekly-exportTime series 1 weekduration 12 weeksfields impressions, p95 durationformat CSV

Response format and uses

Each Endpoint returns only the fields you configured, in the same shape every time. Common uses:

  • Customer-facing usage pages. A query-time grouping means each request only returns that customer's numbers.
  • KPI tiles and charts. A lookback powers the headline number, a time series the chart beside it.
  • Leaderboards. Sort by any field and limit results, including the top N within each group.
  • Spreadsheets and BI. Send "format": "CSV" and get a header row plus your data.
Request
curl -X POST https://app.aggregations.io/api/v1/data/{id} \
  -H "x-api-token: $READ_KEY" \
  -d '{"groupingFilters": {"@.item_id": ["sku_123"]}}'
Response
[
  {
    "groupings": { "$.device.type": "ios" },
    "fields": {
      "L24_Total": 26140,
      "L24_Uniques": 5120,
      "L24_yday_total": 24480
    }
  },
  { …android },
  { …web }
]

Top N within each group

Sorting and limits work across nested groupings. Group by team and player, sort by score, and keep the top 3 players in each team, with an overall limit on how many rows come back.

One request returns a leaderboard for every team. Your code doesn't rank, slice or trim anything, and the same setup works for top products per category or top pages per customer.

Grouping limits

groupings @.team_id › @.user_idsort score desclimit 3 per team
Red Foxes
  1. nova48,210
  2. kestrel45,980
  3. bramble41,330
38 more players not returned
Night Owls
  1. quill51,040
  2. moth44,715
  3. ash39,902
52 more players not returned

Edit an Endpoint without redeploying your app

Say your in-app tile shows impressions for the last 24 hours, and you want it to show the last 7 days with the change from the week before. Update the Endpoint in the UI and the app gets the new numbers on its next request.

Filter edits that would break an Endpoint's fields are blocked and flagged. Endpoint calls use a read-only key.

More in Real-Time Metrics

Questions

How is an Endpoint different from the Metrics API?

With the Metrics API you build each request yourself: which filter, aggregation, calculation, time range and groupings. An Endpoint saves those choices in the UI, so callers only POST to its URL. You can change an Endpoint's timing, fields or sorting without touching the code that calls it.

How do I authenticate requests?

Send an x-api-token header with an API key that has Read permission. API keys can read your organization's data, so call Endpoints from your backend rather than directly from a browser or mobile app.

Can each of my customers see only their own data?

Yes. Add a grouping for your customer (or account, team, etc.) on your filter and set it to Query Time on the Endpoint. Your backend then passes that customer's ID in groupingFilters, and only their results come back.

What formats can an Endpoint return?

JSON by default, or CSV by sending "format": "CSV". CSV responses include a header row, so they drop straight into spreadsheets and BI tools.

Can I query a time window in the past?

Yes. Pass an end timestamp in your request and the Endpoint's duration is measured back from there. You can also set a fixed offset on the Endpoint, or on individual return fields to compare periods side by side, like today vs. yesterday.

How many results does an Endpoint return?

Lookback Endpoints return up to 1,000 items by default. Enable sorting to control the order and set your own limit, including a limit on inner groupings, such as the top 5 players per team.

What happens if I change the filter behind an Endpoint?

Safe changes go through. If a change would remove the last valid return field from an Endpoint, it's blocked. Removed groupings come back empty and removed calculations return null, and the Endpoint editor highlights anything you need to fix. See the docs for details.

From $60/month. Every feature on every plan. 14 days free.