Skip to content

Get Kpi Trends

GET
/api/v1/kpi/trends

Get KPI trend data for charting.

Returns daily KPI snapshots for the specified window and category, ordered by date ASC for time-series charting.

Args: window: Number of days to look back (7, 30, 90). category: KPI category filter. user: Authenticated user context. db: Async database session.

Returns: KPITrendResponse with trend points.

Raises: HTTPException: 400 if window or category invalid.

Authorizations

Parameters

Query Parameters

window
required

Lookback window in days (7, 30, 90)

integer

Lookback window in days (7, 30, 90)

category
required

KPI category: revenue, agent_effectiveness, business_health

string

KPI category: revenue, agent_effectiveness, business_health

Responses

200

Successful Response

Response model for KPI trend aggregation.

Contains the requested window size, category filter, and ordered list of daily trend points for charting.

object
category
required
string
points
required
Array<object>

A single data point in a KPI trend series.

Represents one day’s snapshot for a specific KPI category.

object
category
required
string
metrics
required
object
key
additional properties
any
snapshot_date
required
string format: date
window
required
integer

422

Validation Error

object
detail
Array<object>
object
ctx
object
input
loc
required
Array
msg
required
string
type
required
string