curl --request POST \
--url https://app.alana.shopping/api/workspace/{workspaceId}/dashboards/aggregate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event_types": [
"<string>"
],
"group_by": "<string>",
"time_window_days": 183,
"limit": 100
}
'{
"rows": [
{
"key": "<string>",
"value": 123,
"secondary": 123
}
],
"generated_at": "2023-11-07T05:31:56Z",
"cache_hit": true
}Executar Agregação
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.
curl --request POST \
--url https://app.alana.shopping/api/workspace/{workspaceId}/dashboards/aggregate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event_types": [
"<string>"
],
"group_by": "<string>",
"time_window_days": 183,
"limit": 100
}
'{
"rows": [
{
"key": "<string>",
"value": 123,
"secondary": 123
}
],
"generated_at": "2023-11-07T05:31:56Z",
"cache_hit": true
}Autorizações
Bearer token authentication via Auth0. Users authenticate through Auth0 Universal Login. Include the access token in the Authorization header: Authorization: Bearer <token>
Cabeçalhos
Optional catalog scope for the aggregation
Parâmetros de caminho
The workspace ID
^ws_[a-z0-9]+$Parâmetros de consulta
Corpo
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. where key matches /^[a-z_][a-z0-9_]{0,62}$/
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