---
title: "Get user stats"
method: GET
path: "/api/v1/users/{username}/stats"
tags: ["Stats"]
---

# Get user stats

`GET /api/v1/users/{username}/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> }.

## Path parameters

- `username` string, required

## Query parameters

- `start_date` string, date_time
- `end_date` string, date_time
- `limit` integer
- `features` string
- `filter_by_project` string
- `filter_by_category` string
- `boundary_aware` boolean
- `total_seconds` boolean
- `no_ai_coding` boolean
- `test_param` boolean

## Response `200`

successful

- object
  - `data` object
    - `total_seconds` number
    - `daily_average` number
    - `languages` object[]
      - `name` string
      - `total_seconds` number
      - `percent` number
    - `projects` object[]
      - `name` string
      - `total_seconds` number
      - `percent` number
    - `editors` object[]
      - `name` string
      - `total_seconds` number
      - `percent` number
    - `streak` integer — Number of consecutive days the user has coded
    - `unique_total_seconds` number — Only present when features includes "projects" AND filter_by_project is supplied.
  - `trust_factor` object
    - `trust_level` 'blue' | 'red' | 'green'
    - `trust_value` 0 | 1 | 2

## Other responses

- `403` — forbidden — User has disabled public stats lookup
- `404` — user not found
- `422` — invalid date

---

[API](https://skmtc.net/hackclub/apis/hackatime-api.md) · [All operations](https://skmtc.net/hackclub/apis/hackatime-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/hackclub/hackatime-api/versions/4214f8ab061e/schema)
