---
title: "Aggregate insight counts by day for a workspace"
method: GET
path: "/workspaces/{workspace_id}/insights/aggregate"
tags: ["Insight"]
---

# Aggregate insight counts by day for a workspace

`GET /workspaces/{workspace_id}/insights/aggregate`

Returns a daily histogram of insight counts for a workspace over a required
created_time window. Counts are bucketed in the requested timezone and grouped
by insight type and insight status. Uses a bounded Datastore scan and in-memory
aggregation (does not return full insight entities).
Maximum allowed window is 60 calendar days in the requested timezone.

## Path parameters

- `workspace_id` string, required

## Query parameters

- `created_after_time` integer, required
- `created_before_time` integer, required
- `timezone` string
- `environment_id` string
- `application_id` string
- `archived` boolean
- `insight_type` string

## Response `200`

Daily insight count histogram

- InsightWorkspaceAggregateResult — Daily histogram of insight counts for a workspace
  - `buckets` InsightDailyAggregateBucket[], required — One entry per calendar day in the response timezone that had at least one matching insight. Ordered by date ascending. Days with zero insights are omitted.
    - `date` integer, required — Inclusive start of the calendar day as Unix epoch milliseconds, aligned to midnight in the request timezone
    - `by_type` object, required — Map from insight type to count for this day
    - `by_status` object, required — Map from insight status to count for this day
  - `timezone` string, required — Normalized IANA timezone used for day bucket boundaries

## Other responses

- `400` — Invalid or missing parameter
- `401` — User not authenticated
- `403` — User not authorized
- `default` — Unknown error

---

[API](https://skmtc.net/mabl/apis/mabl-api.md) · [All operations](https://skmtc.net/mabl/apis/mabl-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mabl/mabl-api/revisions/d0fc0114da66/schema)
