---
title: "Get total coding time"
method: GET
path: "/api/v1/stats"
tags: ["Stats"]
---

# Get total coding time

`GET /api/v1/stats`

Returns the total coding time for all users, optionally filtered by user or date range. Requires an active Admin API Key supplied via the Bearer header. Admin API Keys are never accepted in the api_key query param. During migration, STATS_API_KEY is accepted via the Bearer header or api_key query param only when the allow_legacy_stats_api_key Flipper flag is enabled. Authentication is skipped entirely in development.

## Query parameters

- `start_date` string, date
- `end_date` string, date
- `username` string
- `user_email` string

## Response `200`

successful

## Other responses

- `401` — unauthorized — Returned when the Admin API Key is missing, revoked, or incorrect. (Auth is bypassed in the development environment.)
- `404` — user not found
- `422` — invalid date

## Changes

- **2026-08-04** (v1) `4214f8ab061e` — 3 info
  - the endpoint scheme security `Bearer` was added to the API
  - the endpoint scheme security `LegacyStatsApiKey` was added to the API
  - the endpoint scheme security `Bearer AND ApiKeyAuth` was removed from the API
- **2026-06-07** (v1) `10d87f00ef0b` — 1 info
  - added the non-success response with the status `401`
- **2026-02-21** (v1) `9c5c308ea36c` — 1 info
  - removed the non-success response with the status `401`
- **2026-02-20** (v1) `3b1a9efa4afe` — 1 info
  - added the non-success response with the status `422`
- **2026-01-28** (v1) `a9eaba48a93a` — 2 breaking
  - for the `query` request parameter `end_date`, the type/format was changed from `string`/`` to `string`/`date`
  - for the `query` request parameter `start_date`, the type/format was changed from `string`/`` to `string`/`date`

[Full history](https://skmtc.dev/hackclub/apis/hackatime-api/changes/api/v1/stats/get.md)

---

[API](https://skmtc.dev/hackclub/apis/hackatime-api.md) · [All operations](https://skmtc.dev/hackclub/apis/hackatime-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/hackclub/hackatime-api/revisions/172c35ec816f/schema)
