Execute an aggregation against agent_events in DO Postgres scoped to the active workspace + brand. Used by widgets at view time. Results are cached in Redis for 60 seconds; cache_hit indicates whether this response was served from cache. Brand context is taken exclusively from the X-Active-Brand header or ?brand_id query — there is no brand_id field in the request body. Optional X-Active-Catalog header narrows the aggregation to a single catalog.
Bearer token authentication via Auth0. Users authenticate through Auth0 Universal Login. Include the access token in the Authorization header: Authorization: Bearer <token>
Optional catalog scope for the aggregation
The workspace ID
^ws_[a-z0-9]+$Filter by event types (canonical or custom). null/empty = all events.
50^[a-z][a-z0-9_]{1,62}$One of: none, event_type, session, day, hour, product_id; OR metadata.
count, count_distinct, sum, avg 1 <= x <= 365Required when aggregation is sum or avg; ignored for count/count_distinct
value, amount, price, quantity, duration_ms, score, rating, session_id, product_id, agent_id, customer_id 1 <= x <= 1000