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
}
'import requests
url = "https://app.alana.shopping/api/workspace/{workspaceId}/dashboards/aggregate"
payload = {
"event_types": ["<string>"],
"group_by": "<string>",
"time_window_days": 183,
"limit": 100
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event_types: ['<string>'],
group_by: '<string>',
time_window_days: 183,
limit: 100
})
};
fetch('https://app.alana.shopping/api/workspace/{workspaceId}/dashboards/aggregate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.alana.shopping/api/workspace/{workspaceId}/dashboards/aggregate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'event_types' => [
'<string>'
],
'group_by' => '<string>',
'time_window_days' => 183,
'limit' => 100
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.alana.shopping/api/workspace/{workspaceId}/dashboards/aggregate"
payload := strings.NewReader("{\n \"event_types\": [\n \"<string>\"\n ],\n \"group_by\": \"<string>\",\n \"time_window_days\": 183,\n \"limit\": 100\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.alana.shopping/api/workspace/{workspaceId}/dashboards/aggregate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event_types\": [\n \"<string>\"\n ],\n \"group_by\": \"<string>\",\n \"time_window_days\": 183,\n \"limit\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.alana.shopping/api/workspace/{workspaceId}/dashboards/aggregate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event_types\": [\n \"<string>\"\n ],\n \"group_by\": \"<string>\",\n \"time_window_days\": 183,\n \"limit\": 100\n}"
response = http.request(request)
puts response.read_body{
"rows": [
{
"key": "<string>",
"value": 123,
"secondary": 123
}
],
"generated_at": "2023-11-07T05:31:56Z",
"cache_hit": true
}{
"error": "INVALID_REQUEST",
"details": {
"field": "email",
"message": "Invalid email format"
}
}{
"error": "UNAUTHORIZED",
"details": {
"message": "Missing or invalid authentication token"
}
}{
"error": "FORBIDDEN",
"details": {
"message": "User does not have permission to access this resource"
}
}{
"error": "Too many requests"
}{
"error": "INTERNAL_SERVER_ERROR",
"details": {
"message": "An unexpected error occurred"
}
}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
}
'import requests
url = "https://app.alana.shopping/api/workspace/{workspaceId}/dashboards/aggregate"
payload = {
"event_types": ["<string>"],
"group_by": "<string>",
"time_window_days": 183,
"limit": 100
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event_types: ['<string>'],
group_by: '<string>',
time_window_days: 183,
limit: 100
})
};
fetch('https://app.alana.shopping/api/workspace/{workspaceId}/dashboards/aggregate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.alana.shopping/api/workspace/{workspaceId}/dashboards/aggregate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'event_types' => [
'<string>'
],
'group_by' => '<string>',
'time_window_days' => 183,
'limit' => 100
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.alana.shopping/api/workspace/{workspaceId}/dashboards/aggregate"
payload := strings.NewReader("{\n \"event_types\": [\n \"<string>\"\n ],\n \"group_by\": \"<string>\",\n \"time_window_days\": 183,\n \"limit\": 100\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.alana.shopping/api/workspace/{workspaceId}/dashboards/aggregate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event_types\": [\n \"<string>\"\n ],\n \"group_by\": \"<string>\",\n \"time_window_days\": 183,\n \"limit\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.alana.shopping/api/workspace/{workspaceId}/dashboards/aggregate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event_types\": [\n \"<string>\"\n ],\n \"group_by\": \"<string>\",\n \"time_window_days\": 183,\n \"limit\": 100\n}"
response = http.request(request)
puts response.read_body{
"rows": [
{
"key": "<string>",
"value": 123,
"secondary": 123
}
],
"generated_at": "2023-11-07T05:31:56Z",
"cache_hit": true
}{
"error": "INVALID_REQUEST",
"details": {
"field": "email",
"message": "Invalid email format"
}
}{
"error": "UNAUTHORIZED",
"details": {
"message": "Missing or invalid authentication token"
}
}{
"error": "FORBIDDEN",
"details": {
"message": "User does not have permission to access this resource"
}
}{
"error": "Too many requests"
}{
"error": "INTERNAL_SERVER_ERROR",
"details": {
"message": "An unexpected error occurred"
}
}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