User Activity
GET /clients/{client_id}/analytics/users/{user_id}/activity
Returns a daily time-series of activity for a specific user. Each data point represents the total activity count for that user across all devices and sources on a given day.
Use Case
Use this endpoint to:
- Display a user's activity trend on their profile page (line chart, sparkline)
- Compare activity across time periods
- Identify inactive days or usage patterns
Path Parameters
| Parameter | Type | Description |
|---|---|---|
client_id | string (uuid) | Unique identifier for the client organization |
user_id | string (uuid) | Unique identifier for the user |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
granularity | string | Yes | Aggregation granularity: daily, weekly, monthly, quarterly |
start_date | string | Yes | Start of date range (YYYY-MM-DD) |
end_date | string | Yes | End of date range, inclusive (YYYY-MM-DD) |
metric | string | Yes | Metric to retrieve. See Available Metrics. |
Available Metrics
| Metric | Label | Description | DB Aggregation |
|---|---|---|---|
activity-count | Total Activity | Sum of all activity events across every source and device | SUM(heartbeats.total_activity_count) GROUP BY DATE(generated_at_utc) WHERE user_id = ? |
total_activity_count is the sum of chrome_activity_count, edge_activity_count, firefox_activity_count, desktop_activity_count, and web_accessibility_activity_count.
Response
Returns an ActivityTimeSeries.
Example Request
curl -X GET "https://api.example.com/v2/clients/aa7cf840-9ca9-46a3-9778-9015d6580d50/analytics/users/a1d97031-04e2-4907-a249-093f7436207b/activity?start_date=2026-01-01&end_date=2026-01-15&metric=activity-count" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Example Response
{
"metric": "activity-count",
"label": "Total Activity",
"period": {
"start": "2026-01-01",
"end": "2026-01-15"
},
"data": [
{ "date": "2026-01-01", "value": 42 },
{ "date": "2026-01-02", "value": 38 },
{ "date": "2026-01-03", "value": 51 },
{ "date": "2026-01-04", "value": 0 },
{ "date": "2026-01-05", "value": 0 },
{ "date": "2026-01-06", "value": 45 },
{ "date": "2026-01-07", "value": 39 },
{ "date": "2026-01-08", "value": 47 },
{ "date": "2026-01-09", "value": 44 },
{ "date": "2026-01-10", "value": 52 },
{ "date": "2026-01-11", "value": 0 },
{ "date": "2026-01-12", "value": 0 },
{ "date": "2026-01-13", "value": 48 },
{ "date": "2026-01-14", "value": 41 },
{ "date": "2026-01-15", "value": 46 }
]
}
Error Responses
| Status | Description |
|---|---|
| 400 | Invalid parameters (bad date format, range exceeds 90 days, unknown metric) |
| 401 | Authentication required |
| 403 | Insufficient permissions for this client |
| 404 | User or client not found |
| 500 | Server error |
Example Error Response
{
"error": {
"code": "invalid_parameter",
"message": "Date range cannot exceed 90 days",
"details": {
"start_date": "2026-01-01",
"end_date": "2026-06-01"
}
}
}
Notes
- The response always includes every date in the range, even weekends or days with zero activity.
- All dates are in the client's configured timezone.
- Data freshness depends on heartbeat delivery (typically within 5 minutes).
Related Endpoints
- Get User -- User identity and metadata
- Device Activity -- Activity time-series for a device
- App Activity -- Activity time-series for an app