Skip to main content

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

ParameterTypeDescription
client_idstring (uuid)Unique identifier for the client organization
user_idstring (uuid)Unique identifier for the user

Query Parameters

ParameterTypeRequiredDescription
granularitystringYesAggregation granularity: daily, weekly, monthly, quarterly
start_datestringYesStart of date range (YYYY-MM-DD)
end_datestringYesEnd of date range, inclusive (YYYY-MM-DD)
metricstringYesMetric to retrieve. See Available Metrics.

Available Metrics

MetricLabelDescriptionDB Aggregation
activity-countTotal ActivitySum of all activity events across every source and deviceSUM(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

StatusDescription
400Invalid parameters (bad date format, range exceeds 90 days, unknown metric)
401Authentication required
403Insufficient permissions for this client
404User or client not found
500Server 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).