---
title: "Get hours"
method: GET
path: "/api/v1/authenticated/hours"
tags: ["OAuth2-specific"]
---

# Get hours

`GET /api/v1/authenticated/hours`

Returns the total coding hours for the authenticated user. Requires an OAuth2 access token with the `read` scope in the Bearer header.

## Query parameters

- `start_date` string, date
- `end_date` string, date

## Response `200`

successful

- object
  - `start_date` string, date
  - `end_date` string, date
  - `total_seconds` number

## Other responses

- `401` — unauthorized — Returned when the OAuth access token is missing or invalid (empty body), or when the authenticated user is banned (`trust_level == "red"`) via the `ensure_no_ban` before_action (which responds with a `{ "error": "Unauthorized" }` body).
- `403` — insufficient scope

## Changes

- **2026-08-09** (v1) `b19b0d3a87ae` — 3 info
  - the endpoint scheme security `OAuth2` was added to the API
  - the endpoint scheme security `Bearer` was removed from the API
  - added the non-success response with the status `403`
- **2026-06-07** (v1) `10d87f00ef0b` — 4 info
  - the endpoint scheme security `Bearer` was added to the API
  - the endpoint scheme security `Bearer AND ApiKeyAuth` was removed from the API
  - api tag `OAuth2-specific` added
  - api tag `Authenticated` removed
- **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`
- **2026-01-27** (v1) `b6d6849481da` — 6 info
  - the endpoint scheme security `Bearer AND ApiKeyAuth` was added to the API
  - the endpoint scheme security `Bearer` was removed from the API
  - api tag `Authenticated` added
  - api tag `OAuth2-specific` removed
  - …2 more

[Change history](https://skmtc.dev/hackclub/apis/hackatime-api/changes/api/v1/authenticated/hours/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)
