Skip to main content
POST
Run an analytics query for the active agency.

Authorizations

X-CB-KEY
string
header
required

CloseBot API Key Authorization

Body

metric
string | null
required

Metric to query. Call GET /analytics/metrics for the full catalog of valid keys, or pass "formula" together with Closebot.Api.Controllers.AnalyticsController.AnalyticsQueryRequest.Formula to compute a derived metric.

start
string<date-time>
required

Inclusive start. A UTC instant in utc mode; a source-local wall-clock value in sourceLocal mode. Must align to a 15-minute boundary.

end
string<date-time>
required

Exclusive end. A UTC instant in utc mode; a source-local wall-clock value in sourceLocal mode. Must align to a 15-minute boundary.

resolution
string | null
required

Bucket size. Time buckets: 15m, hour, day, week, month (multiples of the 15-minute base). Week buckets start Monday 00:00 of the active time basis. Non-time: source (one point per source name over the whole range, not grouped by time), total (the whole range as one point), hourOfWeek (every bucket folded onto one week of day-of-week x hour-of-day cells).

formula
object
groupBy
string[] | null

Optional dimension to split the series by — source, channel, bot, persona, or the metric's own detail dimensions. At most one: a chart segments by a single thing, and allowing two would multiply the series out past anything readable.

timeZone
string | null

IANA time zone id (e.g. "America/Denver") used by the hourOfWeek fold when Closebot.Api.Controllers.AnalyticsController.AnalyticsQueryRequest.TimeBasis is utc, to decide which local weekday and hour each bucket belongs to. Ignored by every other resolution, and ignored entirely in sourceLocal mode — that fold reads each row's own source-local timestamp instead. Defaults to UTC.

timeBasis
string | null

"utc" (default) or "sourceLocal". See Closebot.Api.Controllers.AnalyticsController.AnalyticsTimeBasis. In sourceLocal mode Closebot.Api.Controllers.AnalyticsController.AnalyticsQueryRequest.Start and Closebot.Api.Controllers.AnalyticsController.AnalyticsQueryRequest.End are read as wall-clock values rather than UTC instants, so a month means each source's own local month.

filters
object

Response

OK

points
object[] | null
required
sourcesMissingTimeZone
object[] | null

Sources that contributed rows to this result but have no resolvable timezone, so were bucketed as UTC. Populated only in sourceLocal mode; null otherwise. Lets the chart say which sources need fixing instead of being quietly wrong.