Skip to content

Get Kpi Trends

GET
/api/v1/kpi/trends
curl --request GET \
--url 'https://api.ultimateteam.ai/api/v1/kpi/trends?window=1&category=example' \
--header 'X-API-Key: <X-API-Key>'

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.

window
required
Window

Lookback window in days (7, 30, 90)

integer

Lookback window in days (7, 30, 90)

category
required
Category

KPI category: revenue, agent_effectiveness, business_health

string

KPI category: revenue, agent_effectiveness, business_health

Successful Response

Media typeapplication/json
KPITrendResponse

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
Category
string
points
required
Points
Array<object>
KPITrendPoint

A single data point in a KPI trend series.

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

object
category
required
Category
string
metrics
required
Metrics
object
key
additional properties
any
snapshot_date
required
Snapshot Date
string format: date
window
required
Window
integer
Examplegenerated
{
"category": "example",
"points": [
{
"category": "example",
"metrics": {},
"snapshot_date": "2026-04-15"
}
],
"window": 1
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
ctx
Context
object
input
Input
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{
"detail": [
{
"ctx": {},
"input": "example",
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}