---
title: "Get aggregated event counts"
method: GET
path: "/repos/{owner}/{repository}/logs/aggregate"
tags: ["activity_log"]
---

# Get aggregated event counts

`GET /repos/{owner}/{repository}/logs/aggregate`

Aggregations (total / histogram / event-type / outcome / trigger / pull-request / batch-pull-request facet counts) over the same filter set as `/logs`. The response stays consistent with what the row endpoint returns: `total` matches what the table will show; unchecked values produce no row in their facet list (the sidebar hides their count rather than display `0`). `by_outcome` is derived from `event.type` (most types map directly; a few refine the label from event metadata); `by_trigger`, `by_pull_request`, and `by_batch_pull_request` return the top 200 values by count in the window, self-excluding their own filters.

## Path parameters

- `owner` string, required — The owner of the repository
- `repository` string, required — The name of the repository

## Query parameters

- `pull_request` integer[], nullable — Filter events by pull-request number. Repeatable to match several PRs at once (e.g. `?pull_request=1&pull_request=2`).
- `base_ref` string, nullable — Get events for PRs to the given base ref
- `batch_pull` integer[], nullable — Filter to batch (draft) pull requests' own lifecycle events by number (surfaced in the dashboard as "Batch Pull Request"). Repeatable to match several batches at once. The draft PR is the Mergify-opened pull request that speculatively checks a batch; this returns each batch's `action.queue.checks_start` / `action.queue.checks_end` events (which snapshot the draft PR number) plus the batch's bisection events. When `in_place` is true the number is the user's own PR rather than a Mergify draft. The number rotates on checks-retry — each event snapshots the number at that attempt. Mutually exclusive with `not_batch_pull` (exclusion).
- `not_batch_pull` integer[], nullable — Exclude batch (draft) pull requests' own lifecycle events by number — the same event set `batch_pull` includes, negated. Repeatable. Mirrors Datadog's facet semantics: unchecking a batch pull request in the dashboard sidebar adds it to the exclusion list. Mutually exclusive with `batch_pull` (positive include).
- `event_type` EventType[], nullable — The specific types of events to select
- `not_event_type` EventType[], nullable — Exclude events whose type matches any of the given values. Mutually exclusive with `event_type` (positive include).
- `outcome` EventOutcome[], nullable — Filter events by derived outcome label (`success` / `failure` / `pending` / `neutral`). Repeatable to match several outcomes at once (e.g. `?outcome=success&outcome=failure`).
- `not_outcome` EventOutcome[], nullable — Exclude events whose derived outcome label matches any of the given values (`success` / `failure` / `pending` / `neutral`). Repeatable. Mirrors Datadog's facet semantics: unchecking an outcome in the dashboard sidebar adds it to the exclusion list. Mutually exclusive with `outcome` (positive include).
- `trigger` string[], nullable — Include only events whose `trigger` matches one of the given values (exact match). Repeatable. Mirrors Datadog's facet behaviour after clicking `Only`: the URL switches from exclusion mode to inclusion mode with a positive list — shorter than `not_trigger=<everything else>`. Mutually exclusive with `not_trigger`.
- `not_trigger` string[], nullable — Exclude events whose `trigger` matches any of the given values (exact match). Repeatable. Mirrors Datadog's facet semantics: the default state is `all triggers included`, and unchecking a trigger in the dashboard sidebar adds it to the exclusion list. Mutually exclusive with `trigger` (positive include).
- `not_pull_request` integer[], nullable — Exclude events whose pull request matches any of the given numbers. Mutually exclusive with `pull_request` (positive include).
- `received_from` string, date-time, nullable — Start of the time range (ISO 8601 with timezone). Defaults to `received_to - 1 day`.
- `received_to` string, date-time, nullable — End of the time range (ISO 8601 with timezone). Defaults to `now`.

## Response `200`

Successful Response

- ActivityLogAggregateResponse — Aggregations over the same event set `/logs` paginates through. - `total` — count of events matching the filters (over the full set, not just the current page). - `interval_size_seconds` — bucket width auto-picked from the time range by `TimeRange.get_activity_log_interval_size()`. Dense ladder tuned for per-event texture (15s → 30s → 2min → 10min → 20min → 1h → 4h → 8h → 1d), distinct from the smoother `get_interval_size()` ladder used by queue-stats charts. - `histogram` — uniform list of `{start, end, count}` buckets tiling the time range. Zero-filled server-side so the client receives a complete grid (no missing buckets to fill in JS). - `by_event_type` — counts per event type, ordered by `count` desc. - `by_outcome` — counts per derived outcome label (`success` / `failure` / `pending` / `neutral`), ordered by `count` desc. - `by_trigger` — counts per trigger string, ordered by `count` desc. Top 200 triggers by count in the window (single `GROUP BY` over the filter set, capped); the dashboard uses it as the source of truth for the Datadog-style trigger exclusion facet. - `by_pull_request` — counts per pull-request number in the window, ordered by `count` desc, top 200. Window-derived facet (mirrors `by_trigger`): self-excludes both `pull_request` and `not_pull_request` filters so the sidebar always shows the full window distribution. Events with `pull_request=null` are excluded. PR number is returned as a string for uniform JSON serialisation. - `by_batch_pull_request` — counts per batch (draft) PR number in the window, ordered by `count` desc, top 200. Window-derived facet (mirrors `by_pull_request`): self-excludes both `batch_pull` and `not_batch_pull`. The count covers the `checks_start` / `checks_end` events that snapshot the number — the bisection events the `batch_pull` filter pulls in alongside are keyed to the batch id, not the number, so they aren't attributed here. Number is returned as a string for uniform JSON serialisation. `base_ref` is an input-only filter: no filter UI and its cardinality makes it unsuitable as a sidebar facet.
  - `total` integer, required
  - `interval_size_seconds` integer, required
  - `histogram` HistogramBucket[], required
    - `start` string, date-time, required
    - `end` string, date-time, required
    - `count` integer, required
  - `by_event_type` FacetCount[], required
    - `value` string, required
    - `count` integer, required
  - `by_outcome` FacetCount[], required
    - `value` string, required
    - `count` integer, required
  - `by_trigger` FacetCount[], required
    - `value` string, required
    - `count` integer, required
  - `by_pull_request` FacetCount[], required
    - `value` string, required
    - `count` integer, required
  - `by_batch_pull_request` FacetCount[], required
    - `value` string, required
    - `count` integer, required

## Other responses

- `403` — Forbidden
- `404` — Not found
- `409` — Conflict
- `422` — Unprocessable entity

---

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