Skip to content
Console
On this page

Query an analytics event

Aggregates deduplicated events in the environment over a bounded interval.

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

Request

FieldTypeWhat it is
parentstringThe environment whose events to query. Required.
start_timetimestampInclusive start of the interval, at most 31 days before end_time. Required.
end_timetimestampExclusive end of the interval; defaults to now.
rollupRollupQueryTime buckets, counts, and an optional property sum. Omit for a funnel.
funnelFunnelQueryOrdered conversion steps. Omit for a rollup.

RollupQuery

FieldTypeWhat it is
intervalRollupIntervalThe width of each UTC bucket. Required. One of hour, day.
event_namesstring[]Up to 16 event names to include. Empty includes all names.
group_by_propertiesstring[]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_.]{0,63}$.
sum_propertystringA top-level numeric property to sum. Missing and non-numeric values contribute zero. Uses the same key grammar as group_by_properties.
property_filtersmap<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.
limitint32Maximum buckets returned. Defaults to 100; clamped to 1–500.

FunnelQuery

FieldTypeWhat it is
stepsstring[]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_secondsint64Seconds allowed from the first step, inclusive; 1 to 2592000 (30 days). Required.
breakdown_propertystringA top-level property key, matching ^[A-Za-z_][A-Za-z0-9_.]{0,63}$. 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_filtersmap<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.
limitint32Maximum breakdown values returned. Defaults to 50; clamped to 1–200.

Response

FieldTypeWhat it is
rollup_bucketsAnalyticsRollupBucket[]Buckets ordered by newest start, then event name and dimension values ascending.
funnel_stepsAnalyticsFunnelStep[]Steps in request order within each breakdown, ranked by starters descending then by breakdown value ascending.

AnalyticsRollupBucket

FieldTypeWhat it is
bucket_starttimestampThe UTC start of the bucket.
event_namestringThe event name.
dimensionsmap<string, string>The values of the requested group-by keys.
event_countint64Deduplicated event count.
unique_subjectsint64Exact number of distinct subjects.
property_sumdoubleThe numeric sum, present when sum_property was requested.

AnalyticsFunnelStep

FieldTypeWhat it is
step_indexint32Zero-based step position in the request.
event_namestringThe event name of the step.
breakdown_valuestringThe breakdown value; empty for an unsegmented funnel.
subjectsint64Distinct subjects that reached this step in this breakdown.
conversion_from_start_pctdoublePercentage of first-step subjects who reached this step (0–100). Zero if there were no first-step subjects.
conversion_from_previous_pctdoublePercentage 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 — No valid key or token was presented.
  • PERMISSION_DENIED — The key lacks the method's permission.
  • INVALID_FIELD — A field failed validation.
  • 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 describes.

Examples

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":{}}'