---
# @generated by sylphx-gen. Do not edit.
title: "Query an analytics event"
description: "`analytics.analytics_events.query` (POST /v1/{parent}/analytics_events:query): Aggregates deduplicated events in the environment over a bounded interval."
type: reference
product: analytics
summary: "Aggregates deduplicated events in the environment over a bounded interval."
updated: 2026-09-28
nav: false
---

Aggregates deduplicated events in the environment over a bounded interval.

- **Path** `POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/analytics_events:query`
- **Scope** `analytics:read`
- **Effect** `read` — nothing is written.
- **Collection** [analytics_events](/docs/api/analytics_events)

## Request

| Field | Type | What it is |
| --- | --- | --- |
| `parent` | `string` | The environment whose events to query. Required. |
| `start_time` | `timestamp` | Inclusive start of the interval, at most 31 days before end_time. Required. |
| `end_time` | `timestamp` | Exclusive end of the interval; defaults to now. |
| `rollup` | `RollupQuery` | Time buckets, counts, and an optional property sum. Omit for a funnel. |
| `funnel` | `FunnelQuery` | Ordered conversion steps. Omit for a rollup. |

### RollupQuery

| Field | Type | What it is |
| --- | --- | --- |
| `interval` | `RollupInterval` | The width of each UTC bucket. Required. One of `hour`, `day`. |
| `event_names` | `string[]` | Up to 16 event names to include. Empty includes all names. |
| `group_by_properties` | `string[]` | Up to four distinct top-level string property keys to group by. Missing and non-string values are grouped with the empty string. A dot in a key is literal, not a path. Keys match ^[A-Za-z_][A-Za-z0-9_.]&#123;0,63&#125;$. |
| `sum_property` | `string` | A top-level numeric property to sum. Missing and non-numeric values contribute zero. Uses the same key grammar as group_by_properties. |
| `property_filters` | `map<string, string>` | Up to four exact string matches, all of which must hold on each event. Keys use the same grammar as group_by_properties; values are at most 128 bytes. |
| `limit` | `int32` | Maximum buckets returned. Defaults to 100; clamped to 1–500. |

### FunnelQuery

| Field | Type | What it is |
| --- | --- | --- |
| `steps` | `string[]` | Two to 16 event names in step order. Each step must occur at a strictly later event timestamp than the prior step, inside the query interval. Required. |
| `conversion_window_seconds` | `int64` | Seconds allowed from the first step, inclusive; 1 to 2592000 (30 days). Required. |
| `breakdown_property` | `string` | A top-level property key, matching ^[A-Za-z_][A-Za-z0-9_.]&#123;0,63&#125;$. Each step in a chain must have the same string value. Missing and non-string values are grouped with the empty string. Omit for one funnel. |
| `property_filters` | `map<string, string>` | Up to four exact string matches, all of which must hold on every step. Keys use the same grammar as breakdown_property; values are at most 128 bytes. |
| `limit` | `int32` | Maximum breakdown values returned. Defaults to 50; clamped to 1–200. |

## Response

| Field | Type | What it is |
| --- | --- | --- |
| `rollup_buckets` | `AnalyticsRollupBucket[]` | Buckets ordered by newest start, then event name and dimension values ascending. |
| `funnel_steps` | `AnalyticsFunnelStep[]` | Steps in request order within each breakdown, ranked by starters descending then by breakdown value ascending. |

### AnalyticsRollupBucket

| Field | Type | What it is |
| --- | --- | --- |
| `bucket_start` | `timestamp` | The UTC start of the bucket. |
| `event_name` | `string` | The event name. |
| `dimensions` | `map<string, string>` | The values of the requested group-by keys. |
| `event_count` | `int64` | Deduplicated event count. |
| `unique_subjects` | `int64` | Exact number of distinct subjects. |
| `property_sum` | `double` | The numeric sum, present when sum_property was requested. |

### AnalyticsFunnelStep

| Field | Type | What it is |
| --- | --- | --- |
| `step_index` | `int32` | Zero-based step position in the request. |
| `event_name` | `string` | The event name of the step. |
| `breakdown_value` | `string` | The breakdown value; empty for an unsegmented funnel. |
| `subjects` | `int64` | Distinct subjects that reached this step in this breakdown. |
| `conversion_from_start_pct` | `double` | Percentage of first-step subjects who reached this step (0–100). Zero if there were no first-step subjects. |
| `conversion_from_previous_pct` | `double` | Percentage of previous-step subjects who reached this step (0–100). The first step uses its own count as denominator; zero when it is zero. |

## Errors

- [`UNAUTHENTICATED`](/docs/api/errors/UNAUTHENTICATED) — No valid key or token was presented.
- [`PERMISSION_DENIED`](/docs/api/errors/PERMISSION_DENIED) — The key lacks the method's permission.
- [`INVALID_FIELD`](/docs/api/errors/INVALID_FIELD) — A field failed validation.
- [`UNAVAILABLE`](/docs/api/errors/UNAVAILABLE) — The Resource store, the owning service's backend, or the key verifier's snapshot is unavailable; retry after Retry-After.

Every error arrives in the body [Errors](/docs/platform/errors) describes.

## Examples

**cURL**

```curl
curl -X POST "https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/analytics_events:query" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"start_time":{}}'
```

**TypeScript**

```ts
const response = await sylphx.analytics.analyticsEvents.query({ parent: 'orgs/acme/projects/shop/envs/production', startTime: {} })
```

**Rust**

```rust
let mut req = sylphx::analytics::QueryAnalyticsEventsRequest::default();
req.parent = "orgs/acme/projects/shop/envs/production".to_string();
req.start_time = Some(Default::default());
let response = sx.analytics().analytics_events().query(req).await?;
```

**CLI**

```bash
sylphx analytics analytics-events query orgs/acme/projects/shop/envs/production
```

**MCP**

```json
{ "method_id": "analytics.analytics_events.query", "args": {"parent":"orgs/acme/projects/shop/envs/production","start_time":{}} }
```
