v23

latestOpenAPI 3.0.1raw.githubusercontent.com2026-08-0127977.1 KB
Stats

Get user stats

Returns detailed coding stats for a specific user, including languages, projects, and total time.

Authentication is OPTIONAL: the endpoint is publicly accessible (no token) whenever the target user has public stats lookup enabled. When a User API Key is supplied it is used to resolve the special username "my" and to grant access to the caller's own private stats.

When total_seconds=true, the response shape is instead { "total_seconds": <number> }.

get/api/v1/users/{username}/stats

Path parameters

usernamestring required

Username, Slack ID, or User ID. The literal value "my" resolves the current user from the Authorization Bearer token (User API Key).

Query parameters

start_datestring date_time

Start date/time (ISO 8601), defaults to 10 years ago

end_datestring date_time

End date/time (ISO 8601), defaults to end of today

limitinteger

Limit number of results

featuresstring

Comma-separated list of features to include (e.g., languages,projects). Defaults to languages.

filter_by_projectstring

Filter results by specific project names (comma-separated)

filter_by_categorystring

Filter results by category (comma-separated)

boundary_awareboolean

Use boundary aware calculation (only applied in the total_seconds branch)

total_secondsboolean

When "true", returns only { total_seconds: <number> } instead of the full stats object

no_ai_codingboolean

When "true", excludes the "ai coding" category from totals/summary. Caveat: heartbeats with no category at all (legacy data) are also excluded due to SQL NULL-comparison semantics.

test_paramboolean

When "true", switches to test mode: forces boundary-aware + valid-timestamps-only and excludes the browsing/meeting/communicating categories (plus "ai coding" when no_ai_coding=true)

Response

successful

Example response

{
  "data": {
    "total_seconds": 3600,
    "daily_average": 1800,
    "languages": [
      {
        "name": "Ruby",
        "total_seconds": 2400,
        "percent": 66.6
      }
    ],
    "projects": [
      {
        "name": "hackatime",
        "total_seconds": 3600,
        "percent": 100
      }
    ],
    "editors": [
      {
        "name": "VS Code",
        "total_seconds": 3600,
        "percent": 100
      }
    ],
    "streak": 7,
    "unique_total_seconds": 12960
  },
  "trust_factor": {
    "trust_level": "blue"
  }
}