Query analytics
Query analytics
Run an analytics query with selected measures, dimensions, filters, and time windows.
POST
Query analytics
Required access
Body
string
required
Dataset to query. For example,
tickets, messages, outbound_messages, marketing_attribution, csat, or workforce_activity.string[]
required
Measures to calculate. For example,
["ticket_count", "open_ticket_count"] for the tickets dataset or ["message_count", "customer_message_count"] for the messages dataset.string[]
Optional dimensions to group results. For example,
["channel_kind"], ["priority"], or ["day_of_week", "hour_of_day"].object
Optional filter object. For example,
{ "channel_ids": ["<channel_id>"], "statuses": ["open"] }. For channel, agent, pilot, team, or workspace IDs, see Resource IDs.object
Optional time window. Include this for trend queries or date-bounded summaries.
string
ISO start timestamp. For example,
2026-05-01T00:00:00.000Z.string
ISO end timestamp. For example,
2026-05-29T23:59:59.999Z.string
Timezone used to interpret the time window. For example,
Asia/Kolkata or UTC.string
Time grain for grouped trend results. Use
day, week, or month.string
Timestamp field used for the query window. For example,
created_at, closed_at, message_created_at, sent_at, or order_created_at.object
Optional business-hours configuration for business-hours duration measures.
string
Business-hours timezone. For example,
Asia/Kolkata.string
Local business day start time. For example,
09:00.string
Local business day end time. For example,
18:00.integer[]
Working days as weekday numbers. For example,
[1, 2, 3, 4, 5] for Monday through Friday.string
default:"rows"
Response shape. Use
summary for aggregate totals or rows for grouped rows.object[]
Optional sort instructions. For example,
[{ "field": "ticket_count", "direction": "desc" }].string
Field to sort by, usually a requested measure or dimension.
string
Sort direction. Use
asc or desc.integer
Maximum number of rows to return. For example,
100.string
Cursor from the previous response when paginating through row results.
Notes
- This endpoint uses API client v2 credentials. See API client v2.