Get Metrics Time Series
GET/api/v2/org/:org_id/workspace/:workspace_id/metrics/time_series
Get daily aggregated time series data for workspace metrics.
Aggregates metrics into daily buckets and returns the count of metrics per day. Each day in the date range will have an entry, even if the count is zero. Data is based on created_at timestamps, not event time.
Args:
org_id (str): Path parameter - Organization ID that owns the workspace workspace_id (str): Path parameter - Target workspace ID to analyze from_date (datetime): Query parameter - Start date for the time series (inclusive) to_date (datetime): Query parameter - End date for the time series (inclusive) metric_type (str, optional): Query parameter - Filter by specific metric type Examples: "auth.user.login", "chat.message.create" If None, aggregates all metric types together
Returns
list[MetricsTimeSeriesSchema]: Time series data with schema:
- x (str): Date in "YYYY-MM-DD" format
- y (int): Count of metrics for that day
Details
- Time series is based on created_at timestamp, NOT the event time field
- Results are ordered in REVERSE chronological order (newest first)
- Missing days in the range will show count of 0, not be omitted
- Date range is processed in UTC timezone regardless of input timezone
- Large date ranges (>365 days) may impact performance significantly
- Only provides daily granularity - intraday patterns are aggregated
Example Response:
[ {"x": "2024-01-03", "y": 15}, {"x": "2024-01-02", "y": 8}, {"x": "2024-01-01", "y": 0} ]
Permissions:
- Scope: workspace_metrics:read
- Allowed Roles:
- superadmin: ✓
- admin: ✓
- controller: ✓
- curator: ✓
- basic: ✗ (read permission denied)
Request
Responses
- 200
- 422
Successful Response
Validation Error